Added 'damage taken' section to the UI
This commit is contained in:
+17
-9
@@ -287,15 +287,23 @@ class World:
|
||||
actor_id = _dyn(translate.msg_target(msg)) # param 6
|
||||
victim_id = _dyn(translate.msg_source(msg)) # param 0
|
||||
actor_static = self.cache.get_static_id(actor_id)
|
||||
if actor_static is None:
|
||||
return []
|
||||
event_name = 'DamageDone' if value < 0.0 else 'HealthReceived'
|
||||
return [{
|
||||
'name': event_name,
|
||||
'value': {'source': actor_static,
|
||||
'target': self.cache.get_static_id(victim_id),
|
||||
'value': float(abs(value))},
|
||||
}]
|
||||
victim_static = self.cache.get_static_id(victim_id)
|
||||
events = []
|
||||
if actor_static is not None:
|
||||
event_name = 'DamageDone' if value < 0.0 else 'HealthReceived'
|
||||
events.append({
|
||||
'name': event_name,
|
||||
'value': {'source': actor_static,
|
||||
'target': victim_static,
|
||||
'value': float(abs(value))},
|
||||
})
|
||||
if value < 0.0 and victim_static is not None:
|
||||
events.append({
|
||||
'name': 'DamageTaken',
|
||||
'value': {'source': victim_static,
|
||||
'value': float(abs(value))},
|
||||
})
|
||||
return events
|
||||
|
||||
def _on_regeneration(self, msg: GameMessage) -> List[dict]:
|
||||
dynamic_id = _dyn(translate.msg_source(msg))
|
||||
|
||||
Reference in New Issue
Block a user