Skip to content

Commit 15edbfd

Browse files
revolucasXottab-DUTY
authored andcommitted
+ add new game_object exports:
u32 get_spatial_type() -- get alife object flags set_spatial_type(u32) -- set alife object flags iterate_feel_touch(funct) ex. obj:iterate_feel_touch(func) -- passes ID as param to a given lua function
1 parent 986f036 commit 15edbfd

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

src/xrGame/script_game_object.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,9 @@ class CScriptGameObject
835835
void StartTrade(CScriptGameObject* obj);
836836
void StartUpgrade(CScriptGameObject* obj);
837837
void SetWeight(float w);
838+
void IterateFeelTouch(luabind::functor<void> functor);
839+
u32 GetSpatialType();
840+
void SetSpatialType(u32 sptype);
838841

839842
//Weapon
840843
void Weapon_AddonAttach(CScriptGameObject* item);

src/xrGame/script_game_object3.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include "CharacterPhysicsSupport.h"
4747
#include "player_hud.h"
4848
#include "eatable_item.h"
49+
#include "script_callback_ex.h"
50+
#include "xrEngine/feel_touch.h"
4951
#endif
5052
//-Alundaio
5153

@@ -1507,5 +1509,30 @@ u8 CScriptGameObject::GetMaxUses()
15071509

15081510
return eItm->GetMaxUses();
15091511
}
1512+
1513+
void CScriptGameObject::IterateFeelTouch(luabind::functor<void> functor)
1514+
{
1515+
Feel::Touch* touch = smart_cast<Feel::Touch*>(&object());
1516+
if (touch)
1517+
{
1518+
for (const auto& game_object : touch->feel_touch)
1519+
{
1520+
// Xottab_DUTY: Do we need this cast from IGameObject* to IGameObject* ?
1521+
IGameObject* o = smart_cast<IGameObject*>(game_object);
1522+
if (o)
1523+
functor(game_object->ID());
1524+
}
1525+
}
1526+
}
1527+
1528+
void CScriptGameObject::SetSpatialType(u32 sptype)
1529+
{
1530+
object().spatial.type = sptype;
1531+
}
1532+
1533+
u32 CScriptGameObject::GetSpatialType()
1534+
{
1535+
return object().spatial.type;
1536+
}
15101537
#endif
15111538
//-Alundaio

src/xrGame/script_game_object_script3.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,15 @@ class_<CScriptGameObject>& script_register_game_object2(class_<CScriptGameObject
361361
.def("get_attached_vehicle", &CScriptGameObject::GetAttachedVehicle)
362362

363363
#ifdef GAME_OBJECT_EXTENDED_EXPORTS
364+
.def("iterate_feel_touch", &CScriptGameObject::IterateFeelTouch)
364365
.def("get_luminocity_hemi", &CScriptGameObject::GetLuminocityHemi)
365366
.def("get_luminocity", &CScriptGameObject::GetLuminocity)
366367
.def("bone_visible", &CScriptGameObject::IsBoneVisible)
367368
.def("set_bone_visible", &CScriptGameObject::SetBoneVisible)
368369
.def("set_health_ex", &CScriptGameObject::SetHealthEx) // AVO
369370
.def("force_set_position", &CScriptGameObject::ForceSetPosition)
371+
.def("set_spatial_type", &CScriptGameObject::SetSpatialType)
372+
.def("get_spatial_type", &CScriptGameObject::GetSpatialType)
370373

371374
//For Weapons
372375
.def("weapon_addon_attach", &CScriptGameObject::Weapon_AddonAttach)

0 commit comments

Comments
 (0)