Nuclide
Software Development Kit for id Technology (BETA)
SurfacePropEntity.h
1/*
2 * Copyright (c) 2016-2024 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
17#ifdef CLIENT
18noref .float health;
19#endif
20
21typedef enumflags
22{
23 SRFENT_CHANGED_ORIGIN_X,
24 SRFENT_CHANGED_ORIGIN_Y,
25 SRFENT_CHANGED_ORIGIN_Z,
26 SRFENT_CHANGED_ANGLES_X,
27 SRFENT_CHANGED_ANGLES_Y,
28 SRFENT_CHANGED_ANGLES_Z,
29 SRFENT_CHANGED_MODELINDEX,
30 SRFENT_CHANGED_SIZE,
31 SRFENT_CHANGED_FLAGS,
32 SRFENT_CHANGED_SOLIDMOVETYPE,
33 SRFENT_CHANGED_FRAME,
34 SRFENT_CHANGED_SKIN,
35 SRFENT_CHANGED_EFFECTS,
36 SRFENT_CHANGED_BODY,
37 SRFENT_CHANGED_SCALE,
38 SRFENT_CHANGED_VELOCITY,
39 SRFENT_CHANGED_ANGULARVELOCITY,
40 SRFENT_CHANGED_RENDERCOLOR,
41 SRFENT_CHANGED_RENDERAMT,
42 SRFENT_CHANGED_RENDERMODE,
43 SRFENT_CHANGED_CONTROLLER
44} nssurfacepropentity_changed_t;
45
46
47
69class
71{
72public:
73 void ncSurfacePropEntity(void);
74
75 /* overrides */
76 virtual void Spawned(void);
77 virtual void SetModel(string);
78
79#ifdef SERVER
80 virtual void Save(float);
81 virtual void Restore(string,string);
82 virtual void RestoreComplete(void);
83 virtual void Respawn(void);
84 virtual void Input(entity,string,string);
85 virtual void SpawnKey(string,string);
86 virtual void ParentUpdate(void);
87 virtual void EvaluateEntity(void);
88 virtual float SendEntity(entity,float);
89#endif
90
91#ifdef CLIENT
92 virtual float predraw(void);
93 virtual void ReceiveEntity(float,float);
94#endif
95
97 nonvirtual bool IsOnFire(void);
98
99 /* new */
100#ifdef SERVER
102 virtual void Damage(entity, entity, ncDict, float, vector, vector);
104 virtual void DamageFeedback(entity, entity, int);
106 virtual void Pain(entity, entity, int, vector, vector, int);
108 virtual void Death(entity, entity, int, vector, vector, int);
110 virtual void BreakModel(int, vector, int);
112 virtual bool IsAlive(void);
113
115 nonvirtual void Ignite(entity, float, string);
117 nonvirtual void Extinguish(void);
118
120 nonvirtual bool IsVulnerable(void);
121
122 /* Generic Damage */
124 nonvirtual void EnableAimAssist(void);
126 nonvirtual void DisableAimAssist(void);
128 nonvirtual void MakeVulnerable(void);
130 nonvirtual void MakeInvulnerable(void);
132 nonvirtual void SetHealth(float);
134 nonvirtual void SetMaxHealth(float);
136 nonvirtual float GetHealth(void);
138 nonvirtual float GetMaxHealth(void);
140 nonvirtual void AddBonusHealth(float);
142 nonvirtual float GetBonusHealth(void);
144 nonvirtual void AddBonusArmor(float);
146 nonvirtual float GetBonusArmor(void);
147
149 nonvirtual void SetArmor(float);
151 nonvirtual float GetArmor(void);
152
154 nonvirtual void SetMaxArmor(float);
156 nonvirtual float GetMaxArmor(void);
157
159 nonvirtual float TimeSinceDeath(void);
160
162 nonvirtual bool CanBeDamaged(vector,vector);
163#endif
164
166 nonvirtual void SetSurfaceData(string);
168 nonvirtual void SetPropData(string);
170 nonvirtual bool HasPropData(void) ;
172 nonvirtual __variant GetPropData(int);
174 nonvirtual bool HasSurfaceData(void);
176 nonvirtual __variant GetSurfaceData(int);
177
178#ifdef CLIENT
180 virtual void RenderFire(void);
181#endif
182
183private:
184 nonvirtual void _SurfaceDataFinish(void);
185 nonvirtual void _PropDataFinish(void);
186
187 float m_timeUntilNextBurnDamage;
188
189 NETWORKED_FLOAT(armor)
190 NETWORKED_FLOAT_N(health)
191
192 /* Surface/PropKit */
193 int m_surfdataID;
194 string m_surfData;
195 int m_propdataID;
196 string m_propData;
197
198#ifdef SERVER
199 nonvirtual void _UpdateTakedamage(void);
200
201 float m_bonusHealth;
202 float m_timeUntilBonusHealthDecreases;
203 float m_bonusArmor;
204 float m_timeUntilBonusArmorDecreases;
205 float max_armor;
206 float m_timeOfDeath;
207 bool m_autoAim;
208 bool m_vulnerable;
209
210 /* fire/burning */
211 entity m_burningAttacker;
212 string m_burningWeapon;
213 float m_timeUntilBurningStops;
214 float m_timeUntilNextBurnDamage; /* for whenever they touch a hot flame */
215
216 /* I/O */
217 string m_outputOnDamaged;
218 string m_outputOnDamagedByPlayer;
219 string m_outputOnHalfHealth;
220 string m_outputOnDeath;
221 string m_outputOnBreak;
222
223#endif
224};
225
226#ifdef CLIENT
227void ncSurfacePropEntity_ReadEntity(bool);
228#endif
This class is responsible for handling groups of key/value pairs.
Definition: Dict.h:35
This entity represents any ncEntity with advanced rendering properties.
Definition: RenderableEntity.h:95
This entity represents an ncRenderableEntity with interactive surface properties.
Definition: SurfacePropEntity.h:71
virtual void RenderFire(void)
Called every frame to render a fire effect, but will only do so if the entity is burning.
virtual float predraw(void)
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37