Stats¶
Generated
This page is auto-generated from psxsplash-main/src/luaapi.hh by scripts/py/gen_lua_api_docs.py. Edits won't survive the next build — fix the source comments instead.
10 entries, 6 with worked examples mined from godot-ps1/demo/scripts/ and the bundled templates.
Methods¶
Stats.GetHP(object) -> int¶
Current HP. 0 if the entity has no PS1Stats authored or HP has hit 0 (the entity is "dead" from a stats perspective; runtime does not auto-destroy — your Lua decides what happens then).
Example
Source: godot-ps1/demo/scripts/boss_smoke_brain.lua line 63.
Stats.SetHP(object, value) -> int¶
Clamps value to [0, MaxHP] and stores it as the new current HP. Returns the stored value. No-op on entities without stats.
Stats.GetMaxHP(object) -> int¶
0 if the entity has no PS1Stats authored.
Example
Source: godot-ps1/demo/scripts/boss_smoke_brain.lua line 64.
Stats.GetStamina(object) -> int¶
Current stamina. 0 if entity has no stamina system (MaxStamina = 0).
Example
-- Stamina regen — slow, gated on not currently dodging
if dodgeFrames == 0 and Stats.GetStamina(self) < Stats.GetMaxStamina(self) then
Source: godot-ps1/demo/scripts/boss_smoke_player.lua line 123.
Stats.SetStamina(object, value) -> int¶
Clamps to [0, MaxStamina]. Returns stored value.
Example
Source: godot-ps1/demo/scripts/boss_smoke_player.lua line 126.
Stats.GetMaxStamina(object) -> int¶
No description.
Example
-- Stamina regen — slow, gated on not currently dodging
if dodgeFrames == 0 and Stats.GetStamina(self) < Stats.GetMaxStamina(self) then
Source: godot-ps1/demo/scripts/boss_smoke_player.lua line 123.
Stats.GetMana(object) -> int¶
Current mana. 0 if entity has no mana system (MaxMana = 0).
Stats.SetMana(object, value) -> int¶
Clamps to [0, MaxMana]. Returns stored value.
Stats.GetMaxMana(object) -> int¶
No description.
Stats.DealDamage(target, amount, source?) -> int¶
Central damage entry point. Skips silently when target has
i-frames active (returns 0). Otherwise debits HP (clamped to 0)
and fires the target's onDamage(self, applied, source) Lua
callback if defined. source is optional — pass nil for
environmental damage (fall, poison, world hazards). Returns the
damage that actually landed; 0 when blocked by i-frames, no
stats, or already-dead target.
Example
Source: godot-ps1/demo/scripts/boss_smoke_player.lua line 103.