Nuclide
Software Development Kit for id Tech
NSGameRules.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
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
27{
28public:
29 void NSGameRules(void);
30
31 /* overrides */
32 virtual void Save(float);
33 virtual void Restore(string,string);
34 virtual void RestoreComplete(void);
35
37 virtual void InitPostEnts(void);
38
39 /* logic */
41 virtual void FrameStart(void);
43 virtual bool ConsoleCommand(NSClientPlayer,string);
45 virtual bool ClientCommand(NSClient,string);
47 virtual bool ImpulseCommand(NSClient, float);
48
49 /* client */
51 virtual void PlayerConnect(NSClientPlayer);
53 virtual void PlayerDisconnect(NSClientPlayer);
55 virtual void PlayerKill(NSClientPlayer);
57 virtual void PlayerSpawn(NSClientPlayer);
59 virtual void PlayerPreFrame(NSClientPlayer);
61 virtual void PlayerPostFrame(NSClientPlayer);
63 virtual void PlayerDeath(NSClientPlayer);
65 virtual void PlayerPain(NSClientPlayer);
67 virtual bool PlayerCanAttack(NSClientPlayer);
68
74
75 /* level transitions */
77 virtual void LevelNewParms(void);
79 virtual void LevelChangeParms(NSClientPlayer);
80
81 /* Entities/Item manipulation */
83 virtual int MaxItemPerSlot(int);
85 virtual bool MonstersSpawn(void);
87 nonvirtual void DamageApply(entity,entity,float,int,damageType_t);
89 nonvirtual bool DamageCheckTrace(entity,vector);
91 nonvirtual void DamageRadius(vector,entity,float,float,bool,int);
92
93 /* end of a game */
95 virtual void IntermissionStart(void);
97 virtual void IntermissionCycle(void);
99 virtual void IntermissionEnd(void);
103 virtual bool InIntermission(void);
104
106 virtual bool IsTeamplay(void);
108 virtual bool IsMultiplayer(void);
109
110 /* chat related methods */
113 virtual void ChatMessageAll(NSClient, string);
114
117 virtual void ChatMessageTeam(NSClient, string);
118
120 virtual string Title(void);
121
122 /* spectator */
123 /*
124 virtual void SpectatorConnect(NSClientPlayer);
125 virtual void SpectatorDisconnect(NSClientPlayer);
126 virtual void SpectatorThink(NSClientPlayer);
127 */
128private:
129 int m_iIntermission;
130 float m_flIntermissionTime;
131 float m_flIntermissionCycle;
132 entity m_eIntermissionPoint;
133};
134
135/* our currently running mode */
137
138#define CGameRules NSGameRules
NSGameRules g_grMode
Definition: NSGameRules.h:136
This entity class represents every player client.
Definition: NSClientPlayer.h:28
This entity class is the lowest client/player class.
Definition: NSClient.h:26
This class represents active gamerules.
Definition: NSGameRules.h:27
virtual void FrameStart(void)
Overridable: Called every server frame.
Definition: NSGameRules.qc:68
virtual bool ConsoleCommand(NSClientPlayer, string)
Overridable: Called when a client issues a console command.
Definition: NSGameRules.qc:73
virtual void PlayerKill(NSClientPlayer)
Overridable: Called when a NSClientPlayer issues the kill console command.
Definition: NSGameRules.qc:102
virtual void InitPostEnts(void)
Overridable: Called when all map entities have initialized.
Definition: NSGameRules.qc:61
virtual string Title(void)
Returns the title of the gamemode running.
Definition: NSGameRules.qc:379
nonvirtual void DamageApply(entity, entity, float, int, damageType_t)
Overridable: shim to handle application of direct damage.
Definition: NSGameRules.qc:281
virtual void IntermissionToPlayer(NSClientPlayer)
Run to send a specific player to an intermission.
Definition: NSGameRules.qc:234
nonvirtual bool DamageCheckTrace(entity, vector)
Checks if an entity can be attacked from a given position.
Definition: NSGameRules.qc:288
virtual bool PlayerRequestRespawn(NSClientPlayer)
Overridable: called when a NSClientPlayer requests a respawn.
Definition: NSGameRules.qc:325
virtual void LevelChangeParms(NSClientPlayer)
Overridable: Called to store parms for a specific NSClientPlayer.
Definition: NSGameRules.qc:139
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition: NSGameRules.qc:29
virtual void ChatMessageAll(NSClient, string)
Called by Nuclide when the server has received a chat message that is to be distributed amongst all c...
Definition: NSGameRules.qc:331
virtual void RestoreComplete(void)
Called when the entity has been successfully restored from a savegame file.
Definition: NSGameRules.qc:53
virtual bool IsMultiplayer(void)
Returns if the gamerule is a multiplayer game.
Definition: NSGameRules.qc:275
virtual void PlayerPain(NSClientPlayer)
Overridable: Called when a NSClientPlayer feels pain.
Definition: NSGameRules.qc:112
virtual void Restore(string, string)
Similar to NSIO::SpawnKey but for save-game fields.
Definition: NSGameRules.qc:37
virtual void PlayerDisconnect(NSClientPlayer)
Overridable: Called when a NSClientPlayer leaves the server.
Definition: NSGameRules.qc:96
virtual void LevelNewParms(void)
Overridable: Called to set up new level parms for any NSClientPlayer.
Definition: NSGameRules.qc:134
virtual void PlayerPostFrame(NSClientPlayer)
Overridable: Called after running physics on the NSClientPlayer in question.
Definition: NSGameRules.qc:127
virtual bool InIntermission(void)
Returns if the gamerules find themselves in an intermission.
Definition: NSGameRules.qc:257
virtual void IntermissionEnd(void)
Called when intermission ends.
Definition: NSGameRules.qc:301
virtual void IntermissionStart(void)
Called when intermission starts.
Definition: NSGameRules.qc:168
virtual bool ClientCommand(NSClient, string)
Overridable: Called when a client issues a client command.
Definition: NSGameRules.qc:78
virtual bool PlayerCanAttack(NSClientPlayer)
Overridable: Called to check if a NSClientPlayer can attack.
Definition: NSGameRules.qc:319
nonvirtual void DamageRadius(vector, entity, float, float, bool, int)
Overridable: shim to handle application of indirect radius damage.
Definition: NSGameRules.qc:295
virtual void PlayerConnect(NSClientPlayer)
Overridable: Called when a NSClientPlayer joins the server.
Definition: NSGameRules.qc:90
virtual bool IsTeamplay(void)
Returns if this gamerule considers itself teamplay oriented.
Definition: NSGameRules.qc:270
virtual void IntermissionCycle(void)
Called when the intermission system calls a new map.
Definition: NSGameRules.qc:183
virtual void PlayerPreFrame(NSClientPlayer)
Overridable: Called before running physics on the NSClientPlayer in question.
Definition: NSGameRules.qc:122
virtual void PlayerSpawn(NSClientPlayer)
Overridable: Called when a NSClientPlayer spawns, called sometime after joining.
Definition: NSGameRules.qc:117
virtual void ChatMessageTeam(NSClient, string)
Called by Nuclide when the server has received a chat message that is to be distributed amongst all c...
Definition: NSGameRules.qc:348
virtual int MaxItemPerSlot(int)
Overridable: Returns how many items players can carry in a given slot.
Definition: NSGameRules.qc:162
virtual void PlayerDeath(NSClientPlayer)
Overridable: Called when a NSClientPlayer dies in the game.
Definition: NSGameRules.qc:107
virtual bool ImpulseCommand(NSClient, float)
Overridable: Called when a client issues an impulse command.
Definition: NSGameRules.qc:83
void NSGameRules(void)
Definition: NSGameRules.qc:22
virtual bool MonstersSpawn(void)
Overridable: Returns if NSMonster or NSTalkMonster entities can spawn.
Definition: NSGameRules.qc:263
This class is responsible for handling core entity functionality.
Definition: NSIO.h:27
damageType_t
All available damage types.
Definition: damage.h:19