Skip to content

Commit

Permalink
v1.3.0.8 Pump fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepySva committed Dec 15, 2024
1 parent 1aee265 commit 960c517
Show file tree
Hide file tree
Showing 19 changed files with 242 additions and 69 deletions.
2 changes: 1 addition & 1 deletion _metadata
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"priority" : 9000,
"steamContentId" : "2359135864",
"tags" : "Crafting and Building|Miscellaneous|Planets and Environments|NPCs and Creatures|Weapons|Quests|Dungeons|Ships|Species|Furniture and Objects|Food and Farming|Mechanics|Armor and Clothes",
"version" : "1.3.0.5"
"version" : "1.3.0.7"
}
Binary file added interface/arcana/arcana_auto/body_pump.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 26 additions & 5 deletions interface/arcana/arcana_auto/burner.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,27 @@
},
"close" : {
"type" : "button",
"base" : "/interface/x.png",
"hover" : "/interface/xhover.png",
"pressed" : "/interface/xpress.png",
"base" : "/interface/arcana/arcana_auto/toggle.png",
"hover" : "/interface/arcana/arcana_auto/toggle.png",
"pressed" : "/interface/arcana/arcana_auto/toggleoff.png",
"pressedOffset" : [0, 0],
"position" : [267, 275]
"position" : [260, 252]
},
"stateToggle" : {
"type" : "button",
"base" : "/interface/arcana/arcana_auto/stateoff.png",
"baseImageChecked" : "/interface/arcana/arcana_auto/stateon.png",
"checkable" : true,
"checked" : true,
"position" : [222, 252]
},
"lblState" : {
"type" : "label",
"position" : [240, 256],
"hAnchor" : "mid",
"wrapWidth" : 60,
"fontSize" : 7.2,
"value" : "^white,shadow;On/Off^reset;"
},
"lblText" : {
"type" : "label",
Expand Down Expand Up @@ -86,6 +102,11 @@
"minSize" : [40, 40]
}
},
"scripts" : ["/interface/arcana/arcana_auto/extractor.lua"],

"scriptWidgetCallbacks" : [
"stateToggle"
],

"scripts" : ["/interface/arcana/arcana_auto/burner.lua"],
"scriptDelta" : 2
}
25 changes: 25 additions & 0 deletions interface/arcana/arcana_auto/burner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ require "/scripts/rect.lua"
function init()
self.entity = pane.containerEntityId()
self.progressWidget = "progress"
self.stateWidget = "stateToggle"
self.init = false
end

function update(dt)
Expand All @@ -18,4 +20,27 @@ function update(dt)
self.promise = nil
end
end

if self.init == false then
stateToggle()
end
end

function stateToggle()
local checked = widget.getChecked(self.stateWidget)
if not self.state or self.init == true then
if checked ~= nil and self.init == true then
self.state = world.sendEntityMessage(self.entity, "getState", checked)
else
self.state = world.sendEntityMessage(self.entity, "getState")
end
end
if self.init == false and self.state:succeeded() then
if self.state:finished() then
local result = self.state:result()
widget.setChecked(self.stateWidget, result)
self.state = nil
self.init = true
end
end
end
31 changes: 26 additions & 5 deletions interface/arcana/arcana_auto/coalgenerator.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,27 @@
},
"close" : {
"type" : "button",
"base" : "/interface/x.png",
"hover" : "/interface/xhover.png",
"pressed" : "/interface/xpress.png",
"base" : "/interface/arcana/arcana_auto/toggle.png",
"hover" : "/interface/arcana/arcana_auto/toggle.png",
"pressed" : "/interface/arcana/arcana_auto/toggleoff.png",
"pressedOffset" : [0, 0],
"position" : [267, 275]
"position" : [260, 252]
},
"stateToggle" : {
"type" : "button",
"base" : "/interface/arcana/arcana_auto/stateoff.png",
"baseImageChecked" : "/interface/arcana/arcana_auto/stateon.png",
"checkable" : true,
"checked" : true,
"position" : [222, 252]
},
"lblState" : {
"type" : "label",
"position" : [240, 256],
"hAnchor" : "mid",
"wrapWidth" : 60,
"fontSize" : 7.2,
"value" : "^white,shadow;On/Off^reset;"
},
"lblText" : {
"type" : "label",
Expand Down Expand Up @@ -101,6 +117,11 @@
"minSize" : [65, 100]
}
},
"scripts" : ["/interface/arcana/arcana_auto/extractor.lua"],

"scriptWidgetCallbacks" : [
"stateToggle"
],

"scripts" : ["/interface/arcana/arcana_auto/burner.lua"],
"scriptDelta" : 2
}
Binary file modified interface/arcana/arcana_auto/footer_clean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed interface/arcana/arcana_auto/galvasteelbar.png
Binary file not shown.
56 changes: 56 additions & 0 deletions interface/arcana/arcana_auto/pump.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"craftingSound" : "/sfx/interface/crafting_furnace.ogg",
"gui" : {
"background" : {
"type" : "background",
"fileHeader" : "/interface/arcana/arcana_auto/header.png",
"fileBody" : "/interface/arcana/arcana_auto/body_pump.png",
"fileFooter" : "/interface/arcana/arcana_auto/footer.png"
},
"itemGrid" : {
"type" : "itemgrid",
"position" : [245, 56],
"dimensions" : [1, 1],
"spacing" : [19, 19],
"backingImage" : "/interface/inventory/empty.png"
},
"progress" : {
"type" : "progress",
"zlevel" : 10,
"background" : "/interface/arcana/arcana_auto/progressempty.png",
"position" : [200, 60],
"size" : [41, 6],
"progressSet" : {
"inner" : "/interface/arcana/arcana_auto/progress.png",
"type" : "repeat"
},
"direction" : "horizontal"
},
"close" : {
"type" : "button",
"base" : "/interface/x.png",
"hover" : "/interface/xhover.png",
"pressed" : "/interface/xpress.png",
"pressedOffset" : [0, 0],
"position" : [267, 165]
},
"lblText" : {
"type" : "label",
"position" : [30, 137],
"hAnchor" : "left",
"vAnchor" : "top",
"wrapWidth" : 229,
"value" : "^white;An automatic pump for producing liquid when this is placed inside water or other types of liquid. ^orange;Requires 5kW of Power. This can be wired to other machines.^reset;"
},
"lblRate" : {
"type" : "label",
"position" : [12, 35],
"hAnchor" : "left",
"wrapWidth" : 125,
"fontSize" : 6.4,
"value" : "^white;Rate: 0.6s"
}
},
"scripts" : ["/interface/arcana/arcana_auto/extractor.lua"],
"scriptDelta" : 1
}
Binary file added interface/arcana/arcana_auto/stateoff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added interface/arcana/arcana_auto/stateon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed interface/arcana/arcana_auto/temp.png
Binary file not shown.
Binary file removed interface/arcana/arcana_auto/temp2.png
Binary file not shown.
Binary file added interface/arcana/arcana_auto/toggle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added interface/arcana/arcana_auto/toggleoff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 40 additions & 27 deletions objects/workshop/workshop_auto_burner/burner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,34 +59,47 @@ function consumeInputSingle()
end

function update(dt)
if self.consumptionTimer > 0 then
self.consumptionTimer = math.max(0, self.consumptionTimer - dt)
if self.consumptionTimer == 0 then
consumeInputSingle()
self.consumptionTimer = self.consumptionTime
if power.getState() == true then
if self.consumptionTimer > 0 then
self.consumptionTimer = math.max(0, self.consumptionTimer - dt)
if self.consumptionTimer == 0 then
consumeInputSingle()
self.consumptionTimer = self.consumptionTime
end
end
if self.productionTimer > 0 then
self.productionTimer = math.max(0, self.productionTimer - dt)
if self.productionTimer == 0 then
if self.isPowered == true then
object.setOutputNodeLevel(0, true)
setAnimation(true)
power.set(self.maxPower)
else
object.setOutputNodeLevel(0, false)
setAnimation(false)
power.set(0)
end
power.send(0, power.get())
self.productionTimer = self.productionTime
end
end
else
setAnimation(false)
end
if self.productionTimer > 0 then
self.productionTimer = math.max(0, self.productionTimer - dt)
if self.productionTimer == 0 then
if self.isPowered == true then
object.setOutputNodeLevel(0, true)
animator.setAnimationState("switchState", "on")
animator.setParticleEmitterActive("smoke", true)
if self.isPlayingSound == false then
animator.playSound("onloop", -1)
self.isPlayingSound = true
end
power.set(self.maxPower)
else
object.setOutputNodeLevel(0, false)
animator.setAnimationState("switchState", "off")
animator.setParticleEmitterActive("smoke", false)
animator.stopAllSounds("onloop")
self.isPlayingSound = false
end
power.send(0, power.get())
self.productionTimer = self.productionTime
end

function setAnimation(s)
if s == true then
if self.isPlayingSound == false then
animator.playSound("onloop", -1)
self.isPlayingSound = true
end
animator.setAnimationState("switchState", "on")
animator.setParticleEmitterActive("smoke", true)
else
animator.setAnimationState("switchState", "off")
animator.setParticleEmitterActive("smoke", false)
animator.stopAllSounds("onloop")
self.isPlayingSound = false
end
end
end
67 changes: 40 additions & 27 deletions objects/workshop/workshop_auto_coalgenerator/coalgenerator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,47 @@ function consumeInput()
end

function update(dt)
if self.consumptionTimer > 0 then
self.consumptionTimer = math.max(0, self.consumptionTimer - dt)
if self.consumptionTimer == 0 then
consumeInput()
self.consumptionTimer = self.consumptionTime
if power.getState() == true then
if self.consumptionTimer > 0 then
self.consumptionTimer = math.max(0, self.consumptionTimer - dt)
if self.consumptionTimer == 0 then
consumeInput()
self.consumptionTimer = self.consumptionTime
end
end
if self.productionTimer > 0 then
self.productionTimer = math.max(0, self.productionTimer - dt)
if self.productionTimer == 0 then
if self.isPowered == true then
object.setOutputNodeLevel(0, true)
setAnimation(true)
power.set(self.maxPower)
else
object.setOutputNodeLevel(0, false)
setAnimation(false)
power.set(0)
end
power.send(0, power.get())
self.productionTimer = self.productionTime
end
end
else
setAnimation(false)
end
if self.productionTimer > 0 then
self.productionTimer = math.max(0, self.productionTimer - dt)
if self.productionTimer == 0 then
if self.isPowered == true then
object.setOutputNodeLevel(0, true)
animator.setAnimationState("switchState", "on")
animator.setParticleEmitterActive("smoke", true)
if self.isPlayingSound == false then
animator.playSound("onloop", -1)
self.isPlayingSound = true
end
power.set(self.maxPower)
else
object.setOutputNodeLevel(0, false)
animator.setAnimationState("switchState", "off")
animator.setParticleEmitterActive("smoke", false)
animator.stopAllSounds("onloop")
self.isPlayingSound = false
end
power.send(0, power.get())
self.productionTimer = self.productionTime
end

function setAnimation(s)
if s == true then
if self.isPlayingSound == false then
animator.playSound("onloop", -1)
self.isPlayingSound = true
end
animator.setAnimationState("switchState", "on")
animator.setParticleEmitterActive("smoke", true)
else
animator.setAnimationState("switchState", "off")
animator.setParticleEmitterActive("smoke", false)
animator.stopAllSounds("onloop")
self.isPlayingSound = false
end
end
end
14 changes: 11 additions & 3 deletions objects/workshop/workshop_auto_pump/pump.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ function init()
self.outputRate = root.assetJson(configPath).outputRate or 1
self.recipes = root.assetJson(configPath).recipes or nil
self.powerUseAmount = config.getParameter("powerUseAmount", 0)
arcana_power:setPower(config.getParameter("maxPower", 10))
power.set(config.getParameter("maxPower", 10))
animator.setGlobalTag("directives", config.getParameter("directives", ""))

self.isPowered = true
message.setHandler("getProgress", function()
local progress = power.round((1 - (self.cooldownTimer / self.pumpTime)), 1)
if self.isPowered == true and self.isEmpty == false then return progress else return 0 end
end)
end


Expand Down Expand Up @@ -59,15 +65,17 @@ function automation()
world.destroyLiquid(liquidPosition)
liquidItem.name = root.liquidConfig(liquidLevel[1]).config.itemDrop
world.containerAddItems(entity.id(), liquidItem)
self.isEmpty = false
animator.setAnimationState("switchState", "on")
else
self.isEmpty = true
animator.setAnimationState("switchState", "empty")
end
end

function powerCheck()
if arcana_power:getPower() >= self.powerUseAmount then
arcana_power:removePower(self.powerUseAmount)
if power.get() >= self.powerUseAmount then
power.remove(self.powerUseAmount)
self.isPowered = true
else
animator.setAnimationState("switchState", "off")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

"openSounds" : [ "/sfx/objects/campfire_use.ogg" ],
"slotCount" : 1,
"uiConfig" : "/interface/arcana/arcana_auto/extractor.config",
"uiConfig" : "/interface/arcana/arcana_auto/pump.config",
"frameCooldown" : 5,
"autoCloseCooldown" : 3600,

Expand Down
Loading

0 comments on commit 960c517

Please sign in to comment.