once_next_frame helper
token and time inefficient for now, but might help reduce bugs later? dunno
This commit is contained in:
		| @@ -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 | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user