Skip to content

Commit

Permalink
uncommented out and moved organelleclicked functions to editor hud cl…
Browse files Browse the repository at this point in the history
…ass, made them call setActiveAction, added nitrogenfixingplastid and chemoplast buttons to dictionary, formatted scripts
  • Loading branch information
Untrustedlife committed Jun 29, 2018
1 parent 4c1ff4d commit 2f7234b
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 104 deletions.
54 changes: 28 additions & 26 deletions scripts/microbe_editor/microbe_editor.as
Expand Up @@ -32,6 +32,7 @@ funcdef void PlacementFunctionType(const string &in actionName);


class MicrobeEditor{

MicrobeEditor(MicrobeEditorHudSystem@ hud){

@hudSystem = hud;
Expand All @@ -44,6 +45,8 @@ class MicrobeEditor{
{"chloroplast", PlacementFunctionType(this.addOrganelle)},
{"oxytoxy", PlacementFunctionType(this.addOrganelle)},
{"vacuole", PlacementFunctionType(this.addOrganelle)},
{"nitrogenfixingplastid", PlacementFunctionType(this.addOrganelle)},
{"chemoplast", PlacementFunctionType(this.addOrganelle)},
{"remove", PlacementFunctionType(this.removeOrganelle)}
};
}
Expand Down Expand Up @@ -366,7 +369,7 @@ class MicrobeEditor{
// this.createHexComponent(hex.q + organelle.position.q, hex.r + organelle.position.r)
// }
// }*/
// activeActionName = "cytoplasm";
//activeActionName = "cytoplasm";
// Engine.playerData().setActiveCreature(this.currentMicrobeEntity.id, GameState.MICROBE_EDITOR.wrapper);
},
null);
Expand Down Expand Up @@ -650,28 +653,28 @@ class MicrobeEditor{
// OgreSceneNodeComponent);
// }

// if (activeActionName){
// dictionary oldData = {["name"]=this.activeActionName,
// ["q"]=-q,
// ["r"]=-r,
// ["rotation"]=(180+rotation) % 360};
// auto hexes = OrganelleFactory.checkSize(oldData);
// auto colour = ColourValue(2, 0, 0, 0.4);
// bool touching = false;
// for(_, hex in ipairs(hexes)){
// if(this.surroundsOrganelle(-hex.q + q, -hex.r + r)){
// colour = ColourValue(0, 2, 0, 0.4)
// }
// }
// for(_, hex in ipairs(hexes)){
// auto organelle = MicrobeSystem.getOrganelleAt(this.currentMicrobeEntity, -hex.q + q, -hex.r + r)
// if(organelle){
// if(organelle.name ~= "cytoplasm"){
// colour = ColourValue(2, 0, 0, 0.4)
// }
// }
// }
// if (CEGUIWindow.getWindowUnderMouse().getName() == 'root'){
if (activeActionName != ""){
/* dictionary oldData = {["name"]=this.activeActionName,
["q"]=-q,
["r"]=-r,
["rotation"]=(180+rotation) % 360};
auto hexes = OrganelleFactory.checkSize(oldData);
auto colour = ColourValue(2, 0, 0, 0.4);
bool touching = false;
for(_, hex in ipairs(hexes)){
if(this.surroundsOrganelle(-hex.q + q, -hex.r + r)){
colour = ColourValue(0, 2, 0, 0.4)
}
}
for(_, hex in ipairs(hexes)){
auto organelle = MicrobeSystem.getOrganelleAt(this.currentMicrobeEntity, -hex.q + q, -hex.r + r)
if(organelle){
if(organelle.name ~= "cytoplasm"){
colour = ColourValue(2, 0, 0, 0.4)
}
}
}*/
//if (CEGUIWindow.getWindowUnderMouse().getName() == 'root'){

// dictionary newData = {
// ["name"]=activeActionName,
Expand All @@ -688,7 +691,8 @@ class MicrobeEditor{
// sceneNode[i].transform.touch();
// }
// }
// }
//}
}
}

//checks whether the hex at q, r has an organelle in its surroundeing hexes.
Expand Down Expand Up @@ -732,9 +736,7 @@ class MicrobeEditor{
// marks the last action that has been done (not undone, but
// possibly redone), is 0 if there is none
private int actionIndex;

private string activeActionName;

// This is the container that has the edited organelles in it.
// This is populated when entering and used to update the player's species template on exit
private OrganelleContainer editedMicrobe;
Expand Down
173 changes: 96 additions & 77 deletions scripts/microbe_editor/microbe_editor_hud.as
Expand Up @@ -245,6 +245,102 @@ class MicrobeEditorHudSystem : ScriptSystem{
// this.activeButton = null; // stores button, not name
bool helpPanelOpen = false;
bool menuOpen = false;
void nucleusClicked(){

This comment has been minimized.

Copy link
@hhyyrylainen

hhyyrylainen Jun 29, 2018

Member

It would probably be easier if the GUI sent a single event with the active thing name instead of having five billion functions that also need wrappers for the GUI to call them

// if(this.activeButton !is null){
// this.activeButton.enable()
// }
setActiveAction("nucleus");
}

void flagellumClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["flagellum"]
// this.activeButton.disable()
setActiveAction("flagellum");
}

void cytoplasmClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["cytoplasm"]
// this.activeButton.disable()
setActiveAction("cytoplasm");
}

void mitochondriaClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["mitochondrion"]
// this.activeButton.disable()
setActiveAction("mitochondrion");
}

void chloroplastClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["chloroplast"]
// this.activeButton.disable()
setActiveAction("chloroplast");
}

void vacuoleClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["vacuole"]
// this.activeButton.disable()
setActiveAction("vacuole");
}

void plastidClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["Toxin"]
// this.activeButton.disable()
setActiveAction("nitrogenfixingplastid");
}

void chemoplastClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["Toxin"]
// this.activeButton.disable()
setActiveAction("chemoplast");
}

void pilusClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["Toxin"]
// this.activeButton.disable()
//this.setActiveAction("pilus")
}

void toxinClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["Toxin"]
// this.activeButton.disable()
setActiveAction("oxytoxy");
}


void removeClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = null
setActiveAction("remove");
}
}

// Callbacks from the key handlers
Expand Down Expand Up @@ -401,84 +497,7 @@ class MicrobeEditorHudSystem : ScriptSystem{
// this.helpOpen = not this.helpOpen
// }

// void MicrobeEditorHudSystem.nucleusClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.setActiveAction("nucleus")
// }

// void MicrobeEditorHudSystem.flagellumClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["flagellum"]
// this.activeButton.disable()
// this.setActiveAction("flagellum")
// }

// void MicrobeEditorHudSystem.cytoplasmClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["cytoplasm"]
// this.activeButton.disable()
// this.setActiveAction("cytoplasm")
// }

// void MicrobeEditorHudSystem.mitochondriaClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["mitochondrion"]
// this.activeButton.disable()
// this.setActiveAction("mitochondrion")
// }

// void MicrobeEditorHudSystem.chloroplastClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["chloroplast"]
// this.activeButton.disable()
// this.setActiveAction("chloroplast")
// }

// void MicrobeEditorHudSystem.aminoSynthesizerClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["aminosynthesizer"]
// this.activeButton.disable()
// this.setActiveAction("aminosynthesizer")
// }

// void MicrobeEditorHudSystem.vacuoleClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["vacuole"]
// this.activeButton.disable()
// this.setActiveAction("vacuole")
// }

// void MicrobeEditorHudSystem.toxinClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = this.organelleButtons["Toxin"]
// this.activeButton.disable()
// this.setActiveAction("oxytoxy")
// }


// void MicrobeEditorHudSystem.removeClicked(){
// if(this.activeButton !is null){
// this.activeButton.enable()
// }
// this.activeButton = null
// this.setActiveAction("remove")
// }

// void MicrobeEditorHudSystem.rootSaveCreationClicked(){
// getComponent("gui_sounds", g_luaEngine.currentGameState, SoundSourceComponent
Expand Down
2 changes: 1 addition & 1 deletion src/microbe_stage/membrane_system.cpp
Expand Up @@ -381,7 +381,7 @@ size_t
for(size_t i = 0, end = vertices2D.size(); i < end + 1; i++) {
// Finds the UV coordinates be projecting onto a plane and
// stretching to fit a circle.
const double currentRadians = 3.1416 * i / end;
const double currentRadians = 3.1416 * i / end;
meshVertices[writeIndex++] = {
Ogre::Vector3(vertices2D[i % end].x,
vertices2D[i % end].z + height / 2, vertices2D[i % end].y),
Expand Down

0 comments on commit 2f7234b

Please sign in to comment.