]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh
GameRules: make `GameRules_teams(true)` imply `have_team_spawns = -1`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / onslaught / sv_onslaught.qh
1 #pragma once
2
3 float autocvar_g_onslaught_point_limit;
4 void ons_Initialize();
5
6 REGISTER_MUTATOR(ons, false)
7 {
8         MUTATOR_ONADD
9         {
10                 if (time > 1) // game loads at time 1
11                         error("This is a game type and it cannot be added at runtime.");
12                 ons_Initialize();
13
14                 GameRules_teams(true);
15                 GameRules_limit_score(autocvar_g_onslaught_point_limit);
16         }
17
18         MUTATOR_ONROLLBACK_OR_REMOVE
19         {
20                 // we actually cannot roll back ons_Initialize here
21                 // BUT: we don't need to! If this gets called, adding always
22                 // succeeds.
23         }
24
25         MUTATOR_ONREMOVE
26         {
27                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
28                 return -1;
29         }
30
31         return false;
32 }
33
34 .entity ons_toucher; // player who touched the control point
35
36 // control point / generator constants
37 const float ONS_CP_THINKRATE = 0.2;
38 const float GEN_THINKRATE = 1;
39 #define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
40 const vector CPGEN_WAYPOINT_OFFSET = ('0 0 128');
41 const vector CPICON_OFFSET = ('0 0 96');
42
43 // list of generators on the map
44 entity ons_worldgeneratorlist;
45 .entity ons_worldgeneratornext;
46
47 // list of control points on the map
48 entity ons_worldcplist;
49 .entity ons_worldcpnext;
50
51 // list of links on the map
52 entity ons_worldlinklist;
53 .entity ons_worldlinknext;
54
55 // definitions
56 .entity sprite;
57 .string target2;
58 .int iscaptured;
59 .int islinked;
60 .int isshielded;
61 .float lasthealth;
62 .int lastteam;
63 .int lastshielded;
64 .int lastcaptured;
65
66 .bool waslinked;
67
68 bool ons_stalemate;
69
70 .float teleport_antispam;
71
72 .int aregensneighbor;
73 .int arecpsneighbor;
74 float ons_notification_time[17];
75
76 .float ons_overtime_damagedelay;
77
78 .vector ons_deathloc;
79
80 .entity ons_spawn_by;
81
82 // declarations for functions used outside gamemode_onslaught.qc
83 void ons_Generator_UpdateSprite(entity e);
84 void ons_ControlPoint_UpdateSprite(entity e);
85 bool ons_ControlPoint_Attackable(entity cp, int teamnumber);
86
87 // CaptureShield: Prevent capturing or destroying control point/generator if it is not available yet
88 float ons_captureshield_force; // push force of the shield
89
90 // bot player logic
91 const int HAVOCBOT_ONS_ROLE_NONE                = 0;
92 const int HAVOCBOT_ONS_ROLE_DEFENSE     = 2;
93 const int HAVOCBOT_ONS_ROLE_ASSISTANT   = 4;
94 const int HAVOCBOT_ONS_ROLE_OFFENSE     = 8;
95
96 .entity havocbot_ons_target;
97
98 .int havocbot_role_flags;
99 .float havocbot_attack_time;
100
101 void havocbot_role_ons_defense(entity this);
102 void havocbot_role_ons_offense(entity this);
103 void havocbot_role_ons_assistant(entity this);
104
105 void havocbot_ons_reset_role(entity this);
106 void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius);
107 void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius);
108
109 // score rule declarations
110 const int ST_ONS_CAPS = 1;