v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
11
assets/devel/objects/dpstestdummy/dpstestdummy.frames
Normal file
11
assets/devel/objects/dpstestdummy/dpstestdummy.frames
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
|
||||
"frameGrid" : {
|
||||
"size" : [32, 32],
|
||||
"dimensions" : [1, 1],
|
||||
"names" : [
|
||||
[ "default" ]
|
||||
]
|
||||
|
||||
}
|
||||
}
|
34
assets/devel/objects/dpstestdummy/dpstestdummy.object
Normal file
34
assets/devel/objects/dpstestdummy/dpstestdummy.object
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"objectName" : "dpstestdummy",
|
||||
"colonyTags" : [],
|
||||
"rarity" : "Common",
|
||||
"description" : "This straw dummy is filled with advanced sensors to measure incoming damage.",
|
||||
"shortdescription" : "DPS Test Dummy",
|
||||
"race" : "glitch",
|
||||
"category" : "decorative",
|
||||
"price" : 70,
|
||||
|
||||
"inventoryIcon" : "dpstestdummyicon.png",
|
||||
"orientations" : [
|
||||
{
|
||||
"dualImage" : "dpstestdummy.png:<color>",
|
||||
|
||||
"imagePosition" : [-16, -0],
|
||||
"frames" : 1,
|
||||
"animationCycle" : 1.0,
|
||||
|
||||
"spaceScan" : 0.1,
|
||||
"anchors" : [ "bottom" ]
|
||||
}
|
||||
],
|
||||
|
||||
"smashable" : true,
|
||||
"smashDropOptions" : [[["dpstestdummy"]]],
|
||||
"health" : 10000,
|
||||
"damageTeam" : {
|
||||
"type" : "indiscriminate"
|
||||
},
|
||||
|
||||
"scripts" : ["recount.lua"],
|
||||
"scriptDelta" : 1
|
||||
}
|
BIN
assets/devel/objects/dpstestdummy/dpstestdummy.png
Normal file
BIN
assets/devel/objects/dpstestdummy/dpstestdummy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 818 B |
BIN
assets/devel/objects/dpstestdummy/dpstestdummyicon.png
Normal file
BIN
assets/devel/objects/dpstestdummy/dpstestdummyicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 310 B |
55
assets/devel/objects/dpstestdummy/recount.lua
Normal file
55
assets/devel/objects/dpstestdummy/recount.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
function init()
|
||||
self.maxHealth = config.getParameter("health")
|
||||
|
||||
self.autoResetTime = config.getParameter("autoResetTime", 7)
|
||||
self.autoResetTimer = 0
|
||||
|
||||
reset()
|
||||
|
||||
object.setInteractive(true)
|
||||
end
|
||||
|
||||
function update(dt)
|
||||
local currentHealth = object.health()
|
||||
|
||||
self.autoResetTimer = math.max(0, self.autoResetTimer - dt)
|
||||
if self.autoResetTimer == 0 then
|
||||
reset()
|
||||
end
|
||||
|
||||
if currentHealth < self.maxHealth then
|
||||
self.meterActive = true
|
||||
self.autoResetTimer = self.autoResetTime
|
||||
end
|
||||
|
||||
if self.meterActive then
|
||||
self.meterTimer = self.meterTimer + dt
|
||||
self.totalDamage = self.totalDamage + (self.maxHealth - currentHealth)
|
||||
object.setHealth(self.maxHealth)
|
||||
end
|
||||
|
||||
drawOutput()
|
||||
end
|
||||
|
||||
function onInteraction(args)
|
||||
if self.meterActive then
|
||||
reset()
|
||||
else
|
||||
object.smash()
|
||||
end
|
||||
end
|
||||
|
||||
function reset()
|
||||
self.meterActive = false
|
||||
self.meterTimer = 0
|
||||
self.totalDamage = 0
|
||||
object.setHealth(self.maxHealth)
|
||||
end
|
||||
|
||||
function drawOutput()
|
||||
local pos = entity.position()
|
||||
pos = {pos[1] - 1.5, pos[2] + 4}
|
||||
local dps = self.meterTimer > 0 and (self.totalDamage / self.meterTimer) or 0
|
||||
local outputString = string.format("%.1f damage over\n%.1f seconds\n%.1f DPS", self.totalDamage, self.meterTimer, dps)
|
||||
world.debugText(outputString, pos, "white")
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue