Skip to content

Commit 565b39e

Browse files
avoitishinXottab-DUTY
authored andcommitted
+ exported is_* (is_stalker, etc.) methods
+ exported additional methods for ini_file class to allow writing * changed w_vector2 and w vector to w_fvector2 and w_fvector3
1 parent f32213b commit 565b39e

File tree

6 files changed

+547
-5
lines changed

6 files changed

+547
-5
lines changed

src/xrGame/script_game_object.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,46 @@ class CScriptGameObject
779779
bool is_door_blocked_by_npc() const;
780780
bool is_weapon_going_to_be_strapped(CScriptGameObject const* object) const;
781781

782+
//AVO: functions for object testing
783+
bool isGameObject() const;
784+
//bool isCar() const;
785+
bool isHeli() const;
786+
//bool isHolderCustom() const;
787+
bool isEntityAlive() const;
788+
bool isInventoryItem() const;
789+
bool isInventoryOwner() const;
790+
bool isActor() const;
791+
bool isCustomMonster() const;
792+
bool isWeapon() const;
793+
bool isMedkit() const;
794+
bool isEatableItem() const;
795+
bool isAntirad() const;
796+
bool isCustomOutfit() const;
797+
bool isScope() const;
798+
bool isSilencer() const;
799+
bool isGrenadeLauncher() const;
800+
bool isWeaponMagazined() const;
801+
bool isSpaceRestrictor() const;
802+
bool isStalker() const;
803+
bool isAnomaly() const;
804+
bool isMonster() const;
805+
bool isExplosive() const;
806+
bool isScriptZone() const;
807+
bool isProjector() const;
808+
bool isTrader() const;
809+
bool isHudItem() const;
810+
bool isFoodItem() const;
811+
bool isArtefact() const;
812+
bool isAmmo() const;
813+
bool isMissile() const;
814+
bool isPhysicsShellHolder() const;
815+
bool isGrenade() const;
816+
bool isBottleItem() const;
817+
bool isTorch() const;
818+
bool isWeaponGL() const;
819+
bool isInventoryBox() const;
820+
//end AVO
821+
782822
doors::door* m_door;
783823
};
784824

src/xrGame/script_game_object4.cpp

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,299 @@ void CScriptGameObject::stop_particles(LPCSTR pname, LPCSTR bone)
367367
ai().script_engine().script_log(
368368
LuaMessageType::Error, "Cant stop particles, bone [%s] is not visible now", bone);
369369
}
370+
371+
// AVO: functions for testing object class
372+
// Credits: KD
373+
//#include "Car.h"
374+
#include "helicopter.h"
375+
#include "Actor.h"
376+
#include "CustomOutfit.h"
377+
//#include "CustomZone.h"
378+
#include "ai\Monsters\BaseMonster\base_monster.h"
379+
#include "medkit.h"
380+
#include "antirad.h"
381+
#include "Scope.h"
382+
#include "Silencer.h"
383+
#include "Torch.h"
384+
#include "GrenadeLauncher.h"
385+
#include "searchlight.h"
386+
//#include "WeaponAmmo.h"
387+
#include "Grenade.h"
388+
#include "BottleItem.h"
389+
#include "WeaponMagazinedWGrenade.h"
390+
391+
// Xottab_DUTY: commented this macro, because of substituting it
392+
/*
393+
#define TEST_OBJECT_CLASS(A, B)\
394+
bool A() const\
395+
{\
396+
auto l_tpEntity = smart_cast<B*>(&object());\
397+
if (!l_tpEntity)\
398+
return false;\
399+
return true;\
400+
}\
401+
*/
402+
403+
bool CScriptGameObject::isGameObject() const
404+
{
405+
auto l_tpEntity = smart_cast<CGameObject*>(&object());
406+
if (!l_tpEntity) return false;
407+
return true;
408+
}
409+
410+
/*
411+
bool CScriptGameObject::isCar() const
412+
{
413+
auto l_tpEntity = smart_cast<CCar*>(&object());
414+
if (!l_tpEntity) return false;
415+
return true;
416+
}
417+
*/
418+
419+
bool CScriptGameObject::isHeli() const
420+
{
421+
auto l_tpEntity = smart_cast<CHelicopter*>(&object());
422+
if (!l_tpEntity) return false;
423+
return true;
424+
}
425+
426+
/*
427+
bool CScriptGameObject::isHolderCustom() const
428+
{
429+
auto l_tpEntity = smart_cast<CHolderCustom*>(&object());
430+
if (!l_tpEntity) return false;
431+
return true;
432+
}
433+
*/
434+
435+
bool CScriptGameObject::isEntityAlive() const
436+
{
437+
auto l_tpEntity = smart_cast<CEntityAlive*>(&object());
438+
if (!l_tpEntity) return false;
439+
return true;
440+
}
441+
442+
bool CScriptGameObject::isInventoryItem() const
443+
{
444+
auto l_tpEntity = smart_cast<CInventoryItem*>(&object());
445+
if (!l_tpEntity) return false;
446+
return true;
447+
}
448+
449+
bool CScriptGameObject::isInventoryOwner() const
450+
{
451+
auto l_tpEntity = smart_cast<CInventoryOwner*>(&object());
452+
if (!l_tpEntity) return false;
453+
return true;
454+
}
455+
456+
bool CScriptGameObject::isActor() const
457+
{
458+
auto l_tpEntity = smart_cast<CActor*>(&object());
459+
if (!l_tpEntity) return false;
460+
return true;
461+
}
462+
463+
bool CScriptGameObject::isCustomMonster() const
464+
{
465+
auto l_tpEntity = smart_cast<CCustomMonster*>(&object());
466+
if (!l_tpEntity) return false;
467+
return true;
468+
}
469+
470+
bool CScriptGameObject::isWeapon() const
471+
{
472+
auto l_tpEntity = smart_cast<CWeapon*>(&object());
473+
if (!l_tpEntity) return false;
474+
return true;
475+
}
476+
477+
bool CScriptGameObject::isMedkit() const
478+
{
479+
auto l_tpEntity = smart_cast<CMedkit*>(&object());
480+
if (!l_tpEntity) return false;
481+
return true;
482+
}
483+
484+
bool CScriptGameObject::isEatableItem() const
485+
{
486+
auto l_tpEntity = smart_cast<CEatableItem*>(&object());
487+
if (!l_tpEntity) return false;
488+
return true;
489+
}
490+
491+
bool CScriptGameObject::isAntirad() const
492+
{
493+
auto l_tpEntity = smart_cast<CAntirad*>(&object());
494+
if (!l_tpEntity) return false;
495+
return true;
496+
}
497+
498+
bool CScriptGameObject::isCustomOutfit() const
499+
{
500+
auto l_tpEntity = smart_cast<CCustomOutfit*>(&object());
501+
if (!l_tpEntity) return false;
502+
return true;
503+
}
504+
505+
bool CScriptGameObject::isScope() const
506+
{
507+
auto l_tpEntity = smart_cast<CScope*>(&object());
508+
if (!l_tpEntity) return false;
509+
return true;
510+
}
511+
512+
bool CScriptGameObject::isSilencer() const
513+
{
514+
auto l_tpEntity = smart_cast<CSilencer*>(&object());
515+
if (!l_tpEntity) return false;
516+
return true;
517+
}
518+
519+
bool CScriptGameObject::isGrenadeLauncher() const
520+
{
521+
auto l_tpEntity = smart_cast<CGrenadeLauncher*>(&object());
522+
if (!l_tpEntity) return false;
523+
return true;
524+
}
525+
526+
bool CScriptGameObject::isWeaponMagazined() const
527+
{
528+
auto l_tpEntity = smart_cast<CWeaponMagazined*>(&object());
529+
if (!l_tpEntity) return false;
530+
return true;
531+
}
532+
533+
bool CScriptGameObject::isSpaceRestrictor() const
534+
{
535+
auto l_tpEntity = smart_cast<CSpaceRestrictor*>(&object());
536+
if (!l_tpEntity) return false;
537+
return true;
538+
}
539+
540+
bool CScriptGameObject::isStalker() const
541+
{
542+
auto l_tpEntity = smart_cast<CAI_Stalker*>(&object());
543+
if (!l_tpEntity) return false;
544+
return true;
545+
}
546+
547+
bool CScriptGameObject::isAnomaly() const
548+
{
549+
auto l_tpEntity = smart_cast<CCustomZone*>(&object());
550+
if (!l_tpEntity) return false;
551+
return true;
552+
}
553+
554+
bool CScriptGameObject::isMonster() const
555+
{
556+
auto l_tpEntity = smart_cast<CBaseMonster*>(&object());
557+
if (!l_tpEntity) return false;
558+
return true;
559+
}
560+
561+
bool CScriptGameObject::isExplosive() const
562+
{
563+
auto l_tpEntity = smart_cast<CExplosive*>(&object());
564+
if (!l_tpEntity) return false;
565+
return true;
566+
}
567+
568+
bool CScriptGameObject::isScriptZone() const
569+
{
570+
auto l_tpEntity = smart_cast<CScriptZone*>(&object());
571+
if (!l_tpEntity) return false;
572+
return true;
573+
}
574+
575+
bool CScriptGameObject::isProjector() const
576+
{
577+
auto l_tpEntity = smart_cast<CProjector*>(&object());
578+
if (!l_tpEntity) return false;
579+
return true;
580+
}
581+
582+
bool CScriptGameObject::isTrader() const
583+
{
584+
auto l_tpEntity = smart_cast<CAI_Trader*>(&object());
585+
if (!l_tpEntity) return false;
586+
return true;
587+
}
588+
589+
bool CScriptGameObject::isHudItem() const
590+
{
591+
auto l_tpEntity = smart_cast<CHudItem*>(&object());
592+
if (!l_tpEntity) return false;
593+
return true;
594+
}
595+
596+
bool CScriptGameObject::isFoodItem() const
597+
{
598+
auto l_tpEntity = smart_cast<CFoodItem*>(&object());
599+
if (!l_tpEntity) return false;
600+
return true;
601+
}
602+
603+
bool CScriptGameObject::isArtefact() const
604+
{
605+
auto l_tpEntity = smart_cast<CArtefact*>(&object());
606+
if (!l_tpEntity) return false;
607+
return true;
608+
}
609+
610+
bool CScriptGameObject::isAmmo() const
611+
{
612+
auto l_tpEntity = smart_cast<CWeaponAmmo*>(&object());
613+
if (!l_tpEntity) return false;
614+
return true;
615+
}
616+
617+
bool CScriptGameObject::isMissile() const
618+
{
619+
auto l_tpEntity = smart_cast<CMissile*>(&object());
620+
if (!l_tpEntity) return false;
621+
return true;
622+
}
623+
624+
bool CScriptGameObject::isPhysicsShellHolder() const
625+
{
626+
auto l_tpEntity = smart_cast<CPhysicsShellHolder*>(&object());
627+
if (!l_tpEntity) return false;
628+
return true;
629+
}
630+
631+
bool CScriptGameObject::isGrenade() const
632+
{
633+
auto l_tpEntity = smart_cast<CGrenade*>(&object());
634+
if (!l_tpEntity) return false;
635+
return true;
636+
}
637+
638+
bool CScriptGameObject::isBottleItem() const
639+
{
640+
auto l_tpEntity = smart_cast<CBottleItem*>(&object());
641+
if (!l_tpEntity) return false;
642+
return true;
643+
}
644+
645+
bool CScriptGameObject::isTorch() const
646+
{
647+
auto l_tpEntity = smart_cast<CTorch*>(&object());
648+
if (!l_tpEntity) return false;
649+
return true;
650+
}
651+
652+
bool CScriptGameObject::isWeaponGL() const
653+
{
654+
auto l_tpEntity = smart_cast<CWeaponMagazinedWGrenade*>(&object());
655+
if (!l_tpEntity) return false;
656+
return true;
657+
}
658+
659+
bool CScriptGameObject::isInventoryBox() const
660+
{
661+
auto l_tpEntity = smart_cast<CInventoryBox*>(&object());
662+
if (!l_tpEntity) return false;
663+
return true;
664+
}
665+
//end AVO

src/xrGame/script_game_object_script3.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,46 @@ class_<CScriptGameObject>& script_register_game_object2(class_<CScriptGameObject
341341
.def("start_particles", &CScriptGameObject::start_particles)
342342
.def("stop_particles", &CScriptGameObject::stop_particles)
343343

344+
//AVO: functions for object testing
345+
.def("is_game_object", &CScriptGameObject::isGameObject)
346+
//.def("is_car", &CScriptGameObject::isCar)
347+
.def("is_helicopter", &CScriptGameObject::isHeli)
348+
//.def("is_holder", &CScriptGameObject::isHolderCustom)
349+
.def("is_entity_alive", &CScriptGameObject::isEntityAlive)
350+
.def("is_inventory_item", &CScriptGameObject::isInventoryItem)
351+
.def("is_inventory_owner", &CScriptGameObject::isInventoryOwner)
352+
.def("is_actor", &CScriptGameObject::isActor)
353+
.def("is_custom_monster", &CScriptGameObject::isCustomMonster)
354+
.def("is_weapon", &CScriptGameObject::isWeapon)
355+
.def("is_medkit", &CScriptGameObject::isMedkit)
356+
.def("is_eatable_item", &CScriptGameObject::isEatableItem)
357+
.def("is_antirad", &CScriptGameObject::isAntirad)
358+
.def("is_outfit", &CScriptGameObject::isCustomOutfit)
359+
.def("is_scope", &CScriptGameObject::isScope)
360+
.def("is_silencer", &CScriptGameObject::isSilencer)
361+
.def("is_grenade_launcher", &CScriptGameObject::isGrenadeLauncher)
362+
.def("is_weapon_magazined", &CScriptGameObject::isWeaponMagazined)
363+
.def("is_space_restrictor", &CScriptGameObject::isSpaceRestrictor)
364+
.def("is_stalker", &CScriptGameObject::isStalker)
365+
.def("is_anomaly", &CScriptGameObject::isAnomaly)
366+
.def("is_monster", &CScriptGameObject::isMonster)
367+
.def("is_explosive", &CScriptGameObject::isExplosive)
368+
.def("is_script_zone", &CScriptGameObject::isScriptZone)
369+
.def("is_projector", &CScriptGameObject::isProjector)
370+
.def("is_trader", &CScriptGameObject::isTrader)
371+
.def("is_hud_item", &CScriptGameObject::isHudItem)
372+
.def("is_food_item", &CScriptGameObject::isFoodItem)
373+
.def("is_artefact", &CScriptGameObject::isArtefact)
374+
.def("is_ammo", &CScriptGameObject::isAmmo)
375+
.def("is_missile", &CScriptGameObject::isMissile)
376+
.def("is_physics_shell_holder", &CScriptGameObject::isPhysicsShellHolder)
377+
.def("is_grenade", &CScriptGameObject::isGrenade)
378+
.def("is_bottle_item", &CScriptGameObject::isBottleItem)
379+
.def("is_torch", &CScriptGameObject::isTorch)
380+
.def("is_weapon_gl", &CScriptGameObject::isWeaponGL)
381+
.def("is_inventory_box", &CScriptGameObject::isInventoryBox)
382+
//end AVO
383+
344384
;
345385
return (instance);
346386
}

0 commit comments

Comments
 (0)