Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
DamageableGameObj.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE_DAMAGEABLEGAMEOBJ_H
13#define TT_INCLUDE_DAMAGEABLEGAMEOBJ_H
14#include "ScriptableGameObj.h"
15#include "DefenseObjectClass.h"
16#include "DamageableGameObjDef.h"
17class DamageableGameObjDef;
18class DamageableGameObj : public ScriptableGameObj
19{
20public:
21 DamageableGameObj( void );
22 virtual ~DamageableGameObj( void );
23 void Init( const DamageableGameObjDef & definition );
24 void Copy_Settings( const DamageableGameObjDef & definition );
25 void Re_Init( const DamageableGameObjDef & definition );
26 const DamageableGameObjDef SCRIPTS_API & Get_Definition( void ) const ;
27 virtual bool Save( ChunkSaveClass & csave );
28 virtual bool Load( ChunkLoadClass & cload );
29 DefenseObjectClass * Get_Defense_Object( void ) { return &DefenseObject; }
30 virtual void Apply_Damage( const OffenseObjectClass & damager, float scale = 1.0f, int alternate_skin = -1 );
31 virtual void Completely_Damaged( const OffenseObjectClass & damager ) {};
32 const StringClass & Get_Info_Icon_Texture_Filename( void ) { return Get_Definition().InfoIconTextureFilename; }
33 int Get_Translated_Name_ID( void ) const { return Get_Definition().TranslatedNameID; }
34 virtual bool Is_Targetable( void ) const { return !Get_Definition().NotTargetable; }
35 virtual bool Is_Health_Bar_Displayed( void ) const { return IsHealthBarDisplayed; }
36 virtual void Set_Is_Health_Bar_Displayed( bool state ) { IsHealthBarDisplayed = state; }
37 virtual DamageableGameObj *As_DamageableGameObj( void ) { return this; }
38 virtual int Get_Player_Type(void) const {return PlayerType;}
39 virtual void Set_Player_Type(int type);
40 SCRIPTS_API bool Is_Team_Player(void);
41 Vector3 Get_Team_Color(void);
42 SCRIPTS_API bool Is_Teammate(DamageableGameObj * p_obj);
43 SCRIPTS_API bool Is_Enemy(DamageableGameObj * p_obj);
44 virtual void Import_Occasional( BitStreamClass &packet );
45 virtual void Export_Occasional( BitStreamClass &packet );
46 bool Is_Damaged()
47 {
48 return (DefenseObject.Get_Shield_Strength() < DefenseObject.Get_Shield_Strength_Max() || DefenseObject.Get_Health() < DefenseObject.Get_Health_Max());
49 }
50protected:
51 DefenseObjectClass DefenseObject;
52 int PlayerType;
53 bool IsHealthBarDisplayed;
54};
55
56#endif