![]() |
Nuclide
Software Development Kit for id Technology (BETA)
|
This class represents active gamerules.
The ncRuleDelegate class is for any set of active gamerules. It can be accessed in QuakeC via the global g_grMode from the server-side.
Upon server init, the game will query the weak function Game_DefaultRules(), which can be re-implemented with the same name by the game developer in their server game. The return value should either be __NULL__ or the name of a progs within <gamedir>/progs/.
By default, the game will load either <gamedir>/progs/singleplayer.dat when it's only a singleplayer client or the console variable for coop is 1, or <gamedir>/progs/deathmatch.dat in any other case. If you happen to set the server-side console variable g_gametype to a custom string, it will attempt to load a named progs that can be found under <gamedir>/progs/.
Here's the current implementation of said function:
If you only plan on having one mode, ever, and disallow custom game modes - you can define it like this anywhere:
The progs in question is then able to override any methods of the ncGameRule class.
When we decide to load a rule from an external progs, that progs can be implemented with as many binds as you like. The only requirement is you include the header found under src/server/api.h.
Here's a simple deathmatch rule, which will increment the score on the score-board for every player frag:
Left = class method, right = name of the callback function for you to implement in progs.
ncRuleDelegate::Title = CodeCallback_Title
ncRuleDelegate::ClientCommand = CodeCallback_ClientCommand
ncRuleDelegate::ConsoleCommand = CodeCallback_ConsoleCommand
ncRuleDelegate::FrameStart = CodeCallback_FrameStart
ncRuleDelegate::ImpulseCommand = CodeCallback_ImpulseCommand
ncRuleDelegate::InitPostEnts = CodeCallback_StartGameType
ncRuleDelegate::Input = CodeCallback_Input
ncRuleDelegate::NPCDeath = CodeCallback_NPCKilled
ncRuleDelegate::PlayerCanAttack = CodeCallback_PlayerCanAttack
ncRuleDelegate::PlayerConnect = CodeCallback_PlayerConnect
ncRuleDelegate::PlayerDeath = CodeCallback_PlayerKilled
ncRuleDelegate::PlayerDisconnect = CodeCallback_PlayerDisconnect
ncRuleDelegate::PlayerPain = CodeCallback_PlayerDamage
ncRuleDelegate::PlayerPreFrame = CodeCallback_PlayerPreFrame
ncRuleDelegate::PlayerRequestRespawn = CodeCallback_PlayerRequestRespawn
ncRuleDelegate::PlayerRequestTeam = CodeCallback_CallRequestTeam
ncRuleDelegate::PlayerSpawn = CodeCallback_PlayerSpawn
ncRuleDelegate::Shutdown = CodeCallback_Shutdown
The underlying return values and parameters are inherited from its class counter-part.
Public Member Functions | |
| void | ncRuleDelegate (void) |
| virtual void | Save (float) |
| Handles saving a copy of this entity to a given filehandle. More... | |
| virtual void | Restore (string, string) |
| Similar to ncIO::SpawnKey() but for save-game fields. More... | |
| virtual void | RestoreComplete (void) |
| Called when the entity has been successfully restored from a savegame file. More... | |
| virtual void | Input (entity, string, string) |
| Called when we are being prompted by another object/function with an input message. More... | |
| virtual void | InitPostEnts (void) |
| Overridable: Called when all map entities have initialized. More... | |
| virtual void | Precache (void) |
| Overridable: Called from initents(). More... | |
| virtual void | Shutdown (void) |
| Overridable: Called from SV_Shutdown(). More... | |
| virtual void | FrameStart (void) |
| Overridable: Called every server frame. More... | |
| virtual bool | ConsoleCommand (ncPlayer, string) |
| Overridable: Called when the server issues a console command. More... | |
| virtual bool | ClientCommand (ncClient, string) |
| Overridable: Called when a client issues a client command. More... | |
| virtual bool | ImpulseCommand (ncClient, float) |
| Overridable: Called when a client issues an impulse command. More... | |
| virtual void | PlayerConnect (ncPlayer) |
| Overridable: Called when a ncPlayer joins the server. More... | |
| virtual void | PlayerDisconnect (ncPlayer) |
| Overridable: Called when a ncPlayer leaves the server. More... | |
| virtual void | PlayerKill (ncPlayer) |
Overridable: Called when a ncPlayer issues the kill console command. More... | |
| virtual void | PlayerSpawn (ncPlayer) |
| Overridable: Called when a ncPlayer spawns, called sometime after joining. More... | |
| virtual void | PlayerPreFrame (ncPlayer) |
| Overridable: Called before running physics on the ncPlayer in question. More... | |
| virtual void | PlayerPostFrame (ncPlayer) |
| Overridable: Called after running physics on the ncPlayer in question. More... | |
| virtual void | PlayerDeath (ncPlayer, ncEntity, ncEntity, string) |
| Overridable: Called when a ncPlayer dies in the game. More... | |
| virtual void | PlayerPain (ncPlayer, ncActor, ncDict) |
| Overridable: Called when a ncPlayer feels pain. More... | |
| virtual bool | PlayerCanAttack (ncPlayer) |
| Overridable: Called to check if a ncPlayer can attack. More... | |
| virtual void | PlayerInventoryChanged (ncPlayer) |
| Overridable: Called whenever the inventory had changed at the end of a frame. More... | |
| virtual void | NPCDeath (ncActor, ncEntity, ncEntity) |
| Overridable:: Called when an NPC gets killed. More... | |
| virtual bool | PlayerRequestRespawn (ncPlayer) |
| Overridable: called when a ncPlayer requests a respawn. More... | |
| virtual bool | PlayerRequestTeam (ncPlayer, int team) |
| Overridable: called when a ncPlayer requests joining a specific team. More... | |
| virtual void | LevelNewParms (void) |
| Overridable: Called to set up new level parms for any ncPlayer. More... | |
| virtual void | LevelChangeParms (ncPlayer) |
| Overridable: Called to store parms for a specific ncPlayer. More... | |
| virtual void | LevelDecodeParms (ncPlayer) |
| Overridable: Called to decode parms for a specific ncPlayer. More... | |
| virtual int | MaxItemPerSlot (int) |
| Overridable: Returns how many items players can carry in a given slot. More... | |
| virtual bool | MonstersSpawn (void) |
| Overridable: Returns if ncMonster or ncTalkMonster entities can spawn. More... | |
| virtual void | IntermissionStart (void) |
| Called when intermission starts. More... | |
| virtual void | IntermissionCycle (void) |
| Called when the intermission system calls a new map. More... | |
| virtual void | IntermissionEnd (void) |
| Called when intermission ends. More... | |
| virtual void | IntermissionToPlayer (ncPlayer) |
| Run to send a specific player to an intermission. More... | |
| virtual bool | InIntermission (void) |
| Returns if the gamerules find themselves in an intermission. More... | |
| virtual void | OnIntermissionCycle (void) |
| Called whenever the camera angle changed in the intermission. More... | |
| virtual bool | IsTeamplay (void) |
| Returns if this gamerule considers itself teamplay oriented. More... | |
| virtual bool | IsMultiplayer (void) |
| Returns if the gamerule is a multiplayer game. More... | |
| virtual void | ChatMessageAll (ncClient, string) |
| Called by Nuclide when the server has received a chat message that is to be distributed amongst all clients, regardless of team. More... | |
| virtual void | ChatMessageTeam (ncClient, string) |
| Called by Nuclide when the server has received a chat message that is to be distributed amongst all clients of the same team. More... | |
| virtual string | Title (void) |
| Returns the title of the gamemode running. More... | |
| nonvirtual void | LinkProgs (void) |
| nonvirtual ncRuleDelegate | ActiveInstance (void) |
| void ncRuleDelegate::ncRuleDelegate | ( | void | ) |
| ncRuleDelegate ncRuleDelegate::ActiveInstance | ( | void | ) |
|
virtual |
Called by Nuclide when the server has received a chat message that is to be distributed amongst all clients, regardless of team.
Reimplemented in ncGameRule_Home.
|
virtual |
Called by Nuclide when the server has received a chat message that is to be distributed amongst all clients of the same team.
Reimplemented in ncGameRule_Home.
|
virtual |
Overridable: Called when a client issues a client command.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, and ncGameRule_Home.
|
virtual |
Overridable: Called when the server issues a console command.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, and ncGameRule_Home.
|
virtual |
Overridable: Called every server frame.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Overridable: Called when a client issues an impulse command.
|
virtual |
Returns if the gamerules find themselves in an intermission.
|
virtual |
Overridable: Called when all map entities have initialized.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Called when we are being prompted by another object/function with an input message.
Reimplemented from ncIO.
|
virtual |
Called when the intermission system calls a new map.
|
virtual |
Called when intermission ends.
Reimplemented in ncGameRule_DevShutterbug.
|
virtual |
Called when intermission starts.
Will send all current players to the intermission screen.
|
virtual |
Run to send a specific player to an intermission.
Like when joining late.
|
virtual |
Returns if the gamerule is a multiplayer game.
|
virtual |
Returns if this gamerule considers itself teamplay oriented.
|
virtual |
Overridable: Called to store parms for a specific ncPlayer.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Overridable: Called to decode parms for a specific ncPlayer.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Overridable: Called to set up new level parms for any ncPlayer.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
| void ncRuleDelegate::LinkProgs | ( | void | ) |
|
virtual |
Overridable: Returns how many items players can carry in a given slot.
|
virtual |
Overridable: Returns if ncMonster or ncTalkMonster entities can spawn.
Overridable:: Called when an NPC gets killed.
|
virtual |
Called whenever the camera angle changed in the intermission.
|
virtual |
Overridable: Called to check if a ncPlayer can attack.
|
virtual |
Overridable: Called when a ncPlayer joins the server.
|
virtual |
Overridable: Called when a ncPlayer dies in the game.
|
virtual |
Overridable: Called when a ncPlayer leaves the server.
|
virtual |
Overridable: Called whenever the inventory had changed at the end of a frame.
You want to put expensive operations here - as it is not called whenever an individual item is added.
|
virtual |
Overridable: Called when a ncPlayer issues the kill console command.
Overridable: Called when a ncPlayer feels pain.
|
virtual |
Overridable: Called after running physics on the ncPlayer in question.
|
virtual |
Overridable: Called before running physics on the ncPlayer in question.
|
virtual |
Overridable: called when a ncPlayer requests a respawn.
In a multiplayer game, it'll put you back into the game as a player. In a singleplayer game, it might load the most recent save.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, and ncGameRule_Home.
|
virtual |
Overridable: called when a ncPlayer requests joining a specific team.
|
virtual |
Overridable: Called when a ncPlayer spawns, called sometime after joining.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, and ncGameRule_Home.
|
virtual |
Overridable: Called from initents().
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Similar to ncIO::SpawnKey() but for save-game fields.
Whatever you write into file handles within your ncIO::Save() method needs to be read back in here.
Reimplemented from ncIO.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Called when the entity has been successfully restored from a savegame file.
Reimplemented from ncIO.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Handles saving a copy of this entity to a given filehandle.
Within you want to use the ncIO::SaveFloat() etc. methods to write the internal member attributes to the specified file handle.
Reimplemented from ncIO.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Overridable: Called from SV_Shutdown().
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.
|
virtual |
Returns the title of the gamemode running.
Reimplemented in ncGameRule_DevShutterbug, ncGameRule_Editor, ncGameRule_Home, and ncGameRule_SinglePlayer.