]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/base.qh
Unify boolean constants
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / base.qh
index 893ebb301ff439ffbed18757f6da29cc95cf92b8..8c389591911da99f6fdab4497a0079a521278294 100644 (file)
@@ -1,7 +1,7 @@
-#define CBC_ORDER_EXCLUSIVE 3
-#define CBC_ORDER_FIRST 1
-#define CBC_ORDER_LAST 2
-#define CBC_ORDER_ANY 4
+const float CBC_ORDER_EXCLUSIVE = 3;
+const float CBC_ORDER_FIRST = 1;
+const float CBC_ORDER_LAST = 2;
+const float CBC_ORDER_ANY = 4;
 
 float CallbackChain_ReturnValue; // read-only field of the current return value
 
@@ -16,9 +16,9 @@ float CallbackChain_Remove(entity cb, float() func);
 // }
 float CallbackChain_Call(entity cb);
 
-#define MUTATOR_REMOVING 0
-#define MUTATOR_ADDING 1
-#define MUTATOR_ROLLING_BACK 2
+const float MUTATOR_REMOVING = 0;
+const float MUTATOR_ADDING = 1;
+const float MUTATOR_ROLLING_BACK = 2;
 typedef float(float) mutatorfunc_t;
 float Mutator_Add(mutatorfunc_t func, string name);
 void Mutator_Remove(mutatorfunc_t func, string name); // calls error() on fail
@@ -77,6 +77,7 @@ MUTATOR_HOOKABLE(PlayerJump);
        // called when a player presses the jump key
        // INPUT, OUTPUT:
                float player_multijump;
+               float player_jumpheight;
 
 MUTATOR_HOOKABLE(GiveFragsForKill);
        // called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill
@@ -102,8 +103,13 @@ MUTATOR_HOOKABLE(SpectateCopy);
 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon);
        // returns 1 if throwing the current weapon shall not be allowed
 
+MUTATOR_HOOKABLE(WeaponRateFactor);
+       // allows changing attack rate
+       // INPUT, OUTPUT:
+               float weapon_rate;
+
 MUTATOR_HOOKABLE(SetStartItems);
-       // adjusts {warmup_}start_{items,weapons,ammo_{cells,rockets,nails,shells,fuel}}
+       // adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}}
 
 MUTATOR_HOOKABLE(BuildMutatorsString);
        // appends ":mutatorname" to ret_string for logging
@@ -153,6 +159,43 @@ MUTATOR_HOOKABLE(EditProjectile);
                entity self;
                entity other;
 
+MUTATOR_HOOKABLE(MonsterSpawn);
+       // called when a monster spawns
+
+MUTATOR_HOOKABLE(MonsterDies);
+       // called when a monster dies
+       // INPUT:
+               entity frag_attacker;
+
+MUTATOR_HOOKABLE(MonsterRespawn);
+       // called when a monster wants to respawn
+       // INPUT:
+               entity other;
+
+MUTATOR_HOOKABLE(MonsterDropItem);
+       // called when a monster is dropping loot
+       // INPUT, OUTPUT:
+               .void() monster_loot;
+               entity other;
+
+MUTATOR_HOOKABLE(MonsterMove);
+       // called when a monster moves
+       // returning true makes the monster stop
+       // INPUT:
+               float monster_speed_run;
+               float monster_speed_walk;
+               entity monster_target;
+
+MUTATOR_HOOKABLE(MonsterFindTarget);
+       // called when a monster looks for another target
+
+MUTATOR_HOOKABLE(MonsterCheckBossFlag);
+    // called to change a random monster to a miniboss
+
+MUTATOR_HOOKABLE(AllowMobSpawning);
+       // called when a player tries to spawn a monster
+       // return 1 to prevent spawning
+
 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor);
        // called when a player gets damaged to e.g. remove stuff he was carrying.
        // INPUT:
@@ -182,6 +225,15 @@ MUTATOR_HOOKABLE(PlayerPowerups);
        entity self;
        float olditems; // also technically output, but since it is at the end of the function it's useless for that :P
 
+MUTATOR_HOOKABLE(PlayerRegen);
+       // called every player think frame
+       // return 1 to disable regen
+       // INPUT, OUTPUT:
+               float regen_mod_max;
+               float regen_mod_regen;
+               float regen_mod_rot;
+               float regen_mod_limit;
+
 MUTATOR_HOOKABLE(PlayerUseKey);
        // called when the use key is pressed
        // if MUTATOR_RETURNVALUE is 1, don't do anything
@@ -272,7 +324,7 @@ MUTATOR_HOOKABLE(HelpMePing);
 
 MUTATOR_HOOKABLE(VehicleSpawn);
        // called when a vehicle initializes
-       // return TRUE to remove the vehicle
+       // return true to remove the vehicle
 
 MUTATOR_HOOKABLE(VehicleEnter);
        // called when a player enters a vehicle
@@ -283,7 +335,7 @@ MUTATOR_HOOKABLE(VehicleEnter);
 
 MUTATOR_HOOKABLE(VehicleTouch);
        // called when a player touches a vehicle
-       // return TRUE to stop player from entering the vehicle
+       // return true to stop player from entering the vehicle
        // INPUT
        entity self; // vehicle
        entity other; // player
@@ -304,13 +356,21 @@ MUTATOR_HOOKABLE(ItemTouch);
        // called at when a item is touched. Called early, can edit item properties.
        entity self;    // item
        entity other;   // player
-       #define MUT_ITEMTOUCH_CONTINUE 0 // return this flag to make the function continue as normal
-       #define MUT_ITEMTOUCH_RETURN 1 // return this flag to make the function return (handled entirely by mutator)
-       #define MUT_ITEMTOUCH_PICKUP 2 // return this flag to have the item "picked up" and taken even after mutator handled it
+       const float MUT_ITEMTOUCH_CONTINUE = 0; // return this flag to make the function continue as normal
+       const float MUT_ITEMTOUCH_RETURN = 1; // return this flag to make the function return (handled entirely by mutator)
+       const float MUT_ITEMTOUCH_PICKUP = 2; // return this flag to have the item "picked up" and taken even after mutator handled it
 
 MUTATOR_HOOKABLE(ClientConnect);
        // called at when a player connect
        entity self;    // player
 
-MUTATOR_HOOKABLE(HavocBot_ChooseRule);
+MUTATOR_HOOKABLE(HavocBot_ChooseRole);
        entity self;
+
+MUTATOR_HOOKABLE(AccuracyTargetValid);
+       // called when a target is checked for accuracy
+       entity frag_attacker; // attacker
+       entity frag_target; // target
+       const float MUT_ACCADD_VALID = 0; // return this flag to make the function continue if target is a client
+       const float MUT_ACCADD_INVALID = 1; // return this flag to make the function always continue
+       const float MUT_ACCADD_INDIFFERENT = 2; // return this flag to make the function always return