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