v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
52
assets/devel/objects/pump/pump.animation
Normal file
52
assets/devel/objects/pump/pump.animation
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"animatedParts" : {
|
||||
"stateTypes" : {
|
||||
"pumping" : {
|
||||
"priority" : 0,
|
||||
"default" : "idle",
|
||||
|
||||
"states" : {
|
||||
"idle" : {
|
||||
"frames" : 1
|
||||
},
|
||||
"error" : {
|
||||
"frames" : 1
|
||||
},
|
||||
"pump" : {
|
||||
"frames" : 10,
|
||||
"cycle" : 0.5,
|
||||
"mode" : "loop"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"parts" : {
|
||||
"pump" : {
|
||||
"properties" : {
|
||||
"offset" : [0, 0],
|
||||
"centered" : false,
|
||||
"zLevel" : 3
|
||||
},
|
||||
"partStates" : {
|
||||
"pumping" : {
|
||||
"idle" : {
|
||||
"properties" : {
|
||||
"image" : "<partImage>:idle"
|
||||
}
|
||||
},
|
||||
"error" : {
|
||||
"properties" : {
|
||||
"image" : "<partImage>:error"
|
||||
}
|
||||
},
|
||||
"pump" : {
|
||||
"properties" : {
|
||||
"image" : "<partImage>:pump.<frame>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
assets/devel/objects/pump/pump.frames
Normal file
9
assets/devel/objects/pump/pump.frames
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"frameGrid" : {
|
||||
"size" : [16, 16],
|
||||
"dimensions" : [12, 1],
|
||||
"names" : [
|
||||
[ "idle", "error", "pump.1", "pump.2", "pump.3", "pump.4", "pump.5", "pump.6", "pump.7", "pump.8", "pump.9", "pump.10" ]
|
||||
]
|
||||
}
|
||||
}
|
56
assets/devel/objects/pump/pump.lua
Normal file
56
assets/devel/objects/pump/pump.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
require "/scripts/vec2.lua"
|
||||
|
||||
function init()
|
||||
self.inputPosition = config.getParameter("inputPosition")
|
||||
self.outputPosition = config.getParameter("outputPosition")
|
||||
|
||||
if object.direction() < 0 then
|
||||
self.inputPosition, self.outputPosition = self.outputPosition, self.inputPosition
|
||||
end
|
||||
|
||||
local pos = entity.position()
|
||||
self.inputPosition = vec2.add(vec2.add(self.inputPosition, pos), {0.5, 0.5})
|
||||
self.outputPosition = vec2.add(vec2.add(self.outputPosition, pos), {0.5, 0.5})
|
||||
|
||||
self.pumpTimer = 0
|
||||
self.pumpFrequency = config.getParameter("pumpFrequency", 0.25)
|
||||
|
||||
storage.pumping = storage.pumping or false
|
||||
end
|
||||
|
||||
function update(dt)
|
||||
-- world.debugPoint(self.inputPosition, "blue")
|
||||
-- world.debugPoint(self.outputPosition, "green")
|
||||
|
||||
if object.isInputNodeConnected(0) then
|
||||
object.setInteractive(false)
|
||||
storage.pumping = object.getInputNodeLevel(0)
|
||||
else
|
||||
object.setInteractive(true)
|
||||
end
|
||||
|
||||
local pumpAnimationState = storage.pumping and ((world.liquidAt(self.inputPosition) and not world.pointCollision(self.outputPosition)) and "pump" or "error") or "idle"
|
||||
animator.setAnimationState("pumping", pumpAnimationState)
|
||||
|
||||
self.pumpTimer = math.max(0, self.pumpTimer - dt)
|
||||
if storage.pumping and self.pumpTimer == 0 then
|
||||
pump()
|
||||
self.pumpTimer = self.pumpFrequency
|
||||
end
|
||||
end
|
||||
|
||||
function onInteraction(args)
|
||||
storage.pumping = not storage.pumping
|
||||
end
|
||||
|
||||
function uninit()
|
||||
|
||||
end
|
||||
|
||||
function pump()
|
||||
local liquid = world.liquidAt(self.inputPosition)
|
||||
if liquid and not world.pointCollision(self.outputPosition) then
|
||||
world.destroyLiquid(self.inputPosition)
|
||||
world.spawnLiquid(self.outputPosition, table.unpack(liquid))
|
||||
end
|
||||
end
|
45
assets/devel/objects/pump/pump.object
Normal file
45
assets/devel/objects/pump/pump.object
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"objectName" : "pump",
|
||||
"colonyTags" : ["wired"],
|
||||
"printable" : false,
|
||||
"rarity" : "Common",
|
||||
"description" : "Moves liquids from one side to the other.",
|
||||
"shortdescription" : "Pump",
|
||||
"race" : "generic",
|
||||
|
||||
"category" : "wire",
|
||||
"price" : 20,
|
||||
|
||||
"inventoryIcon" : "pump.png:idle",
|
||||
"orientations" : [
|
||||
{
|
||||
"dualImage" : "pump.png:idle",
|
||||
"imagePosition" : [-8, -8],
|
||||
|
||||
"spaceScan" : 0.1,
|
||||
"anchors" : [ "background" ],
|
||||
|
||||
"collision" : "solid"
|
||||
}
|
||||
],
|
||||
|
||||
"scripts" : [
|
||||
"pump.lua"
|
||||
],
|
||||
"scriptDelta" : 5,
|
||||
|
||||
"animation" : "pump.animation",
|
||||
"animationCustom" : { },
|
||||
|
||||
"animationParts" : {
|
||||
"pump" : "pump.png"
|
||||
},
|
||||
"animationPosition" : [-8, -8],
|
||||
|
||||
"inputNodes" : [ [-1, 0] ],
|
||||
|
||||
"inputPosition" : [-2, -1],
|
||||
"outputPosition" : [1, -1],
|
||||
|
||||
"pumpFrequency" : 0.25
|
||||
}
|
BIN
assets/devel/objects/pump/pump.png
Normal file
BIN
assets/devel/objects/pump/pump.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue