cyanskies / hades

A 2d game framework
1 stars 0 forks source link

Events system #119

Open cyanskies opened 3 years ago

cyanskies commented 3 years ago

events are registered to the resource system as eventname:

payload type must be one of the valid curve_types

events can be sent in two ways event: this is sent to another object in the same level

share_event: this is sent to the client side of the object

systems can declare themselves as event handlers by providing an event function eg: void event(payload_type)

client systems can do the same for share_events. share events can be serialised without type data, the client can determine the payload type from the event resource

when an event is sent it is handled by every system on the target object and then erased

Events should be used for notification, rather than game logic, on_fire, on_hurt and so on. on_hurt shouldn't be used to implement damage and attacks, but to handle last_damaged_time and similar bookkeeping.