Skip to content

Commit

Permalink
+ exported is_* (is_stalker, etc.) methods
Browse files Browse the repository at this point in the history
+ exported additional methods for ini_file class to allow writing
* changed w_vector2 and w vector to w_fvector2 and w_fvector3
  • Loading branch information
avoitishin authored and Xottab-DUTY committed Aug 15, 2017
1 parent f32213b commit 565b39e
Show file tree
Hide file tree
Showing 6 changed files with 547 additions and 5 deletions.
40 changes: 40 additions & 0 deletions src/xrGame/script_game_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,46 @@ class CScriptGameObject
bool is_door_blocked_by_npc() const;
bool is_weapon_going_to_be_strapped(CScriptGameObject const* object) const;

//AVO: functions for object testing
bool isGameObject() const;
//bool isCar() const;
bool isHeli() const;
//bool isHolderCustom() const;
bool isEntityAlive() const;
bool isInventoryItem() const;
bool isInventoryOwner() const;
bool isActor() const;
bool isCustomMonster() const;
bool isWeapon() const;
bool isMedkit() const;
bool isEatableItem() const;
bool isAntirad() const;
bool isCustomOutfit() const;
bool isScope() const;
bool isSilencer() const;
bool isGrenadeLauncher() const;
bool isWeaponMagazined() const;
bool isSpaceRestrictor() const;
bool isStalker() const;
bool isAnomaly() const;
bool isMonster() const;
bool isExplosive() const;
bool isScriptZone() const;
bool isProjector() const;
bool isTrader() const;
bool isHudItem() const;
bool isFoodItem() const;
bool isArtefact() const;
bool isAmmo() const;
bool isMissile() const;
bool isPhysicsShellHolder() const;
bool isGrenade() const;
bool isBottleItem() const;
bool isTorch() const;
bool isWeaponGL() const;
bool isInventoryBox() const;
//end AVO

doors::door* m_door;
};

Expand Down
296 changes: 296 additions & 0 deletions src/xrGame/script_game_object4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,299 @@ void CScriptGameObject::stop_particles(LPCSTR pname, LPCSTR bone)
ai().script_engine().script_log(
LuaMessageType::Error, "Cant stop particles, bone [%s] is not visible now", bone);
}

// AVO: functions for testing object class
// Credits: KD
//#include "Car.h"
#include "helicopter.h"
#include "Actor.h"
#include "CustomOutfit.h"
//#include "CustomZone.h"
#include "ai\Monsters\BaseMonster\base_monster.h"
#include "medkit.h"
#include "antirad.h"
#include "Scope.h"
#include "Silencer.h"
#include "Torch.h"
#include "GrenadeLauncher.h"
#include "searchlight.h"
//#include "WeaponAmmo.h"
#include "Grenade.h"
#include "BottleItem.h"
#include "WeaponMagazinedWGrenade.h"

// Xottab_DUTY: commented this macro, because of substituting it
/*
#define TEST_OBJECT_CLASS(A, B)\
bool A() const\
{\
auto l_tpEntity = smart_cast<B*>(&object());\
if (!l_tpEntity)\
return false;\
return true;\
}\
*/

bool CScriptGameObject::isGameObject() const
{
auto l_tpEntity = smart_cast<CGameObject*>(&object());
if (!l_tpEntity) return false;
return true;
}

/*
bool CScriptGameObject::isCar() const
{
auto l_tpEntity = smart_cast<CCar*>(&object());
if (!l_tpEntity) return false;
return true;
}
*/

bool CScriptGameObject::isHeli() const
{
auto l_tpEntity = smart_cast<CHelicopter*>(&object());
if (!l_tpEntity) return false;
return true;
}

/*
bool CScriptGameObject::isHolderCustom() const
{
auto l_tpEntity = smart_cast<CHolderCustom*>(&object());
if (!l_tpEntity) return false;
return true;
}
*/

bool CScriptGameObject::isEntityAlive() const
{
auto l_tpEntity = smart_cast<CEntityAlive*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isInventoryItem() const
{
auto l_tpEntity = smart_cast<CInventoryItem*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isInventoryOwner() const
{
auto l_tpEntity = smart_cast<CInventoryOwner*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isActor() const
{
auto l_tpEntity = smart_cast<CActor*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isCustomMonster() const
{
auto l_tpEntity = smart_cast<CCustomMonster*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isWeapon() const
{
auto l_tpEntity = smart_cast<CWeapon*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isMedkit() const
{
auto l_tpEntity = smart_cast<CMedkit*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isEatableItem() const
{
auto l_tpEntity = smart_cast<CEatableItem*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isAntirad() const
{
auto l_tpEntity = smart_cast<CAntirad*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isCustomOutfit() const
{
auto l_tpEntity = smart_cast<CCustomOutfit*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isScope() const
{
auto l_tpEntity = smart_cast<CScope*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isSilencer() const
{
auto l_tpEntity = smart_cast<CSilencer*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isGrenadeLauncher() const
{
auto l_tpEntity = smart_cast<CGrenadeLauncher*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isWeaponMagazined() const
{
auto l_tpEntity = smart_cast<CWeaponMagazined*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isSpaceRestrictor() const
{
auto l_tpEntity = smart_cast<CSpaceRestrictor*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isStalker() const
{
auto l_tpEntity = smart_cast<CAI_Stalker*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isAnomaly() const
{
auto l_tpEntity = smart_cast<CCustomZone*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isMonster() const
{
auto l_tpEntity = smart_cast<CBaseMonster*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isExplosive() const
{
auto l_tpEntity = smart_cast<CExplosive*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isScriptZone() const
{
auto l_tpEntity = smart_cast<CScriptZone*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isProjector() const
{
auto l_tpEntity = smart_cast<CProjector*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isTrader() const
{
auto l_tpEntity = smart_cast<CAI_Trader*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isHudItem() const
{
auto l_tpEntity = smart_cast<CHudItem*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isFoodItem() const
{
auto l_tpEntity = smart_cast<CFoodItem*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isArtefact() const
{
auto l_tpEntity = smart_cast<CArtefact*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isAmmo() const
{
auto l_tpEntity = smart_cast<CWeaponAmmo*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isMissile() const
{
auto l_tpEntity = smart_cast<CMissile*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isPhysicsShellHolder() const
{
auto l_tpEntity = smart_cast<CPhysicsShellHolder*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isGrenade() const
{
auto l_tpEntity = smart_cast<CGrenade*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isBottleItem() const
{
auto l_tpEntity = smart_cast<CBottleItem*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isTorch() const
{
auto l_tpEntity = smart_cast<CTorch*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isWeaponGL() const
{
auto l_tpEntity = smart_cast<CWeaponMagazinedWGrenade*>(&object());
if (!l_tpEntity) return false;
return true;
}

bool CScriptGameObject::isInventoryBox() const
{
auto l_tpEntity = smart_cast<CInventoryBox*>(&object());
if (!l_tpEntity) return false;
return true;
}
//end AVO
40 changes: 40 additions & 0 deletions src/xrGame/script_game_object_script3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,46 @@ class_<CScriptGameObject>& script_register_game_object2(class_<CScriptGameObject
.def("start_particles", &CScriptGameObject::start_particles)
.def("stop_particles", &CScriptGameObject::stop_particles)

//AVO: functions for object testing
.def("is_game_object", &CScriptGameObject::isGameObject)
//.def("is_car", &CScriptGameObject::isCar)
.def("is_helicopter", &CScriptGameObject::isHeli)
//.def("is_holder", &CScriptGameObject::isHolderCustom)
.def("is_entity_alive", &CScriptGameObject::isEntityAlive)
.def("is_inventory_item", &CScriptGameObject::isInventoryItem)
.def("is_inventory_owner", &CScriptGameObject::isInventoryOwner)
.def("is_actor", &CScriptGameObject::isActor)
.def("is_custom_monster", &CScriptGameObject::isCustomMonster)
.def("is_weapon", &CScriptGameObject::isWeapon)
.def("is_medkit", &CScriptGameObject::isMedkit)
.def("is_eatable_item", &CScriptGameObject::isEatableItem)
.def("is_antirad", &CScriptGameObject::isAntirad)
.def("is_outfit", &CScriptGameObject::isCustomOutfit)
.def("is_scope", &CScriptGameObject::isScope)
.def("is_silencer", &CScriptGameObject::isSilencer)
.def("is_grenade_launcher", &CScriptGameObject::isGrenadeLauncher)
.def("is_weapon_magazined", &CScriptGameObject::isWeaponMagazined)
.def("is_space_restrictor", &CScriptGameObject::isSpaceRestrictor)
.def("is_stalker", &CScriptGameObject::isStalker)
.def("is_anomaly", &CScriptGameObject::isAnomaly)
.def("is_monster", &CScriptGameObject::isMonster)
.def("is_explosive", &CScriptGameObject::isExplosive)
.def("is_script_zone", &CScriptGameObject::isScriptZone)
.def("is_projector", &CScriptGameObject::isProjector)
.def("is_trader", &CScriptGameObject::isTrader)
.def("is_hud_item", &CScriptGameObject::isHudItem)
.def("is_food_item", &CScriptGameObject::isFoodItem)
.def("is_artefact", &CScriptGameObject::isArtefact)
.def("is_ammo", &CScriptGameObject::isAmmo)
.def("is_missile", &CScriptGameObject::isMissile)
.def("is_physics_shell_holder", &CScriptGameObject::isPhysicsShellHolder)
.def("is_grenade", &CScriptGameObject::isGrenade)
.def("is_bottle_item", &CScriptGameObject::isBottleItem)
.def("is_torch", &CScriptGameObject::isTorch)
.def("is_weapon_gl", &CScriptGameObject::isWeaponGL)
.def("is_inventory_box", &CScriptGameObject::isInventoryBox)
//end AVO

;
return (instance);
}
Loading

0 comments on commit 565b39e

Please sign in to comment.