@@ -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
0 commit comments