2004-11-11 08:09:32 +01:00
|
|
|
#include "precompiled.h"
|
|
|
|
#include "EventHandlers.h"
|
|
|
|
#include "Entity.h"
|
|
|
|
|
2005-12-29 09:42:44 +01:00
|
|
|
CEventGeneric::CEventGeneric( CEntity* target, int action ) : CScriptEvent( L"generic", EVENT_GENERIC, true)
|
2005-04-15 06:23:33 +02:00
|
|
|
{
|
|
|
|
m_target = target;
|
2005-12-29 09:42:44 +01:00
|
|
|
m_action = action;
|
2005-04-22 09:12:55 +02:00
|
|
|
AddLocalProperty( L"target", &m_target );
|
2005-12-29 09:42:44 +01:00
|
|
|
AddLocalProperty( L"action", &m_action );
|
2005-04-15 06:23:33 +02:00
|
|
|
}
|
|
|
|
|
2006-10-09 06:17:15 +02:00
|
|
|
CEventTargetExhausted::CEventTargetExhausted( CEntity* target, int action ) : CScriptEvent( L"TargetExhausted", EVENT_TARGET_EXHAUSTED, true)
|
|
|
|
{
|
|
|
|
m_target = target;
|
|
|
|
m_action = action;
|
|
|
|
AddLocalProperty( L"target", &m_target );
|
|
|
|
AddLocalProperty( L"action", &m_action );
|
|
|
|
}
|
|
|
|
|
2006-05-04 09:40:31 +02:00
|
|
|
CEventStartConstruction::CEventStartConstruction( CEntity* target ) : CScriptEvent( L"startConstruction", EVENT_START_CONSTRUCTION, true)
|
|
|
|
{
|
|
|
|
m_target = target;
|
|
|
|
AddLocalProperty( L"target", &m_target );
|
|
|
|
}
|
|
|
|
|
2006-02-22 23:45:16 +01:00
|
|
|
CEventStartProduction::CEventStartProduction( int productionType, const CStrW& name )
|
|
|
|
: CScriptEvent( L"startProduction", EVENT_START_PRODUCTION, true)
|
2004-11-11 08:09:32 +01:00
|
|
|
{
|
2006-02-22 23:45:16 +01:00
|
|
|
m_productionType = productionType;
|
|
|
|
m_name = name;
|
|
|
|
m_time = -1;
|
|
|
|
AddLocalProperty( L"productionType", &m_productionType );
|
|
|
|
AddLocalProperty( L"name", &m_name );
|
|
|
|
AddLocalProperty( L"time", &m_time );
|
|
|
|
}
|
|
|
|
|
|
|
|
CEventFinishProduction::CEventFinishProduction( int productionType, const CStrW& name )
|
|
|
|
: CScriptEvent( L"finishProduction", EVENT_FINISH_PRODUCTION, true)
|
|
|
|
{
|
|
|
|
m_productionType = productionType;
|
|
|
|
m_name = name;
|
|
|
|
AddLocalProperty( L"productionType", &m_productionType );
|
|
|
|
AddLocalProperty( L"name", &m_name );
|
|
|
|
}
|
|
|
|
|
|
|
|
CEventCancelProduction::CEventCancelProduction( int productionType, const CStrW& name )
|
|
|
|
: CScriptEvent( L"cancelProduction", EVENT_CANCEL_PRODUCTION, true)
|
|
|
|
{
|
|
|
|
m_productionType = productionType;
|
|
|
|
m_name = name;
|
|
|
|
AddLocalProperty( L"productionType", &m_productionType );
|
|
|
|
AddLocalProperty( L"name", &m_name );
|
|
|
|
}
|
2004-11-11 08:09:32 +01:00
|
|
|
|
2005-04-22 09:12:55 +02:00
|
|
|
CEventTargetChanged::CEventTargetChanged( CEntity* target ) : CScriptEvent( L"targetChanged", EVENT_TARGET_CHANGED, false )
|
2004-11-11 08:09:32 +01:00
|
|
|
{
|
|
|
|
m_target = target;
|
2005-12-29 09:42:44 +01:00
|
|
|
m_defaultOrder = -1;
|
|
|
|
m_defaultAction = 0;
|
2005-04-22 09:12:55 +02:00
|
|
|
m_defaultCursor = L"arrow-default";
|
2006-01-16 11:56:47 +01:00
|
|
|
|
|
|
|
m_secondaryOrder = -1;
|
|
|
|
m_secondaryAction = 0;
|
|
|
|
m_secondaryCursor = L"arrow-default";
|
|
|
|
|
2005-04-22 09:12:55 +02:00
|
|
|
AddLocalProperty( L"target", &m_target, true );
|
2005-12-29 09:42:44 +01:00
|
|
|
AddLocalProperty( L"defaultOrder", &m_defaultOrder );
|
2005-04-22 09:12:55 +02:00
|
|
|
AddLocalProperty( L"defaultAction", &m_defaultAction );
|
|
|
|
AddLocalProperty( L"defaultCursor", &m_defaultCursor );
|
2006-01-16 11:56:47 +01:00
|
|
|
AddLocalProperty( L"secondaryOrder", &m_secondaryOrder );
|
|
|
|
AddLocalProperty( L"secondaryCursor", &m_secondaryCursor );
|
|
|
|
AddLocalProperty( L"secondaryAction", &m_secondaryAction );
|
2004-11-11 08:09:32 +01:00
|
|
|
}
|
|
|
|
|
2006-02-22 23:45:16 +01:00
|
|
|
CEventPrepareOrder::CEventPrepareOrder( CEntity* target, int orderType, int action, const CStrW& name)
|
|
|
|
: CScriptEvent( L"prepareOrder", EVENT_PREPARE_ORDER, true )
|
2004-11-11 08:09:32 +01:00
|
|
|
{
|
|
|
|
m_target = target;
|
|
|
|
m_orderType = orderType;
|
2006-02-13 04:32:15 +01:00
|
|
|
m_action = action;
|
2006-02-22 23:45:16 +01:00
|
|
|
m_name = name;
|
2005-04-22 09:12:55 +02:00
|
|
|
AddLocalProperty( L"target", &m_target, true );
|
|
|
|
AddLocalProperty( L"orderType", &m_orderType, true );
|
2006-02-13 04:32:15 +01:00
|
|
|
AddLocalProperty( L"action", &m_action );
|
2006-02-22 23:45:16 +01:00
|
|
|
AddLocalProperty( L"name", &m_name );
|
2006-02-13 04:32:15 +01:00
|
|
|
AddLocalProperty( L"notifyType", &m_notifyType );
|
|
|
|
AddLocalProperty( L"notifySource", &m_notifySource );
|
2004-11-15 23:30:01 +01:00
|
|
|
}
|
|
|
|
|
2006-02-22 23:45:16 +01:00
|
|
|
CEventOrderTransition::CEventOrderTransition( int orderPrevious, int orderCurrent, CEntity*& target, CVector3D& worldPosition )
|
|
|
|
: CScriptEvent( L"orderTransition", EVENT_ORDER_TRANSITION, true )
|
2004-11-15 23:30:01 +01:00
|
|
|
{
|
|
|
|
m_orderPrevious = orderPrevious;
|
|
|
|
m_orderCurrent = orderCurrent;
|
|
|
|
m_target = ⌖
|
|
|
|
m_worldPosition = &worldPosition;
|
2005-04-22 09:12:55 +02:00
|
|
|
AddLocalProperty( L"orderPrevious", &m_orderPrevious, true );
|
|
|
|
AddLocalProperty( L"orderCurrent", &m_orderCurrent );
|
|
|
|
AddLocalProperty( L"target", m_target );
|
|
|
|
AddLocalProperty( L"position", m_worldPosition );
|
2004-11-24 00:56:10 +01:00
|
|
|
}
|
2006-02-13 04:32:15 +01:00
|
|
|
CEventNotification::CEventNotification( CEntityOrder order, int notifyType ) : CScriptEvent( L"notification", EVENT_NOTIFICATION, true )
|
2006-01-08 09:25:11 +01:00
|
|
|
{
|
2006-02-13 04:32:15 +01:00
|
|
|
m_notifyType = notifyType;
|
2006-01-08 09:25:11 +01:00
|
|
|
m_target = order.m_data[0].entity;
|
|
|
|
CVector3D convert( order.m_data[0].location.x, 0.0f, order.m_data[0].location.y );
|
|
|
|
m_location = convert;
|
|
|
|
|
2006-02-13 04:32:15 +01:00
|
|
|
AddLocalProperty( L"notifyType", &m_notifyType );
|
2006-01-08 09:25:11 +01:00
|
|
|
AddLocalProperty( L"target", &m_target );
|
|
|
|
AddLocalProperty( L"location", &m_location );
|
|
|
|
}
|
2006-04-09 00:34:54 +02:00
|
|
|
CFormationEvent::CFormationEvent( int type ) : CScriptEvent( L"formationEvent", EVENT_FORMATION, true )
|
2006-03-31 05:30:34 +02:00
|
|
|
{
|
|
|
|
(int&) m_formationEvent = type;
|
|
|
|
AddLocalProperty( L"formationEvent", &m_formationEvent );
|
|
|
|
}
|
2006-04-09 00:34:54 +02:00
|
|
|
CIdleEvent::CIdleEvent( CEntityOrder order, int notifyType ) : CScriptEvent( L"idleEvent", EVENT_IDLE, false )
|
|
|
|
{
|
|
|
|
m_notifyType = notifyType;
|
|
|
|
m_orderType = order.m_type;
|
|
|
|
m_target = order.m_data[0].entity;
|
|
|
|
CVector3D convert( order.m_data[0].location.x, 0.0f, order.m_data[0].location.y );
|
|
|
|
m_location = convert;
|
|
|
|
|
|
|
|
AddLocalProperty( L"notifyType", &m_notifyType );
|
|
|
|
AddLocalProperty( L"orderType", &m_orderType );
|
|
|
|
AddLocalProperty( L"target", &m_target );
|
|
|
|
AddLocalProperty( L"location", &m_location );
|
2006-05-04 06:14:48 +02:00
|
|
|
}
|