jecs/demo/src/ServerScriptService/systems/poison_hurts.luau

13 lines
392 B
Text
Raw Normal View History

2025-06-05 20:48:13 +00:00
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ct = require(ReplicatedStorage.components)
return function(world, dt)
for e, poison, health in world:query(ct.Poison, ct.Health) do
local health_after_tick = health - poison * dt * 0.05
if health_after_tick < 0 then
world:remove(e, ct.Health)
continue
end
world:set(e, ct.Health, health_after_tick)
end
end