diff --git a/.gitignore b/.gitignore index 5ca0414ad64..287d4cc0124 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,16 @@ +# Asset directory +assets/* +# We want certain xmls though +!assets/definitions/ +!assets/definitions/*.xml +# maybe add these in later +#!assets/gui/layouts/*.layout + +# Website directory + +website/* +index.html + # Standard stuff Thumbs.db *.obj @@ -72,5 +85,5 @@ nbproject/ # Vim swap files *.swp -# Asset directory -assets/* +# Temporary/backup files +*~ diff --git a/assets/definitions/compounds.xml b/assets/definitions/compounds.xml new file mode 100644 index 00000000000..edf8d4d38db --- /dev/null +++ b/assets/definitions/compounds.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/definitions/processes.xml b/assets/definitions/processes.xml new file mode 100644 index 00000000000..027cc0008c4 --- /dev/null +++ b/assets/definitions/processes.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/microbe_editor/microbe_editor.lua b/scripts/microbe_editor/microbe_editor.lua index c64280477d5..a6c93609e03 100644 --- a/scripts/microbe_editor/microbe_editor.lua +++ b/scripts/microbe_editor/microbe_editor.lua @@ -18,6 +18,7 @@ function MicrobeEditor:__init(hudSystem) self.placementFunctions = {["nucleus"] = MicrobeEditor.createNewMicrobe, ["flagelium"] = MicrobeEditor.addMovementOrganelle, ["mitochondria"] = MicrobeEditor.addProcessOrganelle, + ["chloroplast"] = MicrobeEditor.addProcessOrganelle, ["toxin"] = MicrobeEditor.addAgentVacuole, ["vacuole"] = MicrobeEditor.addStorageOrganelle, @@ -92,10 +93,7 @@ function MicrobeEditor:addStorageOrganelle(organelleType) -- self.currentMicrobe = Microbe(Entity("working_microbe", GameState.MICROBE)) local q, r = self:getMouseHex() if self.currentMicrobe:getOrganelleAt(q, r) == nil then - local storageOrganelle = StorageOrganelle(100.0) - storageOrganelle:addHex(0, 0) - storageOrganelle:setColour(ColourValue(0, 1, 0, 1)) - self.currentMicrobe:addOrganelle(q, r, storageOrganelle) + self.currentMicrobe:addOrganelle(q, r, OrganelleFactory.makeVacuole()) self.organelleCount = self.organelleCount + 1 end end @@ -104,21 +102,7 @@ end function MicrobeEditor:addMovementOrganelle(organelleType) local q, r = self:getMouseHex() if self.currentMicrobe:getOrganelleAt(q, r) == nil then - -- Calculate the momentum of the movement organelle based on angle towards nucleus - local organelleX, organelleY = axialToCartesian(q, r) - local nucleusX, nucleusY = axialToCartesian(0, 0) - local deltaX = nucleusX - organelleX - local deltaY = nucleusY - organelleY - local dist = math.sqrt(deltaX^2 + deltaY^2) -- For normalizing vector - local momentumX = deltaX / dist * FLAGELIUM_MOMENTUM - local momentumY = deltaY / dist * FLAGELIUM_MOMENTUM - local movementOrganelle = MovementOrganelle( - Vector3(momentumX, momentumY, 0.0), - 300 - ) - movementOrganelle:addHex(0, 0) - movementOrganelle:setColour(ColourValue(0.8, 0.3, 0.3, 1)) - self.currentMicrobe:addOrganelle(q,r, movementOrganelle) + self.currentMicrobe:addOrganelle(q,r, OrganelleFactory.makeFlagellum(q,r)) self.organelleCount = self.organelleCount + 1 end end @@ -126,13 +110,11 @@ end function MicrobeEditor:addProcessOrganelle(organelleType) local q, r = self:getMouseHex() if self.currentMicrobe:getOrganelleAt(q, r) == nil then - local processOrganelle = ProcessOrganelle() - if organelleType == "mitochondria" then - processOrganelle:addProcess(global_processMap["Respiration"]) - processOrganelle:addHex(0, 0) - processOrganelle:setColour(ColourValue(0.8, 0.4, 0.5, 0)) - - self.currentMicrobe:addOrganelle(q,r, processOrganelle) + + if organelleType == "mitochondria" then + self.currentMicrobe:addOrganelle(q,r, OrganelleFactory.makeMitochondrion()) + elseif organelleType == "chloroplast" then + self.currentMicrobe:addOrganelle(q,r, OrganelleFactory.makeChloroplast()) else assert(false, "organelleType did not exist") end @@ -144,10 +126,7 @@ function MicrobeEditor:addAgentVacuole(organelleType) if organelleType == "toxin" then local q, r = self:getMouseHex() if self.currentMicrobe:getOrganelleAt(q, r) == nil then - local agentVacuole = AgentVacuole(CompoundRegistry.getCompoundId("oxytoxy"), global_processMap["OxyToxySynthesis"]) - agentVacuole:addHex(0, 0) - agentVacuole:setColour(ColourValue(0, 1, 1, 0)) - self.currentMicrobe:addOrganelle(q, r, agentVacuole) + self.currentMicrobe:addOrganelle(q, r, OrganelleFactory.makeOxytoxyVacuole()) self.organelleCount = self.organelleCount + 1 end end @@ -155,12 +134,8 @@ function MicrobeEditor:addAgentVacuole(organelleType) end function MicrobeEditor:addNucleus() - local nucleusOrganelle = NucleusOrganelle() - nucleusOrganelle:addHex(0, 0) - nucleusOrganelle:setColour(ColourValue(0.8, 0.2, 0.8, 1)) + local nucleusOrganelle = OrganelleFactory.makeNucleus() self.currentMicrobe:addOrganelle(0, 0, nucleusOrganelle) - nucleusOrganelle:addProcess(global_processMap["ReproductaseSynthesis"]) - nucleusOrganelle:addProcess(global_processMap["AminoAcidSynthesis"]) end function MicrobeEditor:createNewMicrobe() @@ -175,4 +150,4 @@ function MicrobeEditor:createNewMicrobe() self.currentMicrobe.collisionHandler:addCollisionGroup("powerupable") self:addNucleus() -end \ No newline at end of file +end diff --git a/scripts/microbe_editor/microbe_editor_hud.lua b/scripts/microbe_editor/microbe_editor_hud.lua index 8bb82b33390..384e9ad1472 100644 --- a/scripts/microbe_editor/microbe_editor_hud.lua +++ b/scripts/microbe_editor/microbe_editor_hud.lua @@ -7,6 +7,7 @@ function MicrobeEditorHudSystem:__init() self.initialized = false self.editor = MicrobeEditor(self) self.hoverHex = nil + self.activeButton = nil -- stores button, not name end @@ -33,6 +34,7 @@ function MicrobeEditorHudSystem:init(gameState) self.organelleButtons["Toxin"] = toxinButton --self.organelleButtons["AminoSynthesizer"] = aminoSynthesizerButton self.organelleButtons["Remove"] = removeButton + self.activeButton = nil nucleusButton:getChild("Nucleus"):registerEventHandler("Clicked", nucleusClicked) flageliumButton:getChild("Flagelium"):registerEventHandler("Clicked", flageliumClicked) mitochondriaButton:getChild("Mitochondria"):registerEventHandler("Clicked", mitochondriaClicked) @@ -76,114 +78,120 @@ end function MicrobeEditorHudSystem:update(milliseconds) self.editor:update(milliseconds) -- Render the hex under the cursor - local x, y = axialToCartesian(self.editor:getMouseHex()) - local translation = Vector3(-x, -y, 0) - local sceneNode = self.hoverHex:getComponent(OgreSceneNodeComponent.TYPE_ID) - sceneNode.transform.position = translation - sceneNode.transform:touch() - -- Handle input - if Engine.mouse:wasButtonPressed(Mouse.MB_Left) then - self.editor:performLocationAction() - end - if Engine.keyboard:wasKeyPressed(Keyboard.KC_C) then - -- These global event handlers are defined in microbe_editor_hud.lua - nucleusClicked() - elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_R) then - self.editor:setActiveAction("remove") - self.editor:performLocationAction() - elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_S) and self.editor.currentMicrobe ~= nil then - vacuoleClicked() - self.editor:performLocationAction() - elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_T) and self.editor.currentMicrobe ~= nil then - toxinClicked() - self.editor:performLocationAction() - elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_F) and self.editor.currentMicrobe ~= nil then - flageliumClicked() - self.editor:performLocationAction() - elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_M) and self.editor.currentMicrobe ~= nil then - mitochondriaClicked() - self.editor:performLocationAction() - -- elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_A) and self.editor.currentMicrobe ~= nil then - -- aminoSynthesizerClicked() - -- self.editor:performLocationAction() - elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_ESCAPE) then - menuButtonClicked() - elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_F2) then - playClicked() - end + local x, y = axialToCartesian(self.editor:getMouseHex()) + local translation = Vector3(-x, -y, 0) + local sceneNode = self.hoverHex:getComponent(OgreSceneNodeComponent.TYPE_ID) + sceneNode.transform.position = translation + sceneNode.transform:touch() + -- Handle input + if Engine.mouse:wasButtonPressed(Mouse.MB_Left) then + self.editor:performLocationAction() + end + if Engine.keyboard:wasKeyPressed(Keyboard.KC_C) then + -- These global event handlers are defined in microbe_editor_hud.lua + nucleusClicked() + elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_R) then + self.editor:setActiveAction("remove") + self.editor:performLocationAction() + elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_S) and self.editor.currentMicrobe ~= nil then + vacuoleClicked() + self.editor:performLocationAction() + elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_T) and self.editor.currentMicrobe ~= nil then + if not Engine:playerData():lockedMap():isLocked("Toxin") then + toxinClicked() + self.editor:performLocationAction() + end + elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_F) and self.editor.currentMicrobe ~= nil then + flageliumClicked() + self.editor:performLocationAction() + elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_M) and self.editor.currentMicrobe ~= nil then + mitochondriaClicked() + self.editor:performLocationAction() + --elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_A) and self.editor.currentMicrobe ~= nil then + -- aminoSynthesizerClicked() + -- self.editor:performLocationAction() + elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_P) and self.editor.currentMicrobe ~= nil then + chloroplastClicked() + self.editor:performLocationAction() + elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_ESCAPE) then + menuButtonClicked() + elseif Engine.keyboard:wasKeyPressed(Keyboard.KC_F2) then + playClicked() + end end -- Event handlers function nucleusClicked() - for typeName,button in pairs(global_activeMicrobeEditorHudSystem.organelleButtons) do - if not Engine:playerData():lockedMap():isLocked(typeName) then - button:enable() - end + if global_activeMicrobeEditorHudSystem.activeButton ~= nil then + global_activeMicrobeEditorHudSystem.activeButton:enable() end global_activeMicrobeEditorHudSystem:setActiveAction("nucleus") end function flageliumClicked() - for typeName,button in pairs(global_activeMicrobeEditorHudSystem.organelleButtons) do - if not Engine:playerData():lockedMap():isLocked(typeName) then - button:enable() - end + if global_activeMicrobeEditorHudSystem.activeButton ~= nil then + global_activeMicrobeEditorHudSystem.activeButton:enable() end - global_activeMicrobeEditorHudSystem.organelleButtons["Flagelium"]:disable() + global_activeMicrobeEditorHudSystem.activeButton = global_activeMicrobeEditorHudSystem.organelleButtons["Flagelium"] + global_activeMicrobeEditorHudSystem.activeButton:disable() global_activeMicrobeEditorHudSystem:setActiveAction("flagelium") end function mitochondriaClicked() - for typeName,button in pairs(global_activeMicrobeEditorHudSystem.organelleButtons) do - if not Engine:playerData():lockedMap():isLocked(typeName) then - button:enable() - end + if global_activeMicrobeEditorHudSystem.activeButton ~= nil then + global_activeMicrobeEditorHudSystem.activeButton:enable() end - global_activeMicrobeEditorHudSystem.organelleButtons["Mitochondria"]:disable() + global_activeMicrobeEditorHudSystem.activeButton = + global_activeMicrobeEditorHudSystem.organelleButtons["Mitochondria"] + global_activeMicrobeEditorHudSystem.activeButton:disable() global_activeMicrobeEditorHudSystem:setActiveAction("mitochondria") end +function chloroplastClicked() + if global_activeMicrobeEditorHudSystem.activeButton ~= nil then + global_activeMicrobeEditorHudSystem.activeButton:enable() + end + global_activeMicrobeEditorHudSystem:setActiveAction("chloroplast") +end function aminoSynthesizerClicked() - for typeName,button in pairs(global_activeMicrobeEditorHudSystem.organelleButtons) do - if not Engine:playerData():lockedMap():isLocked(typeName) then - button:enable() - end + if global_activeMicrobeEditorHudSystem.activeButton ~= nil then + global_activeMicrobeEditorHudSystem.activeButton:enable() end - global_activeMicrobeEditorHudSystem.organelleButtons["AminoSynthesizer"]:disable() + global_activeMicrobeEditorHudSystem.activeButton = + global_activeMicrobeEditorHudSystem.organelleButtons["AminoSynthesizer"] + global_activeMicrobeEditorHudSystem.activeButton:disable() global_activeMicrobeEditorHudSystem:setActiveAction("aminosynthesizer") end function vacuoleClicked() - for typeName,button in pairs(global_activeMicrobeEditorHudSystem.organelleButtons) do - if not Engine:playerData():lockedMap():isLocked(typeName) then - button:enable() - end + if global_activeMicrobeEditorHudSystem.activeButton ~= nil then + global_activeMicrobeEditorHudSystem.activeButton:enable() end - global_activeMicrobeEditorHudSystem.organelleButtons["Vacuole"]:disable() + global_activeMicrobeEditorHudSystem.activeButton = + global_activeMicrobeEditorHudSystem.organelleButtons["Vacuole"] + global_activeMicrobeEditorHudSystem.activeButton:disable() global_activeMicrobeEditorHudSystem:setActiveAction("vacuole") end function toxinClicked() - if not Engine:playerData():lockedMap():isLocked("Toxin") then - for typeName,button in pairs(global_activeMicrobeEditorHudSystem.organelleButtons) do - if not Engine:playerData():lockedMap():isLocked(typeName) then - button:enable() - end - end - global_activeMicrobeEditorHudSystem.organelleButtons["Toxin"]:disable() - global_activeMicrobeEditorHudSystem:setActiveAction("toxin") + if global_activeMicrobeEditorHudSystem.activeButton ~= nil then + global_activeMicrobeEditorHudSystem.activeButton:enable() end + global_activeMicrobeEditorHudSystem.activeButton = + global_activeMicrobeEditorHudSystem.organelleButtons["Toxin"] + global_activeMicrobeEditorHudSystem.activeButton:disable() + global_activeMicrobeEditorHudSystem:setActiveAction("toxin") end function removeClicked() - for typeName,button in pairs(global_activeMicrobeEditorHudSystem.organelleButtons) do - if not Engine:playerData():lockedMap():isLocked(typeName) then - button:enable() - end + if global_activeMicrobeEditorHudSystem.activeButton ~= nil then + global_activeMicrobeEditorHudSystem.activeButton:enable() end - global_activeMicrobeEditorHudSystem.organelleButtons["Remove"]:disable() + global_activeMicrobeEditorHudSystem.activeButton = + global_activeMicrobeEditorHudSystem.organelleButtons["Remove"] + global_activeMicrobeEditorHudSystem.activeButton:disable() global_activeMicrobeEditorHudSystem:setActiveAction("remove") end diff --git a/scripts/microbe_stage/process_organelle.lua b/scripts/microbe_stage/process_organelle.lua index fcab4dab442..411245ae128 100644 --- a/scripts/microbe_stage/process_organelle.lua +++ b/scripts/microbe_stage/process_organelle.lua @@ -296,3 +296,11 @@ function OrganelleFactory.makeMitochondrion() mito:setColour(ColourValue(0.8, 0.4, 0.5, 0)) return mito end + +function OrganelleFactory.makeChloroplast() + local chloro = ProcessOrganelle() + chloro:addProcess(global_processMap["Photosynthesis"]) + chloro:addHex(0, 0) + chloro:setColour(ColourValue(0, 1, 0, 0.5)) + return chloro +end diff --git a/scripts/microbe_stage/setup.lua b/scripts/microbe_stage/setup.lua index 70ea2614f72..338df807cfd 100644 --- a/scripts/microbe_stage/setup.lua +++ b/scripts/microbe_stage/setup.lua @@ -109,6 +109,48 @@ local function createSpawnSystem() entity:addComponent(timedEmitter) return entity end + local spawnCO2Emitter = function(pos) + -- Setting up an emitter for co2 + local entity = Entity() + -- Rigid body + local rigidBody = RigidBodyComponent() + rigidBody.properties.friction = 0.2 + rigidBody.properties.linearDamping = 0.8 + rigidBody.properties.shape = CylinderShape( + CollisionShape.AXIS_X, + 0.4, + 2.0 + ) + rigidBody:setDynamicProperties( + pos, + Quaternion(Radian(Degree(math.random()*360)), Vector3(0, 0, 1)), + Vector3(0, 0, 0), + Vector3(0, 0, 0) + ) + rigidBody.properties:touch() + entity:addComponent(rigidBody) + -- Scene node + local sceneNode = OgreSceneNodeComponent() + sceneNode.meshName = "co2.mesh" + sceneNode.transform.scale = Vector3(0.4, 0.4, 0.4) + entity:addComponent(sceneNode) + -- Emitter carbon dioxide + local co2Emitter = CompoundEmitterComponent() + entity:addComponent(co2Emitter) + co2Emitter.emissionRadius = 1 + co2Emitter.maxInitialSpeed = 10 + co2Emitter.minInitialSpeed = 2 + co2Emitter.minEmissionAngle = Degree(0) + co2Emitter.maxEmissionAngle = Degree(360) + co2Emitter.particleLifeTime = 5000 + local timedEmitter = TimedCompoundEmitterComponent() + timedEmitter.compoundId = CompoundRegistry.getCompoundId("co2") + timedEmitter.particlesPerEmission = 1 + timedEmitter.potencyPerParticle = 2.0 + timedEmitter.emitInterval = 1000 + entity:addComponent(timedEmitter) + return entity + end local spawnGlucoseEmitter = function(pos) -- Setting up an emitter for glucose local entity = Entity() @@ -192,46 +234,20 @@ local function createSpawnSystem() Vector3(0, 0, 0), -- Linear velocity Vector3(0, 0, 0) -- Angular velocity ) - local nucleusOrganelle = NucleusOrganelle() - nucleusOrganelle:addHex(0, 0) - nucleusOrganelle:setColour(ColourValue(0.8, 0.2, 0.8, 1)) - nucleusOrganelle:addProcess(global_processMap["ReproductaseSynthesis"]) - nucleusOrganelle:addProcess(global_processMap["AminoAcidSynthesis"]) - microbe:addOrganelle(0, 0, nucleusOrganelle) + microbe:addOrganelle(0, 0, OrganelleFactory.makeNucleus()) -- Forward - local forwardOrganelle = MovementOrganelle( - Vector3(0.0, -30.0, 0.0), - 300 - ) - forwardOrganelle:addHex(0, 0) - forwardOrganelle:addHex(-1, 0) - forwardOrganelle:addHex(1, -1) - forwardOrganelle:setColour(ColourValue(0.9, 0.3, 0.7, 1)) - microbe:addOrganelle(0, 1, forwardOrganelle) + microbe:addOrganelle(0, 1, OrganelleFactory.makeFlagellum(0, 1)) + microbe:addOrganelle(-1, 1, OrganelleFactory.makeFlagellum(-1, 1)) + microbe:addOrganelle(1, 0, OrganelleFactory.makeFlagellum(1, 0)) -- Backward - local backwardOrganelle = MovementOrganelle( - Vector3(0.0, 30.0, 0.0), - 300 - ) - backwardOrganelle:addHex(0, 0) - backwardOrganelle:addHex(-1, 1) - backwardOrganelle:addHex(1, 0) - backwardOrganelle:setColour(ColourValue(0.9, 0.3, 0.7, 1)) - microbe:addOrganelle(0, -2, backwardOrganelle) - local storageOrganelle2 = StorageOrganelle(100.0) - storageOrganelle2:addHex(0, 0) - storageOrganelle2:setColour(ColourValue(0, 1, 0.5, 1)) - microbe:addOrganelle(0, -1, storageOrganelle2) - local storageOrganelle3 = StorageOrganelle(100.0) - storageOrganelle3:addHex(0, 0) - storageOrganelle3:setColour(ColourValue(0.5, 1, 0, 1)) - microbe:addOrganelle(-1, 0, storageOrganelle3) - -- Producer making atp from oxygen and glucose - local processOrganelle1 = ProcessOrganelle() - processOrganelle1:addProcess(global_processMap["Respiration"]) - processOrganelle1:addHex(0, 0) - processOrganelle1:setColour(ColourValue(0.8, 0.4, 1, 0)) - microbe:addOrganelle(1, -1, processOrganelle1) + microbe:addOrganelle(0, -2, OrganelleFactory.makeFlagellum(0, -2)) + microbe:addOrganelle(-1, -1, OrganelleFactory.makeFlagellum(-1, -1)) + microbe:addOrganelle(1, -2, OrganelleFactory.makeFlagellum(1, -2)) + + microbe:addOrganelle(0, -1, OrganelleFactory.makeVacuole()) + microbe:addOrganelle(-1, 0, OrganelleFactory.makeVacuole()) + microbe:addOrganelle(1, -1, OrganelleFactory.makeMitochondrion()) + microbe:storeCompound(CompoundRegistry.getCompoundId("atp"), 40, false) microbe.microbe:updateSafeAngles() return microbe @@ -271,9 +287,10 @@ local function createSpawnSystem() --Spawn one emitter on average once in every square of sidelength 10 -- (square dekaunit?) - spawnSystem:addSpawnType(spawnOxygenEmitter, 1/20^2, 30) - spawnSystem:addSpawnType(spawnGlucoseEmitter, 1/20^2, 30) - spawnSystem:addSpawnType(spawnAmmoniaEmitter, 1/1000, 30) + spawnSystem:addSpawnType(spawnOxygenEmitter, 1/500, 30) + spawnSystem:addSpawnType(spawnCO2Emitter, 1/500, 30) + spawnSystem:addSpawnType(spawnGlucoseEmitter, 1/500, 30) + spawnSystem:addSpawnType(spawnAmmoniaEmitter, 1/1250, 30) spawnSystem:addSpawnType(microbeSpawnFunction, 1/6500, 40) spawnSystem:addSpawnType(toxinOrganelleSpawnFunction, 1/17000, 30) return spawnSystem @@ -332,72 +349,23 @@ function unlockToxin(entityId) end function createStarterMicrobe(name, aiControlled) - local microbe = Microbe.createMicrobeEntity(name, aiControlled) - local nucleusOrganelle = NucleusOrganelle() - nucleusOrganelle:addHex(0, 0) - nucleusOrganelle:setColour(ColourValue(0.8, 0.2, 0.8, 1)) - nucleusOrganelle:addProcess(global_processMap["ReproductaseSynthesis"]) - nucleusOrganelle:addProcess(global_processMap["AminoAcidSynthesis"]) - microbe:addOrganelle(0, 0, nucleusOrganelle) + local microbe = Microbe.createMicrobeEntity(name, aiControlled) + local nucleusOrganelle = NucleusOrganelle() + microbe:addOrganelle(0, 0, OrganelleFactory.makeNucleus()) -- Forward - local forwardOrganelle = MovementOrganelle( - Vector3(0, -12.5, 0.0), - 300 - ) - forwardOrganelle:addHex(0, 0) - forwardOrganelle:setColour(ColourValue(0.8, 0.3, 0.3, 1)) - microbe:addOrganelle(0, 1, forwardOrganelle) - forwardOrganelle = MovementOrganelle( - Vector3(11, -6, 0.0), - 300 - ) - forwardOrganelle:addHex(0, 0) - forwardOrganelle:setColour(ColourValue(0.8, 0.3, 0.3, 1)) - microbe:addOrganelle(-1, 1, forwardOrganelle) - forwardOrganelle = MovementOrganelle( - Vector3(-11, -6, 0.0), - 300 - ) - forwardOrganelle:addHex(0, 0) - forwardOrganelle:setColour(ColourValue(0.8, 0.3, 0.3, 1)) - microbe:addOrganelle(1, 0, forwardOrganelle) + microbe:addOrganelle(0, 1, OrganelleFactory.makeFlagellum(0, 1)) + microbe:addOrganelle(-1, 1, OrganelleFactory.makeFlagellum(-1, 1)) + microbe:addOrganelle(1, 0, OrganelleFactory.makeFlagellum(1, 0)) -- Backward - local backwardOrganelle = MovementOrganelle( - Vector3(0.0, 12.5, 0.0), - 300 - ) - backwardOrganelle:addHex(0, 0) - backwardOrganelle:setColour(ColourValue(0.8, 0.3, 0.3, 1)) - microbe:addOrganelle(0, -2, backwardOrganelle) - backwardOrganelle = MovementOrganelle( - Vector3(6, 11, 0.0), - 300 - ) - backwardOrganelle:addHex(0, 0) - backwardOrganelle:setColour(ColourValue(0.8, 0.3, 0.3, 1)) - microbe:addOrganelle(-1, -1, backwardOrganelle) - backwardOrganelle = MovementOrganelle( - Vector3(-6, 11, 0.0), - 300 - ) - backwardOrganelle:addHex(0, 0) - backwardOrganelle:setColour(ColourValue(0.8, 0.3, 0.3, 1)) - microbe:addOrganelle(1, -2, backwardOrganelle) - local storageOrganelle2 = StorageOrganelle(100.0) - storageOrganelle2:addHex(0, 0) - storageOrganelle2:setColour(ColourValue(0, 1, 0, 1)) - microbe:addOrganelle(0, -1, storageOrganelle2) - local storageOrganelle3 = StorageOrganelle(100.0) - storageOrganelle3:addHex(0, 0) - storageOrganelle3:setColour(ColourValue(0, 1, 0, 1)) - microbe:addOrganelle(-1, 0, storageOrganelle3) + microbe:addOrganelle(0, -2, OrganelleFactory.makeFlagellum(0, -2)) + microbe:addOrganelle(-1, -1, OrganelleFactory.makeFlagellum(-1, -1)) + microbe:addOrganelle(1, -2, OrganelleFactory.makeFlagellum(1, -2)) + + microbe:addOrganelle(0, -1, OrganelleFactory.makeVacuole()) + microbe:addOrganelle(-1, 0, OrganelleFactory.makeVacuole()) + microbe:addOrganelle(1, -1, OrganelleFactory.makeMitochondrion()) + microbe:storeCompound(CompoundRegistry.getCompoundId("atp"), 20, false) - -- Producer making atp from oxygen and glucose - local processOrganelle1 = ProcessOrganelle() - processOrganelle1:addProcess(global_processMap["Respiration"]) - processOrganelle1:addHex(0, 0) - processOrganelle1:setColour(ColourValue(0.8, 0.4, 0.5, 0)) - microbe:addOrganelle(1, -1, processOrganelle1) microbe.microbe:updateSafeAngles() return microbe end diff --git a/scripts/microbe_stage/storage_organelle.lua b/scripts/microbe_stage/storage_organelle.lua index 5a0488bc212..e81a1aa0166 100644 --- a/scripts/microbe_stage/storage_organelle.lua +++ b/scripts/microbe_stage/storage_organelle.lua @@ -40,6 +40,6 @@ end function OrganelleFactory.makeVacuole() local vacuole = StorageOrganelle(100.0) vacuole:addHex(0, 0) - vacuole:setColour(ColourValue(0, 1, 0, 1)) + vacuole:setColour(ColourValue(1, 1, 0, 1)) return vacuole end