once_next_frame helper

token and time inefficient for now, but might help reduce bugs later? dunno
This commit is contained in:
Kistaro Windrider 2023-09-30 13:03:38 -07:00
parent e0b8386849
commit a58421bd19
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -129,6 +129,15 @@ function _init()
pal()
end
function once_next_frame(f)
new_events:push_back{
move = function()
f()
return true
end,
}
end
-- health gradients for 1..5 hp
-- exactly, then all "more".
hpcols_lut = csv[[36
@ -1174,7 +1183,7 @@ blast = {
hitship = function(self, _)
if self.damage > 0 and not self.awaitcancel then
self.awaitcancel = true
events:push_back{move = function()
once_next_frame(function()
new_events:push_back{
wait = 2,
obj = self,
@ -1189,8 +1198,7 @@ blast = {
}
self.damage = 0
self.awaitcancel = false
return true
end}
end)
end
end
}