Skip to content

Commit

Permalink
animate, add loop alert
Browse files Browse the repository at this point in the history
  • Loading branch information
Kherae committed Nov 4, 2023
1 parent 0de709d commit 042e649
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
20 changes: 17 additions & 3 deletions objects/kheAA/kheAA_repeater/kheAA_repeater.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ function init()
transferUtil.init()
transferUtil.vars.inContainers={}
transferUtil.vars.outContainers={}
transferUtil.vars.upstreamCount=0
transferUtil.vars.isRelayNode=true
animator.setAnimationState("repeaterState","off")
end

function update(dt)
Expand All @@ -12,7 +15,18 @@ function update(dt)
return
end
deltatime=0
transferUtil.updateInputs()
transferUtil.updateOutputs()
object.setOutputNodeLevel(transferUtil.vars.inDataNode,util.tableSize(transferUtil.vars.outContainers))

local nodeUpdatePassed=transferUtil.updateNodeLists()
local hasUpstream=transferUtil.checkUpstreamContainers()

if nodeUpdatePassed then
animator.setSoundVolume("alarm",0,0)
animator.setAnimationState("repeaterState",(hasUpstream and "on") or "off")
else
animator.setSoundVolume("alarm",1.0,0)
animator.playSound("alarm")
animator.setAnimationState("repeaterState","error")
end

object.setOutputNodeLevel(transferUtil.vars.inDataNode,hasUpstream and 1 or 0)
end
6 changes: 4 additions & 2 deletions objects/kheAA/kheAA_repeater/kheAA_repeater.object
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"objectName" : "network_repeater",
"rarity" : "Common",
"printable" : false,
"description" : "^green;Links^reset; together certain inventory network nodes.",
"description" : "^green;Links^reset; together certain inventory network nodes. ^red;Will not function if looped.^reset;",
"shortdescription" : "Repeater",
"race" : "generic",

Expand All @@ -23,6 +23,8 @@
"repeater" : "repeater.png"
},
"animationPosition" : [0, 0],

"animation" : "/objects/kheAA/kheAA_repeater/repeater.animation",
"scripts" : [ "/objects/kheAA/kheAA_repeater/kheAA_repeater.lua"],

"inputNodes" : [ [0,0]],
Expand All @@ -32,4 +34,4 @@
"kheAA_outDataNode":0,

"scriptDelta" : 1
}
}

0 comments on commit 042e649

Please sign in to comment.