1
0
forked from 0ad/0ad
0ad/source/scripting/EventTypes.h
pyrolink f2e867e239 #Bar borders and angle penalty
-Changes to notifications. They take different parameters now-see
template_entity_script.js.  You can choose to destroy the notifiers
yourself in the script (useful for idle)
-Added "idle" event with registerIdle and registerDamage to assist with
the angle penalty.
-Bar border stuff
-Angle penalty is set up but untested-it just needs to use
this.getAttackDirections() to find the number of directions the entity
is being attacked from.  The penalty is specified in template_unit

There is a problem when the game exits-it attempts to destroy the
notifiers in entity.cpp's constructor, where it calls
DestroyAllNotifiers().  The problem is that the notifiers don't exist
any longer because they've been destroyed. I would fix it but I'm
leaving for vacation (Jason told me it was OK to comitt). Hope it isn't
too much of a problem.

This was SVN commit r3732.
2006-04-08 22:34:54 +00:00

58 lines
2.1 KiB
C

// EventTypes.h
// Fairly game-specific event declarations for use with DOMEvent.
// Creates unique (for the current target) names for each event.
// DOMEvent currently uses a preallocated array of EVENT_LAST elements,
// so these must be consecutive integers starting with 0.
#ifndef EVENTTYPES_H__
#define EVENTTYPES_H__
enum EEventType
{
// Entity events
EVENT_INITIALIZE = 0,
EVENT_DEATH,
EVENT_TICK,
EVENT_GENERIC,
EVENT_START_PRODUCTION,
EVENT_CANCEL_PRODUCTION,
EVENT_FINISH_PRODUCTION,
EVENT_TARGET_CHANGED,
EVENT_PREPARE_ORDER,
EVENT_ORDER_TRANSITION,
EVENT_NOTIFICATION,
EVENT_FORMATION,
EVENT_IDLE,
EVENT_LAST,
// Projectile events
EVENT_IMPACT = 0,
EVENT_MISS,
// General events
EVENT_GAME_START = 0,
EVENT_GAME_TICK,
EVENT_SELECTION_CHANGED,
EVENT_WORLD_CLICK,
};
// Only used for entity events... (adds them as a property)
static const wchar_t* const EventNames[EVENT_LAST] =
{
/* EVENT_INITIALIZE */ L"onInitialize",
/* EVENT_DEATH */ L"onDeath",
/* EVENT_TICK */ L"onTick",
/* EVENT_GENERIC */ L"onGeneric", /* For generic actions on a target unit, like attack or gather */
/* EVENT_START_PRODUCTION */ L"onStartProduction", /* We're about to start training/researching something (deduct resources, etc) */
/* EVENT_CANCEL_PRODUCTION */ L"onCancelProduction", /* Something in production has been cancelled */
/* EVENT_FINISH_PRODUCTION */ L"onFinishProduction", /* We've finished something in production */
/* EVENT_TARGET_CHANGED */ L"onTargetChanged", /* If this unit is selected and the mouseover object changes */
/* EVENT_PREPARE_ORDER */ L"onPrepareOrder", /* To check if a unit can execute a given order */
/* EVENT_ORDER_TRANSITION */ L"onOrderTransition", /* When we change orders (sometimes...) */
/* EVENT_NOTIFICATION */ L"onNotification", /*When we receive a notification */
/* EVENT_FORMATION */ L"onFormation", /* When this unit does something with a formation */
/* EVENT_IDLE */ L"onIdle" /* When this unit becomes idle, do something */
};
#endif // #ifndef EVENTTYPES_H__