Skip to content

Commit

Permalink
+ add new game_object exports:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
revolucas authored and Xottab-DUTY committed Dec 23, 2017
1 parent 986f036 commit 15edbfd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/xrGame/script_game_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,9 @@ class CScriptGameObject
void StartTrade(CScriptGameObject* obj);
void StartUpgrade(CScriptGameObject* obj);
void SetWeight(float w);
void IterateFeelTouch(luabind::functor<void> functor);
u32 GetSpatialType();
void SetSpatialType(u32 sptype);

//Weapon
void Weapon_AddonAttach(CScriptGameObject* item);
Expand Down
27 changes: 27 additions & 0 deletions src/xrGame/script_game_object3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
#include "CharacterPhysicsSupport.h"
#include "player_hud.h"
#include "eatable_item.h"
#include "script_callback_ex.h"
#include "xrEngine/feel_touch.h"
#endif
//-Alundaio

Expand Down Expand Up @@ -1507,5 +1509,30 @@ u8 CScriptGameObject::GetMaxUses()

return eItm->GetMaxUses();
}

void CScriptGameObject::IterateFeelTouch(luabind::functor<void> functor)
{
Feel::Touch* touch = smart_cast<Feel::Touch*>(&object());
if (touch)
{
for (const auto& game_object : touch->feel_touch)
{
// Xottab_DUTY: Do we need this cast from IGameObject* to IGameObject* ?
IGameObject* o = smart_cast<IGameObject*>(game_object);
if (o)
functor(game_object->ID());
}
}
}

void CScriptGameObject::SetSpatialType(u32 sptype)
{
object().spatial.type = sptype;
}

u32 CScriptGameObject::GetSpatialType()
{
return object().spatial.type;
}
#endif
//-Alundaio
3 changes: 3 additions & 0 deletions src/xrGame/script_game_object_script3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,15 @@ class_<CScriptGameObject>& script_register_game_object2(class_<CScriptGameObject
.def("get_attached_vehicle", &CScriptGameObject::GetAttachedVehicle)

#ifdef GAME_OBJECT_EXTENDED_EXPORTS
.def("iterate_feel_touch", &CScriptGameObject::IterateFeelTouch)
.def("get_luminocity_hemi", &CScriptGameObject::GetLuminocityHemi)
.def("get_luminocity", &CScriptGameObject::GetLuminocity)
.def("bone_visible", &CScriptGameObject::IsBoneVisible)
.def("set_bone_visible", &CScriptGameObject::SetBoneVisible)
.def("set_health_ex", &CScriptGameObject::SetHealthEx) // AVO
.def("force_set_position", &CScriptGameObject::ForceSetPosition)
.def("set_spatial_type", &CScriptGameObject::SetSpatialType)
.def("get_spatial_type", &CScriptGameObject::GetSpatialType)

//For Weapons
.def("weapon_addon_attach", &CScriptGameObject::Weapon_AddonAttach)
Expand Down

0 comments on commit 15edbfd

Please sign in to comment.