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
52{
53public:
54 void NSSurfacePropEntity(void);
55
56 /* overrides */
57 virtual void Spawned(void);
58 virtual void SetModel(string);
59
60#ifdef SERVER
61 virtual void Save(float);
62 virtual void Restore(string,string);
63 virtual void Respawn(void);
64 virtual void Input(entity,string,string);
65 virtual void SpawnKey(string,string);
66 virtual void ParentUpdate(void);
67 virtual void EvaluateEntity(void);
68 virtual float SendEntity(entity,float);
69#endif
70
71#ifdef CLIENT
72 virtual float predraw(void);
73 virtual void ReceiveEntity(float,float);
74#endif
75
77 nonvirtual bool IsOnFire(void);
78
79 /* new */
80#ifdef SERVER
82 virtual void Damage(entity, entity, NSDict, float, vector, vector);
84 virtual void DamageFeedback(entity, entity, int);
86 virtual void Pain(entity, entity, int, vector, int);
88 virtual void Death(entity, entity, int, vector, int);
90 virtual void BreakModel(int, vector, int);
92 virtual bool IsAlive(void);
93
95 nonvirtual void Ignite(entity, float, int);
97 nonvirtual void Extinguish(void);
98
100 nonvirtual bool CanBleed(void);
102 nonvirtual bool IsVulnerable(void);
103
104 /* Generic Damage */
106 nonvirtual void EnableBleeding(void);
108 nonvirtual void DisableBleeding(void);
110 nonvirtual void EnableAimAssist(void);
112 nonvirtual void DisableAimAssist(void);
114 nonvirtual void MakeVulnerable(void);
116 nonvirtual void MakeInvulnerable(void);
118 nonvirtual void SetTakedamage(float);
120 nonvirtual void SetHealth(float);
122 nonvirtual void SetMaxHealth(float);
124 nonvirtual float GetHealth(void);
126 nonvirtual float GetMaxHealth(void);
127
129 nonvirtual void SetArmor(float);
131 nonvirtual float GetArmor(void);
132
134 nonvirtual float GetSpawnHealth(void);
136 nonvirtual bool HasPropData(void) ;
138 nonvirtual __variant GetPropData(int);
140 nonvirtual bool HasSurfaceData(void);
142 nonvirtual __variant GetSurfaceData(int);
144 nonvirtual void SetSurfaceData(string);
146 nonvirtual void SetPropData(string);
148 nonvirtual float TimeSinceDeath(void);
149
151 nonvirtual bool CanBeDamaged(vector,vector);
152
154 nonvirtual void SetBloodColor(vector);
156 nonvirtual vector GetBloodColor(void);
157#endif
158
159#ifdef CLIENT
161 virtual void RenderFire(void);
162#endif
163
164private:
165 float m_flBurnNext;
166
167 PREDICTED_FLOAT(armor)
169
170#ifdef SERVER
171 /* fire/burning */
172 entity m_eBurner;
173 int m_iBurnWeapon;
174 float m_flBurnTime;
175 float m_flBurnDmgTime; /* for whenever they touch a hot flame */
176
177 /* I/O */
178 string m_strOnBreak;
179
180 /* life, death */
181 float m_oldHealth;
182 vector m_vecBloodColor;
183
184 /* Surface/PropKit */
185 int m_iMaterial;
186 string m_strSurfData;
187 int m_iPropData;
188 string m_strPropData;
189
190 float m_flDeathTime;
191 bool m_bAutoAim;
192 bool m_bTakesDamage;
193
194 nonvirtual void _SurfaceDataFinish(void);
195 nonvirtual void _PropDataFinish(void);
196 nonvirtual void _UpdateTakedamage(void);
197#endif
198};
199
200#ifdef CLIENT
202#endif
203
204void entityDamage(entity, entity, entity, string, string, vector, vector, vector);
205void radiusDamage(vector, float, int, int, entity);
noref float health
Definition: NSSurfacePropEntity.h:18
void NSSurfacePropEntity_ReadEntity(bool)
typedef enumflags
Definition: NSSurfacePropEntity.h:22
Definition: NSDict.h:19
This entity represents any NSEntity with advanced rendering properties.
Definition: NSRenderableEntity.h:94
This entity represents an NSRenderableEntity with interactive surface properties.
Definition: NSSurfacePropEntity.h:52
virtual void BreakModel(int, vector, int)
Called when the health is equal or below 0.
Definition: NSSurfacePropEntity.qc:502
nonvirtual void SetTakedamage(float)
Deprecated: Sets whether the entity can take damage.
Definition: NSSurfacePropEntity.qc:146
nonvirtual void SetPropData(string)
Assigns the prop data of a given description onto this entity.
Definition: NSSurfacePropEntity.qc:546
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:360
nonvirtual void DisableAimAssist(void)
Makes the entity invisible to other entity their aim-assists.
Definition: NSSurfacePropEntity.qc:105
nonvirtual float GetMaxHealth(void)
Returns the maximum health the entity can have.
Definition: NSSurfacePropEntity.qc:173
virtual void SetModel(string)
Sets the 3D model representation of the entity from a file path and name.
Definition: NSSurfacePropEntity.qc:798
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:584
void NSSurfacePropEntity(void)
Definition: NSSurfacePropEntity.qc:18
nonvirtual float GetArmor(void)
Returns the current armor of the entity.
Definition: NSSurfacePropEntity.qc:189
nonvirtual float GetHealth(void)
Returns the current health of the entity.
Definition: NSSurfacePropEntity.qc:168
virtual void ParentUpdate(void)
Called when we need to re-align the entity to our parent entity.
Definition: NSSurfacePropEntity.qc:219
nonvirtual void MakeInvulnerable(void)
Makes the entity invulnerable if it wasn't already.
Definition: NSSurfacePropEntity.qc:119
nonvirtual void SetArmor(float)
Sets the current armor of the entity.
Definition: NSSurfacePropEntity.qc:184
nonvirtual bool CanBeDamaged(vector, vector)
Returns whether this entity reacts to damage being inflicted.
Definition: NSSurfacePropEntity.qc:294
nonvirtual void Extinguish(void)
If the entity is on fire, it'll have it extinguished.
Definition: NSSurfacePropEntity.qc:332
nonvirtual void MakeVulnerable(void)
Makes the entity vulnerable if it wasn't already.
Definition: NSSurfacePropEntity.qc:112
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:341
nonvirtual __variant GetSurfaceData(int)
Returns a variable type of information about the entity's surface data.
Definition: NSSurfacePropEntity.qc:213
virtual bool IsAlive(void)
Returns whether or not the entity is alive.
Definition: NSSurfacePropEntity.qc:74
nonvirtual bool IsOnFire(void)
Returns whether or not this entity is on fire.
Definition: NSSurfacePropEntity.qc:54
virtual void Spawned(void)
Called when the entity is fulled initialized.
Definition: NSSurfacePropEntity.qc:38
nonvirtual vector GetBloodColor(void)
Returns the blood color of this entity.
Definition: NSSurfacePropEntity.qc:68
nonvirtual __variant GetPropData(int)
Returns a variable type of information about the entity's prop data.
Definition: NSSurfacePropEntity.qc:201
virtual float predraw(void)
nonvirtual void EnableBleeding(void)
Marks the entity as capable of bleeding.
Definition: NSSurfacePropEntity.qc:86
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:631
nonvirtual bool CanBleed(void)
Returns whether the entity can bleed.
Definition: NSSurfacePropEntity.qc:140
virtual void Death(entity, entity, int, vector, int)
Called when the health is equal or below 0.
Definition: NSSurfacePropEntity.qc:490
nonvirtual void SetSurfaceData(string)
Assigns the surface data of a given description onto this entity.
Definition: NSSurfacePropEntity.qc:539
nonvirtual bool IsVulnerable(void)
Returns whether the entity can be damaged.
Definition: NSSurfacePropEntity.qc:80
virtual void Pain(entity, entity, int, vector, int)
Called whenever the entity receives damage.
Definition: NSSurfacePropEntity.qc:484
nonvirtual void Ignite(entity, float, int)
Sets the entity on fire.
Definition: NSSurfacePropEntity.qc:276
nonvirtual void SetMaxHealth(float)
Sets the maximum amount of health the entity can have.
Definition: NSSurfacePropEntity.qc:161
nonvirtual void DisableBleeding(void)
Marks the entity as incapable of bleeding.
Definition: NSSurfacePropEntity.qc:92
nonvirtual float TimeSinceDeath(void)
Returns how many seconds have passed since we died.
Definition: NSSurfacePropEntity.qc:575
nonvirtual bool HasSurfaceData(void)
Returns if the entity has surface data information set.
Definition: NSSurfacePropEntity.qc:207
nonvirtual float GetSpawnHealth(void)
Returns the health the entity spawned with at map load.
Definition: NSSurfacePropEntity.qc:178
virtual void DamageFeedback(entity, entity, int)
Called when a different entity gets damaged by this entity.
Definition: NSSurfacePropEntity.qc:496
nonvirtual void SetHealth(float)
Sets the current health of the entity.
Definition: NSSurfacePropEntity.qc:152
virtual void Damage(entity, entity, NSDict, float, vector, vector)
Applies damage to the entity.
Definition: NSSurfacePropEntity.qc:244
nonvirtual bool HasPropData(void)
Returns if the entity has prop data information set.
Definition: NSSurfacePropEntity.qc:195
virtual void Restore(string, string)
Similar to NSIO::SpawnKey but for save-game fields.
Definition: NSSurfacePropEntity.qc:379
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition: NSSurfacePropEntity.qc:446
nonvirtual void SetBloodColor(vector)
Sets the colour of the blood of this entity.
Definition: NSSurfacePropEntity.qc:62
nonvirtual void EnableAimAssist(void)
Makes the entity visible to other entity their aim-assists.
Definition: NSSurfacePropEntity.qc:98
virtual void Input(entity, string, string)
Called when we are being prompted by another object/function with an input message.
Definition: NSSurfacePropEntity.qc:427
void radiusDamage(vector, float, int, int, entity)
Does damage to all entities within a specified radius with a linear falloff.
Definition: mapC.h:100
void entityDamage(entity, entity, entity, string, string, vector, vector, vector)
Applies damage to a given entity.
Definition: mapC.h:84
#define PREDICTED_FLOAT_N(x)
Definition: defs.h:41
#define PREDICTED_FLOAT(x)
Definition: defs.h:34