Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddPrefabPostInit("your_character",function(inst)
- inst.temperature_bonus = 0.2 -- Means +20%
- local save_ignore_temp
- inst:ListenForEvent("temperaturedelta",function(inst,data)
- if save_ignore_temp then
- save_ignore_temp = false --Skip this event.
- else
- local delta = data.new - data.last
- local bonus_delta = delta * inst.temperature_bonus
- if bonus_delta ~= 0 then
- save_ignore_temp = true
- --Will cause the event again, we should skip it.
- inst.components.temperature:DoDelta(bonus_delta)
- end
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement