diff --git a/scripts/gui/microbe_editor.mjs b/scripts/gui/microbe_editor.mjs index cf08ff04127..408bc803cfc 100644 --- a/scripts/gui/microbe_editor.mjs +++ b/scripts/gui/microbe_editor.mjs @@ -63,6 +63,10 @@ const organelleSelectionElements = [ { element: document.getElementById("addChromatophor"), organelle: "chromatophors" + }, + { + element: document.getElementById("addNucleus"), + organelle: "nucleus" } // AddPilus @@ -126,7 +130,9 @@ export function setupMicrobeEditor(){ element.element.addEventListener("click", (event) => { event.stopPropagation(); - onSelectNewOrganelle(element.organelle); + if(!element.element.classList.contains("DisabledButton")) { + onSelectNewOrganelle(element.organelle); + } }, true); } @@ -193,6 +199,11 @@ export function setupMicrobeEditor(){ // Event for restoring the microbe GUI Leviathan.OnGeneric("MicrobeEditorExited", doExitMicrobeEditor); + // Event for update buttons depending on presence or not of nucleus + Leviathan.OnGeneric("MicrobeEditorNucleusIsPresent", (event, vars) => { + updateGuiButtons(vars.nucleus); + }); + } else { updateSelectedOrganelle("cytoplasm"); } @@ -287,6 +298,33 @@ function updateGeneration(generation){ generation; } +//! Updates buttons status depending on presence of nucleus in GUI +function updateGuiButtons(isNucleusPresent){ + + if(!isNucleusPresent && + !document.getElementById("addMitochondrion").classList.contains("DisabledButton")) { + + document.getElementById("addNucleus").classList.remove("DisabledButton"); + document.getElementById("addMitochondrion").classList.add("DisabledButton"); + document.getElementById("addChloroplast").classList.add("DisabledButton"); + document.getElementById("addChemoplast").classList.add("DisabledButton"); + document.getElementById("addNitrogenFixingPlastid").classList.add("DisabledButton"); + document.getElementById("addVacuole").classList.add("DisabledButton"); + document.getElementById("addToxinVacuole").classList.add("DisabledButton"); + + } else if(isNucleusPresent && + document.getElementById("addMitochondrion").classList.contains("DisabledButton")) { + + document.getElementById("addNucleus").classList.add("DisabledButton"); + document.getElementById("addMitochondrion").classList.remove("DisabledButton"); + document.getElementById("addChloroplast").classList.remove("DisabledButton"); + document.getElementById("addChemoplast").classList.remove("DisabledButton"); + document.getElementById("addNitrogenFixingPlastid").classList.remove("DisabledButton"); + document.getElementById("addVacuole").classList.remove("DisabledButton"); + document.getElementById("addToxinVacuole").classList.remove("DisabledButton"); + } +} + //! Updates generation points in GUI function updateSpeed(speed){ document.getElementById("speedLabel").textContent = diff --git a/scripts/gui/thrive_gui.html b/scripts/gui/thrive_gui.html index c46a84ad208..0bea23fd77e 100644 --- a/scripts/gui/thrive_gui.html +++ b/scripts/gui/thrive_gui.html @@ -398,7 +398,7 @@ A space or vesicle within the cytoplasm of a cell, enclosed by a membrane and used to hold compounds
Vacuole
30 MP - + Toxin Vacuole

Cost: 80 mutation points

Performs Process: OxytoxyNT Production
(1 Oxygen + 5 ATP -> 5 Oxytoxy)/Second (Depending On Environmental Oxygen)

Allows for production and storage of OxytoxyNT which can be shot at enemy cells using E. The more of this organelle you have the faster your toxin fire rate aswell. @@ -412,10 +412,18 @@ Chemoplast

Cost: 40 mutation points

Performs Process: Chemosynthesis
(0.09 CO2 + 1 Hydrogen Sulfide -> 2 Glucose)/Second (Depending On Environmental C02)

Allows for synthesis of glucose from hydrogen sulfide and atmospheric carbon dioxide. -
- Can be used to process the normally toxic soup containing hydrogen sulfide that comes out of hydrothermal vents at the bottom of the ocean. Into glucose. -
+
+ Can be used to process the normally toxic soup containing hydrogen sulfide that comes out of hydrothermal vents at the bottom of the ocean. Into glucose. +
Chemoplast
40 MP + + + Nucleus

Cost: 100 mutation points

+ Performs Process: Eukaryote Evolution

+ Allows for synthesis of RNA, MRNA, allows cell to evolve membrane bound organelles. +
+
+
Nucleus
100 MP Nitrogen Fixing Plastid

Cost: 80 mutation points

diff --git a/scripts/gui/thrive_style.css b/scripts/gui/thrive_style.css index 05c14baa92b..be1a60e5c95 100644 --- a/scripts/gui/thrive_style.css +++ b/scripts/gui/thrive_style.css @@ -1105,6 +1105,15 @@ video { top: 15px; } +#NucleusIcon { + position: relative; + left: calc(50% - 30px); + width: 60px; + height: 60px; + background-size: contain; + background-image: url("../../Textures/gui/bevel/NucleusIcon.png"); +} + #CytoplasmIcon { position: relative; left: calc(50% - 30px); diff --git a/scripts/microbe_stage/configs.as b/scripts/microbe_stage/configs.as index a7ab339d2e5..ccf73f1a4cf 100644 --- a/scripts/microbe_stage/configs.as +++ b/scripts/microbe_stage/configs.as @@ -347,9 +347,7 @@ const dictionary STARTER_MICROBES = { {"oxytoxy", InitialCompound(0)} }, { - OrganelleTemplatePlaced("nucleus", 0, 0, 180), - OrganelleTemplatePlaced("cytoplasm", 1, 1, 0), - OrganelleTemplatePlaced("cytoplasm", -1, 2, 0) + OrganelleTemplatePlaced("cytoplasm", 0, 0, 0) }, Float4(1, 1, 1, 1), false, diff --git a/scripts/microbe_stage/microbe_editor/microbe_editor.as b/scripts/microbe_stage/microbe_editor/microbe_editor.as index 27739eba152..79d4c320f65 100644 --- a/scripts/microbe_stage/microbe_editor/microbe_editor.as +++ b/scripts/microbe_stage/microbe_editor/microbe_editor.as @@ -51,6 +51,7 @@ class MicrobeEditor{ placementFunctions = { {"nucleus", PlacementFunctionType(this.createNewMicrobe)}, + {"nucleus", PlacementFunctionType(this.addOrganelle)}, {"flagellum", PlacementFunctionType(this.addOrganelle)}, {"cytoplasm", PlacementFunctionType(this.addOrganelle)}, {"mitochondrion", PlacementFunctionType(this.addOrganelle)}, @@ -69,6 +70,7 @@ class MicrobeEditor{ //! This is called each time the editor is entered so this needs to properly reset state void init() { + updateGuiButtonStatus(checkIsNucleusPresent()); gridSceneNode = hudSystem.world.CreateEntity(); auto node = hudSystem.world.Create_RenderNode(gridSceneNode); node.Scale = Float3(HEX_SIZE, 1, HEX_SIZE); @@ -228,6 +230,12 @@ class MicrobeEditor{ private void _addOrganelle(PlacedOrganelle@ organelle) { + // 1 - you put nucleus but you already have it + // 2 - you put organelle that need nucleus and you don't have it + if((organelle.organelle.name == "nucleus" && checkIsNucleusPresent()) || + (organelle.organelle.prokaryoteChance == 0 && !checkIsNucleusPresent()) && organelle.organelle.chanceToCreate != 0 ) + return; + EditorAction@ action = EditorAction(organelle.organelle.mpCost, // redo function(EditorAction@ action, MicrobeEditor@ editor){ @@ -256,6 +264,9 @@ class MicrobeEditor{ LOG_INFO("Placing organelle '" + organelle.organelle.name + "' at: " + organelle.q + ", " + organelle.r); editor.editedMicrobe.insertLast(organelle); + + // send to gui current status of cell + editor.updateGuiButtonStatus(editor.checkIsNucleusPresent()); }, // undo function(EditorAction@ action, MicrobeEditor@ editor){ @@ -274,6 +285,9 @@ class MicrobeEditor{ } } + + // send to gui current status of cell + editor.updateGuiButtonStatus(editor.checkIsNucleusPresent()); }); @action.data["organelle"] = organelle; @@ -562,6 +576,25 @@ class MicrobeEditor{ // LOG_WRITE("Mouse hex: " + qr + ", " + rr); } + bool checkIsNucleusPresent() + { + for(uint i = 0; i < editedMicrobe.length(); ++i){ + auto organelle = cast(editedMicrobe[i]); + if (organelle.organelle.name == "nucleus"){ + return true; + } + } + return false; + } + + void updateGuiButtonStatus(bool nucleusIsPresent){ + + GenericEvent@ event = GenericEvent("MicrobeEditorNucleusIsPresent"); + NamedVars@ vars = event.GetNamedVars(); + + vars.AddValue(ScriptSafeVariableBlock("nucleus", nucleusIsPresent)); + GetEngine().GetEventHandler().CallEvent(event); + } bool isValidPlacement(const string &in organelleType, int q, int r, int rotation) diff --git a/scripts/microbe_stage/organelle_components/nucleus_organelle.as b/scripts/microbe_stage/organelle_components/nucleus_organelle.as index c890b8a4643..1d01a48c64a 100644 --- a/scripts/microbe_stage/organelle_components/nucleus_organelle.as +++ b/scripts/microbe_stage/organelle_components/nucleus_organelle.as @@ -41,7 +41,7 @@ class NucleusOrganelle : OrganelleComponent{ sceneNode1.Node.setPosition(Hex::axialToCartesian(q + 1, r + 1)); //sceneNode1.Node.setOrientation(Ogre::Quaternion(Ogre::Radian(rotation), // Ogre::Vector3(0, .5, 1))); - sceneNode1.Node.setOrientation(Ogre::Quaternion(Ogre::Degree(rotation), + sceneNode1.Node.setOrientation(Ogre::Quaternion(Ogre::Degree(rotation+180), Ogre::Vector3(0, 1, -1))); sceneNode1.Marked = true; @@ -59,7 +59,7 @@ class NucleusOrganelle : OrganelleComponent{ sceneNode2.Scale = Float3(HEX_SIZE, HEX_SIZE, HEX_SIZE); sceneNode2.Node.setPosition(Hex::axialToCartesian(q, r+.4)); - sceneNode2.Node.setOrientation(Ogre::Quaternion(Ogre::Degree(rotation+10), + sceneNode2.Node.setOrientation(Ogre::Quaternion(Ogre::Degree(rotation+190), Ogre::Vector3(0, 1, -1))); sceneNode2.Marked = true; diff --git a/scripts/microbe_stage/organelle_table.as b/scripts/microbe_stage/organelle_table.as index 6076900cf8f..0734a7ab1e7 100644 --- a/scripts/microbe_stage/organelle_table.as +++ b/scripts/microbe_stage/organelle_table.as @@ -256,7 +256,7 @@ void setupOrganelles(){ nucleusParameters.mesh = "nucleus.mesh"; nucleusParameters.chanceToCreate = 0; // Not randomly generated. nucleusParameters.prokaryoteChance = 0; // Not randomly generated. - nucleusParameters.mpCost = 0; //it's not supossed to be purchased. + nucleusParameters.mpCost = 100; //big evolution moment. nucleusParameters.initialComposition = { {"phosphates", 2}, {"ammonia", 2} diff --git a/scripts/microbe_stage/procedural_microbes.as b/scripts/microbe_stage/procedural_microbes.as index 1a3116e559a..4ab982b99e8 100644 --- a/scripts/microbe_stage/procedural_microbes.as +++ b/scripts/microbe_stage/procedural_microbes.as @@ -191,10 +191,10 @@ array@ positionOrganelles(const string &in stringCode){ const auto letter = CharacterToString(stringCode[i]); // LOG_WRITE(formatUInt(i) + ": " + letter); string name = string(organelleLetters[letter]); - //this places the nucleous + //this places the nucleus if(i == 0){ - @pos = OrganelleTemplatePlaced(name, 0, 0, 180); + @pos = OrganelleTemplatePlaced(name, 0, 0, 360); } else {