-
Notifications
You must be signed in to change notification settings - Fork 13
Events
AppCraft-LLC edited this page Feb 8, 2018
·
1 revision
Each event has the following structure:
* { type: eventTypes.birth, // Type of an event. The following types of events are possible:
* // eventTypes = { wound: 0, murder: 1, death: 2, upgrade: 3, birth: 4, spell: 5 }
* payload: [ creature ] // An array with 1 or 2 creature objects.
* // If contains 2 creatures, the 1st one is the object and the 2nd one is the subject.
* // Payload of [murder] event contains 2 creatures:
* // the 1st creature is the victim and the 2nd creature is the attacker.
* // Payload of [death, upgrade, birth, spell] events contains 1 creature object.
* // Payload of [wound] may contain or may not contain the attacker.
* };
For example wound event can be:
{
type: events.wound,
payload: [ obj1, obj2 ]
};
Where obj1
is the creature who was hurted and obj2
is the creature who hurted obj1
creature.
Payload of other events contains only 1 entity, the creature who upgraded, died or was born.