Nuclide
Software Development Kit for id Tech
NSSurfacePropEntity.h
Go to the documentation of this file.
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
49{
50public:
51 void NSSurfacePropEntity(void);
52
53 /* overrides */
54 virtual void Spawned(void);
55 virtual void SetModel(string);
56
57#ifdef SERVER
58 virtual void Save(float);
59 virtual void Restore(string,string);
60 virtual void Respawn(void);
61 virtual void Input(entity,string,string);
62 virtual void SpawnKey(string,string);
63 virtual void ParentUpdate(void);
64 virtual void EvaluateEntity(void);
65 virtual float SendEntity(entity,float);
66#endif
67
68#ifdef CLIENT
69 virtual float predraw(void);
70 virtual void ReceiveEntity(float,float);
71#endif
72
74 nonvirtual bool IsOnFire(void);
75
76 /* new */
77#ifdef SERVER
79 nonvirtual void Ignite(entity, float, int);
81 nonvirtual void Extinguish(void);
83 virtual void Pain(void);
85 virtual void Death(void);
87 virtual bool IsAlive(void);
88
90 nonvirtual bool CanBleed(void);
92 nonvirtual bool IsVulnerable(void);
93
94 /* Generic Damage */
96 nonvirtual void EnableBleeding(void);
98 nonvirtual void DisableBleeding(void);
100 nonvirtual void EnableAimAssist(void);
102 nonvirtual void DisableAimAssist(void);
104 nonvirtual void MakeVulnerable(void);
106 nonvirtual void MakeInvulnerable(void);
108 nonvirtual void SetTakedamage(float);
110 nonvirtual void SetHealth(float);
112 nonvirtual void SetMaxHealth(float);
114 nonvirtual float GetHealth(void);
116 nonvirtual float GetMaxHealth(void);
117
119 nonvirtual void SetArmor(float);
121 nonvirtual float GetArmor(void);
122
124 nonvirtual float GetSpawnHealth(void);
126 nonvirtual bool HasPropData(void) ;
128 nonvirtual __variant GetPropData(int);
130 nonvirtual bool HasSurfaceData(void);
132 nonvirtual __variant GetSurfaceData(int);
134 nonvirtual void SetSurfaceData(string);
136 nonvirtual void SetPropData(string);
138 nonvirtual float TimeSinceDeath(void);
139
142
144 nonvirtual void SetPainCallback(void(void));
146 nonvirtual void SetDeathCallback(void(void));
148 nonvirtual bool CanBeDamaged(void);
149
151 nonvirtual void SetBloodColor(vector);
153 nonvirtual vector GetBloodColor(void);
154#endif
155
156#ifdef CLIENT
158 virtual void RenderFire(void);
159#endif
160
161 /* misc 'being' methods */
163 nonvirtual vector GetEyePos(void);
165 nonvirtual void SetEyePos(vector);
167 nonvirtual vector GetViewAngle(void);
168
169private:
170 float m_flBurnNext;
171
172 PREDICTED_FLOAT(armor)
174
175#ifdef SERVER
176 /* fire/burning */
177 entity m_eBurner;
178 int m_iBurnWeapon;
179 float m_flBurnTime;
180 float m_flBurnDmgTime; /* for whenever they touch a hot flame */
181
182 /* I/O */
183 string m_strOnBreak;
184
185 /* life, death */
186 float m_oldHealth;
187 vector m_vecBloodColor;
188
189 /* Surface/PropKit */
190 int m_iMaterial;
191 string m_strSurfData;
192 int m_iPropData;
193 string m_strPropData;
194
195 float m_flDeathTime;
196 bool m_bAutoAim;
197 bool m_bTakesDamage;
198
199 nonvirtual void _SurfaceDataFinish(void);
200 nonvirtual void _PropDataFinish(void);
201 nonvirtual void _UpdateTakedamage(void);
202#endif
203};
204
205#ifdef CLIENT
207#endif
noref float health
Definition: NSSurfacePropEntity.h:18
void NSSurfacePropEntity_ReadEntity(bool)
typedef enumflags
Definition: NSSurfacePropEntity.h:22
This entity represents any NSEntity with advanced rendering properties.
Definition: NSRenderableEntity.h:91
This entity represents an NSRenderableEntity with interactive surface properties.
Definition: NSSurfacePropEntity.h:49
virtual void Pain(void)
Called whenever the entity receives damage.
Definition: NSSurfacePropEntity.qc:419
nonvirtual void SetTakedamage(float)
Deprecated: Sets whether the entity can take damage.
Definition: NSSurfacePropEntity.qc:168
virtual void Death(void)
Called when the health is equal or below 0.
Definition: NSSurfacePropEntity.qc:431
nonvirtual void SetPropData(string)
Assigns the prop data of a given description onto this entity.
Definition: NSSurfacePropEntity.qc:475
virtual void RenderFire(void)
Called every frame to render a fire effect, but will only do so if the entity is burning.
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition: NSSurfacePropEntity.qc:303
nonvirtual void DisableAimAssist(void)
Makes the entity invulnerable if it wasn't already.
Definition: NSSurfacePropEntity.qc:127
nonvirtual float GetMaxHealth(void)
Returns the maximum health the entity can have.
Definition: NSSurfacePropEntity.qc:196
virtual void SetModel(string)
Sets the 3D model representation of the entity from a file path and name.
Definition: NSSurfacePropEntity.qc:741
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
Definition: NSSurfacePropEntity.qc:531
void NSSurfacePropEntity(void)
Definition: NSSurfacePropEntity.qc:18
nonvirtual float GetArmor(void)
Returns the current armor of the entity.
Definition: NSSurfacePropEntity.qc:212
nonvirtual float GetHealth(void)
Returns the current health of the entity.
Definition: NSSurfacePropEntity.qc:191
virtual void ParentUpdate(void)
Called when we need to re-align the entity to our parent entity.
Definition: NSSurfacePropEntity.qc:242
nonvirtual void MakeInvulnerable(void)
Makes the entity invulnerable if it wasn't already.
Definition: NSSurfacePropEntity.qc:141
nonvirtual void SetArmor(float)
Sets the current armor of the entity.
Definition: NSSurfacePropEntity.qc:207
nonvirtual bool CanBeDamaged(void)
Returns whether this entity reacts to damage being inflicted.
Definition: NSSurfacePropEntity.qc:525
nonvirtual void SetDeathCallback(void(void))
Sets which function to call upon taking death.
Definition: NSSurfacePropEntity.qc:519
virtual void DamageFeedback(NSSurfacePropEntity, NSSurfacePropEntity, int)
Called when a different entity gets damaged by this entity.
Definition: NSSurfacePropEntity.qc:425
nonvirtual void Extinguish(void)
If the entity is on fire, it'll have it extinguished.
Definition: NSSurfacePropEntity.qc:275
nonvirtual void MakeVulnerable(void)
Makes the entity vulnerable if it wasn't already.
Definition: NSSurfacePropEntity.qc:134
virtual void Respawn(void)
Server: Called when the entity first spawns or when game-logic requests the entity to return to its o...
Definition: NSSurfacePropEntity.qc:284
nonvirtual __variant GetSurfaceData(int)
Returns a variable type of information about the entity's surface data.
Definition: NSSurfacePropEntity.qc:236
virtual bool IsAlive(void)
Returns whether or not the entity is alive.
Definition: NSSurfacePropEntity.qc:96
nonvirtual bool IsOnFire(void)
Returns whether or not this entity is on fire.
Definition: NSSurfacePropEntity.qc:76
nonvirtual vector GetEyePos(void)
Returns the absolute world position of where the eyes are located.
Definition: NSSurfacePropEntity.qc:38
virtual void Spawned(void)
Called when the entity is fulled initialized.
Definition: NSSurfacePropEntity.qc:60
nonvirtual vector GetBloodColor(void)
Returns the blood color of this entity.
Definition: NSSurfacePropEntity.qc:90
nonvirtual __variant GetPropData(int)
Returns a variable type of information about the entity's prop data.
Definition: NSSurfacePropEntity.qc:224
virtual float predraw(void)
nonvirtual void EnableBleeding(void)
Makes the entity vulnerable if it wasn't already.
Definition: NSSurfacePropEntity.qc:108
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
Definition: NSSurfacePropEntity.qc:578
nonvirtual bool CanBleed(void)
Returns whether the entity can bleed.
Definition: NSSurfacePropEntity.qc:162
nonvirtual void SetSurfaceData(string)
Assigns the surface data of a given description onto this entity.
Definition: NSSurfacePropEntity.qc:468
nonvirtual bool IsVulnerable(void)
Returns whether the entity can be damaged.
Definition: NSSurfacePropEntity.qc:102
nonvirtual vector GetViewAngle(void)
Returns an euler angle of where the entity is 'looking' at.
Definition: NSSurfacePropEntity.qc:48
nonvirtual void Ignite(entity, float, int)
Sets the entity on fire.
Definition: NSSurfacePropEntity.qc:261
nonvirtual void SetMaxHealth(float)
Sets the maximum amount of health the entity can have.
Definition: NSSurfacePropEntity.qc:183
nonvirtual void DisableBleeding(void)
Makes the entity invulnerable if it wasn't already.
Definition: NSSurfacePropEntity.qc:114
nonvirtual float TimeSinceDeath(void)
Returns how many seconds have passed since we died.
Definition: NSSurfacePropEntity.qc:504
nonvirtual void SetEyePos(vector)
Sets the relative position of the eyes.
Definition: NSSurfacePropEntity.qc:54
nonvirtual bool HasSurfaceData(void)
Returns if the entity has surface data information set.
Definition: NSSurfacePropEntity.qc:230
nonvirtual float GetSpawnHealth(void)
Returns the health the entity spawned with at map load.
Definition: NSSurfacePropEntity.qc:201
nonvirtual void SetHealth(float)
Sets the current health of the entity.
Definition: NSSurfacePropEntity.qc:174
nonvirtual bool HasPropData(void)
Returns if the entity has prop data information set.
Definition: NSSurfacePropEntity.qc:218
virtual void Restore(string, string)
Similar to ::SpawnKey but for save-game fields.
Definition: NSSurfacePropEntity.qc:322
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition: NSSurfacePropEntity.qc:389
nonvirtual void SetBloodColor(vector)
Sets the colour of the blood of this entity.
Definition: NSSurfacePropEntity.qc:84
nonvirtual void EnableAimAssist(void)
Makes the entity vulnerable if it wasn't already.
Definition: NSSurfacePropEntity.qc:120
nonvirtual void SetPainCallback(void(void))
Sets which function to call upon taking pain.
Definition: NSSurfacePropEntity.qc:513
virtual void Input(entity, string, string)
Called when we are being prompted by another object/function with an input message.
Definition: NSSurfacePropEntity.qc:370
__variant(float table, string name, optional __variant deflt, optional float requiretype, optional float index) hash_get
vector(vector) normalize
entity() spawn
#define PREDICTED_FLOAT_N(x)
Definition: defs.h:38
#define PREDICTED_FLOAT(x)
Definition: defs.h:31