Permalink
Browse files

Exported CEventAction as entities.EventAction.

Moved BaseEntityOutput from listeners to entities.
Added variant and event_action properties to BaseEntityOutput.
  • Loading branch information...
invincibleqc committed Dec 2, 2018
1 parent c5beafc commit 678cbd0f432f56d7f19c8c4641e77c349c5f3605
@@ -3,6 +3,16 @@
binary = server
srv_check = False
[instance_attribute]
[[variant]]
type = POINTER
offset = 0
[[event_action]]
type = POINTER
offset = 20
[function]
[[fire_output]]
identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
@@ -2,9 +2,19 @@
binary = server
[instance_attribute]
[[variant]]
type = POINTER
offset = 0
[[event_action]]
type = POINTER
offset = 20
[function]
[[fire_output]]
identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
identifier_windows = 55 8B EC 81 EC 2A 2A 2A 2A A1 2A 2A 2A 2A 33 C5 89 45 FC 53 8B 5D 20 8B C1 8B 4D 1C 56 57 8B
arguments_linux = POINTER, POINTER, POINTER, FLOAT
arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT
arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT
@@ -3,6 +3,16 @@
binary = server
srv_check = False
[instance_attribute]
[[variant]]
type = POINTER
offset = 0
[[event_action]]
type = POINTER
offset = 20
[function]
[[fire_output]]
# identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
@@ -2,6 +2,16 @@
binary = server
[instance_attribute]
[[variant]]
type = POINTER
offset = 0
[[event_action]]
type = POINTER
offset = 20
[function]
[[fire_output]]
identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
@@ -2,9 +2,19 @@
binary = server
[instance_attribute]
[[variant]]
type = POINTER
offset = 0
[[event_action]]
type = POINTER
offset = 20
[function]
[[fire_output]]
identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
identifier_windows = 55 8B EC 81 EC 2A 2A 2A 2A A1 2A 2A 2A 2A 33 C5 89 2A 2A 8B 2A 2A 53 56 8B 2A 2A 57 8B 2A 2A 89 2A 2A 2A 2A 2A 89 2A 2A 2A 2A 2A 89 2A 2A 2A 2A 2A C7
arguments_linux = POINTER, POINTER, POINTER, FLOAT
arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT
arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT
@@ -2,9 +2,19 @@
binary = server
[instance_attribute]
[[variant]]
type = POINTER
offset = 0
[[event_action]]
type = POINTER
offset = 20
[function]
[[fire_output]]
identifier_linux = _ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f
identifier_windows = 55 8B EC 81 EC 24 01 00 00 53 8B C1
arguments_linux = POINTER, POINTER, POINTER, FLOAT
arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT
arguments_windows = INT, INT, INT, INT, POINTER, POINTER, POINTER, FLOAT
@@ -153,20 +153,21 @@ def setup_data():
'BaseClient',
GameConfigObj(SP_DATA_PATH / 'client' / 'CBaseClient.ini'))
import listeners
listeners.BaseEntityOutput = manager.create_type_from_dict(
import entities
entities.BaseEntityOutput = manager.create_type_from_dict(
'BaseEntityOutput',
GameConfigObj(SP_DATA_PATH / 'entity_output' / 'CBaseEntityOutput.ini'))
try:
_fire_output = listeners.BaseEntityOutput.fire_output
_fire_output = entities.BaseEntityOutput.fire_output
except AttributeError:
from warnings import warn
warn(
'BaseEntityOutput.fire_output not found. '
'OnEntityOutput listener will not fire.'
)
else:
import listeners
_fire_output.add_pre_hook(listeners._pre_fire_output)
@@ -22,6 +22,7 @@
from _entities import Edict
from _entities import EntityGenerator
from _entities import EntityListener
from _entities import EventAction
from _entities import GlobalEntityList
from _entities import HandleEntity
from _entities import ServerClassGenerator
@@ -36,11 +37,13 @@
# =============================================================================
__all__ = ('BaseEntityGenerator',
'BaseEntityHandle',
'BaseEntityOutput',
'CheckTransmitInfo',
'Collideable',
'Edict',
'EntityGenerator',
'EntityListener',
'EventAction',
'GlobalEntityList',
'HandleEntity',
'ServerClassGenerator',
@@ -44,6 +44,7 @@
#include "isaverestore.h"
#include "datamap.h"
#include "game/shared/takedamageinfo.h"
#include "game/server/entityoutput.h"
//-----------------------------------------------------------------------------
@@ -208,4 +209,41 @@ class TakeDamageInfoSharedExt
};
//-----------------------------------------------------------------------------
// CEventAction extension class.
//-----------------------------------------------------------------------------
class EventActionExt
{
public:
static const char *get_target(CEventAction *pEventAction)
{
return STRING(pEventAction->m_iTarget);
}
static void set_target(CEventAction *pEventAction, const char *szTarget)
{
pEventAction->m_iTarget = MAKE_STRING(szTarget);
}
static const char *get_target_input(CEventAction *pEventAction)
{
return STRING(pEventAction->m_iTargetInput);
}
static void set_target_input(CEventAction *pEventAction, const char *szTargetInput)
{
pEventAction->m_iTargetInput = MAKE_STRING(szTargetInput);
}
static const char *get_parameter(CEventAction *pEventAction)
{
return STRING(pEventAction->m_iParameter);
}
static void set_parameter(CEventAction *pEventAction, const char *szParameter)
{
pEventAction->m_iParameter = MAKE_STRING(szParameter);
}
};
#endif // _ENTITIES_H
@@ -32,6 +32,7 @@
#include "utilities/baseentity.h"
#include "game/shared/entitylist_base.h"
#include "game/server/entitylist.h"
#include "game/server/entityoutput.h"
#include "modules/memory/memory_tools.h"
#include "export_main.h"
@@ -58,6 +59,7 @@ void export_check_transmit_info(scope);
void export_baseentity_generator(scope);
void export_server_class_generator(scope);
void export_collideable(scope);
void export_event_action(scope);
//-----------------------------------------------------------------------------
@@ -79,6 +81,7 @@ DECLARE_SP_MODULE(_entities)
export_baseentity_generator(_entities);
export_server_class_generator(_entities);
export_collideable(_entities);
export_event_action(_entities);
}
@@ -611,3 +614,53 @@ void export_collideable(scope _entities)
Collideable ADD_MEM_TOOLS(ICollideable);
}
//-----------------------------------------------------------------------------
// Exports CEventAction.
//-----------------------------------------------------------------------------
void export_event_action(scope _entities)
{
class_<CEventAction, boost::noncopyable> EventAction("EventAction", no_init);
EventAction.add_property(
"target",
&EventActionExt::get_target, &EventActionExt::set_target,
"Name of the entity(s) to cause the action in."
);
EventAction.add_property(
"target_input",
&EventActionExt::get_target_input, &EventActionExt::set_target_input,
"The name of the action to fire."
);
EventAction.add_property(
"parameter",
&EventActionExt::get_parameter, &EventActionExt::set_parameter,
"Parameter to send, 0 if none."
);
EventAction.def_readwrite("delay",
&CEventAction::m_flDelay,
"The number of seconds to wait before firing the action."
);
EventAction.def_readwrite("times_to_fire",
&CEventAction::m_nTimesToFire,
"The number of times to fire this event, or EVENT_FIRE_ALWAYS."
);
EventAction.def_readwrite("id_stamp",
&CEventAction::m_iIDStamp,
"Unique identifier stamp."
);
EventAction.add_property(
"next",
make_getter(&CEventAction::m_pNext, reference_existing_object_policy()),
"The next action in the linked list."
);
EventAction ADD_MEM_TOOLS(CEventAction);
}

0 comments on commit 678cbd0

Please sign in to comment.