Skip to content

Commit ac08a5c

Browse files
committed
Add script export for player shooting capability
1 parent 77999b3 commit ac08a5c

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/xrGame/script_game_object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ class CScriptGameObject {
719719
bool GetActorMovementState (ACTOR_DEFS::EMovementStates state, ACTOR_DEFS::EMoveCommand mask);
720720
void SetActorMovementState (ACTOR_DEFS::EMovementStates state, ACTOR_DEFS::EMoveCommand mask, bool status);
721721

722+
void ActorFire() const;
722723

723724
#ifdef DEBUG
724725
void debug_planner (const script_planner *planner);

src/xrGame/script_game_object_inventory_owner.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,18 @@ void CScriptGameObject::SetActorMovementState(ACTOR_DEFS::EMovementStates state,
16271627
}
16281628
}
16291629

1630+
void CScriptGameObject::ActorFire() const
1631+
{
1632+
if (CActor* pActor = object().cast_actor())
1633+
{
1634+
pActor->SetActorKeyRepeatFlag(ACTOR_DEFS::kfFIRE, true);
1635+
}
1636+
else
1637+
{
1638+
ai().script_engine().script_log(ScriptStorage::eLuaMessageTypeError, "CActor : cannot access class member ActorFire!");
1639+
}
1640+
}
1641+
16301642
void CScriptGameObject::enable_movement(bool enable)
16311643
{
16321644
if (CCreature* monster = object().cast_creature())

src/xrGame/script_game_object_script3.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ class_<CScriptGameObject> script_register_game_object2(class_<CScriptGameObject>
276276
//Actor states
277277
.def("get_movement_state", &CScriptGameObject::GetActorMovementState)
278278
.def("set_movement_state", &CScriptGameObject::SetActorMovementState)
279+
.def("fire", &CScriptGameObject::ActorFire)
279280

280281
//CustomZone
281282
.def("set_restrictor_type", &CScriptGameObject::SetRestrictionType)

0 commit comments

Comments
 (0)