49 if (activator ==
nullptr)
54 if (entry->
data == activator)
69 if (activator ==
nullptr)
76 entry->
data = activator;
77 entry->
next =
self->touchedList;
78 self->touchedList = entry;
89 if (activator ==
nullptr)
95 if (entry->
data == activator) {
119 trigger->
reset =
nullptr;
122 gi.LinkEdict(trigger);
133 if (activator !=
nullptr && activator->
isSameTeamAs(
self)) {
137 Com_sprintf(command,
sizeof(command),
"map %s %s\n",
138 level.
day ?
"day" :
"night", self->nextmap);
158 self->absBox.getCenter(center);
165 gi.BroadcastPrintf(
PRINT_HUD,
_(
"You are now ready to switch the map."));
168 self->think =
nullptr;
180 gi.DPrintf(
"particle isn't set for %s\n", ent->
classname);
185 gi.DPrintf(
"nextmap isn't set for %s\n", ent->
classname);
191 gi.DPrintf(
"nextmap loop detected\n");
202 ent->
reset =
nullptr;
229 if (stunEl || (stunGas && !isRobot)) {
240 const int gender = activator->
chr.
gender;
268 ent->
reset =
nullptr;
274 #define TRIGGER_TOUCH_ONCE (1 << 0)
286 if (!self->owner()) {
287 gi.DPrintf(
"Target '%s' wasn't found for %s\n", self->target, self->classname);
294 }
else if (!(self->spawnflags &
TRIGGER_TOUCH_ONCE) ||
self->touchedList ==
nullptr) {
295 if (!self->owner()->use) {
296 gi.DPrintf(
"Owner of %s doesn't have a use function\n", self->classname);
326 gi.DPrintf(
"No target given for %s\n", ent->
classname);
352 if (self->isSameTeamAs(actor))
363 if (self->isSameTeamAs(actor))
void G_ClientPrintf(const Player &player, int printLevel, const char *fmt,...)
static void Reset_TouchTrigger(Edict *self, Edict *activator)
static void Reset_RescueTrigger(Edict *self, Edict *activator)
bool isSameTeamAs(const Edict *other) const
void G_MatchEndTrigger(int team, int timeGap)
Triggers the end of the game. Will be executed in the next server (or game) frame.
static bool Touch_TouchTrigger(Edict *self, Edict *activator)
Touch trigger.
const teamDef_t * teamDef
Misc utility functions for game module.
#define FL_CLIENTACTION
Edict flag to indicate, that the edict can be used in the context of a client action.
Edict * G_TriggerSpawn(Edict *owner)
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
void SP_trigger_hurt(Edict *ent)
Trigger for grid fields if they are under fire.
void Think_NextMapTrigger(Edict *self)
Register this think function once you would like to end the match This think function will register t...
void set(const AABB &other)
Copies the values from the given aabb.
static bool Touch_NextMapTrigger(Edict *self, Edict *activator)
Next map trigger that is going to get active once all opponents are killed.
void G_CheckDeathOrKnockout(Actor *target, Actor *attacker, const fireDef_t *fd, int damage)
#define TRIGGER_TOUCH_ONCE
bool G_IsLivingActor(const Edict *ent)
Checks whether the given edict is a living actor.
Actor * makeActor(Edict *ent)
Convert an Edict pointer into an Actor pointer.
Player & getPlayer() const
Edict * G_EdictsFindTargetEntity(const char *target)
Searches the edict that has the given target as targetname set.
void setTouch(bool(*touch_)(Edict *self, Edict *activator))
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
#define G_IsMultiPlayer()
void SP_trigger_touch(Edict *ent)
Touch trigger to call the use function of the attached target.
void setInRescueZone(bool inRescueZone_)
Set the rescue zone flag.
All parts of the main game logic that are combat related.
void SP_trigger_nextmap(Edict *ent)
#define G_PlayerToPM(player)
Edict * G_Spawn(const char *classname)
Either finds a free edict, or allocates a new one.
#define VecToPos(v, p)
Map boundary is +/- MAX_WORLD_WIDTH - to get into the positive area we add the possible max negative ...
#define G_TagMalloc(size, tag)
Edict * G_SpawnParticle(const vec3_t origin, int spawnflags, const char *particle)
void SP_trigger_rescue(Edict *ent)
Rescue trigger to mark an actor to be in the rescue zone. Aborting a game would not kill the actors i...
void G_ActorSetClientAction(Edict *actor, Edict *ent)
Handles the client actions (interaction with the world)
void(* reset)(Edict *self, Edict *activator)
void G_DamageActor(Edict *target, const int damage, const vec3_t impact)
Deals damage and causes wounds.
bool Touch_HurtTrigger(Edict *self, Edict *activator)
Hurt trigger.
void expandXY(const float byVal)
expand the box in four directions, but clip them to the maximum boundaries
void G_EventCenterViewAt(playermask_t playerMask, const pos3_t pos)
Centers the view for all clients that are seeing the given edict on the world position of the edict...
bool G_TriggerIsInList(Edict *self, Edict *activator)
Checks whether the activator of this trigger_touch was already recognized.
void G_EventSpawnSound(playermask_t playerMask, const Edict &ent, const vec3_t origin, const char *sound)
Spawns a sound (that will be spatialized on the client side)
void G_TriggerAddToList(Edict *self, Edict *activator)
Adds the activator to the list of recognized edicts for this trigger_touch edict. ...
Brings new objects into the world.
void setChild(Edict *child)
functions to handle the storage and lifecycle of all edicts in the game module.
bool G_UseEdict(Edict *ent, Edict *activator)
Call the 'use' function for the given edict and all its group members.
const char * getActorSound(int gender, actorSound_t soundType) const
Returns the actor sounds for a given category.
static bool Touch_RescueTrigger(Edict *self, Edict *activator)
Rescue trigger.
bool G_TriggerRemoveFromList(Edict *self, Edict *activator)
Removes an activator from the list of recognized edicts.
void G_FreeEdict(Edict *ent)
Marks the edict as free.
Interface for g_client.cpp.
int G_ApplyProtection(const Edict *target, const byte dmgWeight, int damage)
Reduces damage by armour and natural protection.