]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/sv_monsters.qc
Merge translatable strings for !1017 (Mario/monsters) early
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / sv_monsters.qc
index 974f69e5b3a3a2122295768509914e81aa4defd3..e3eaf6ecd1b5ea88706b1619bf51505026b8f809 100644 (file)
@@ -1,30 +1,33 @@
 #include "sv_monsters.qh"
 
+#include <common/constants.qh>
+#include <common/deathtypes/all.qh>
+#include <common/items/_mod.qh>
+#include <common/mapobjects/teleporters.qh>
+#include <common/mapobjects/triggers.qh>
+#include <common/monsters/all.qh>
+#include <common/mutators/mutator/nades/nades.qh>
+#include <common/mutators/mutator/status_effects/_mod.qh>
+#include <common/physics/movelib.qh>
+#include <common/stats.qh>
+#include <common/teams.qh>
+#include <common/turrets/sv_turrets.qh>
+#include <common/turrets/util.qh>
+#include <common/util.qh>
+#include <common/vehicles/all.qh>
+#include <common/weapons/_all.qh>
+#include <common/weapons/_mod.qh>
+#include <lib/csqcmodel/sv_model.qh>
 #include <lib/warpzone/common.qh>
-#include "../constants.qh"
-#include "../teams.qh"
-#include "../util.qh"
-#include "all.qh"
-#include "../physics/movelib.qh"
-#include "../weapons/_mod.qh"
-#include <server/autocvars.qh>
-#include <server/defs.qh>
-#include <server/g_damage.qh>
-#include "../deathtypes/all.qh"
-#include <server/items/items.qh>
-#include <server/mutators/_mod.qh>
-#include <server/steerlib.qh>
-#include <server/sv_main.qh>
-#include "../turrets/sv_turrets.qh"
-#include "../turrets/util.qh"
-#include "../vehicles/all.qh"
 #include <server/campaign.qh>
 #include <server/cheats.qh>
+#include <server/client.qh>
 #include <server/command/_mod.qh>
-#include <common/mapobjects/teleporters.qh>
-#include "../mapobjects/triggers.qh"
-#include <lib/csqcmodel/sv_model.qh>
+#include <server/damage.qh>
+#include <server/items/items.qh>
+#include <server/mutators/_mod.qh>
 #include <server/round_handler.qh>
+#include <server/steerlib.qh>
 #include <server/weapons/_mod.qh>
 
 void monsters_setstatus(entity this)
@@ -87,7 +90,6 @@ bool Monster_ValidTarget(entity this, entity targ)
        || (time < game_starttime) // monsters do nothing before match has started
        || (targ.takedamage == DAMAGE_NO)
        || (game_stopped)
-       || (targ.items & IT_INVISIBILITY)
        || (IS_SPEC(targ) || IS_OBSERVER(targ)) // don't attack spectators
        || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || GetResource(targ, RES_HEALTH) <= 0 || GetResource(this, RES_HEALTH) <= 0))
        || (this.monster_follow == targ || targ.monster_follow == this)
@@ -133,7 +135,7 @@ entity Monster_FindTarget(entity this)
        {
                if(Monster_ValidTarget(this, it))
                {
-                       // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
+                       // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in damage.qc)
                        vector targ_center = CENTER_OR_VIEWOFS(it);
 
                        if(closest_target)
@@ -216,7 +218,7 @@ void Monster_Delay_Action(entity this)
 void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
 {
        // deferred attacking, checks if monster is still alive and target is still valid before attacking
-       entity e = spawn();
+       entity e = new_pure(Monster_Delay);
 
        setthink(e, Monster_Delay_Action);
        e.nextthink = time + defer_amnt;
@@ -1003,7 +1005,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
        //if(time < this.pain_finished && deathtype != DEATH_KILL.m_id)
                //return;
 
-       if(time < this.spawnshieldtime && deathtype != DEATH_KILL.m_id)
+       if(StatusEffects_active(STATUSEFFECT_SpawnShield, this) && deathtype != DEATH_KILL.m_id)
                return;
 
        if(deathtype == DEATH_FALL.m_id && this.draggedby != NULL)
@@ -1099,7 +1101,7 @@ void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
        bool reverse = false;
        if(trace_fraction != 1.0)
                reverse = true;
-       if(trace_ent && IS_PLAYER(trace_ent) && !(trace_ent.items & ITEM_Strength.m_itemid))
+       if(trace_ent && IS_PLAYER(trace_ent))
                reverse = false;
        if(trace_ent && IS_MONSTER(trace_ent))
                reverse = true;
@@ -1358,6 +1360,14 @@ bool Monster_Spawn(entity this, bool check_appear, Monster mon)
        else
                setmodel(this, mon.m_model);
 
+       if(this.statuseffects && this.statuseffects.owner == this)
+       {
+               StatusEffects_clearall(this.statuseffects);
+               StatusEffects_update(this);
+       }
+       else
+               this.statuseffects = NULL;
+
        this.flags                              = FL_MONSTER;
        this.classname                  = "monster";
        this.takedamage                 = DAMAGE_AIM;
@@ -1376,7 +1386,7 @@ bool Monster_Spawn(entity this, bool check_appear, Monster mon)
        this.use                                = Monster_Use;
        this.solid                              = SOLID_BBOX;
        set_movetype(this, MOVETYPE_WALK);
-       this.spawnshieldtime    = time + autocvar_g_monsters_spawnshieldtime;
+       StatusEffects_apply(STATUSEFFECT_SpawnShield, this, time + autocvar_g_monsters_spawnshieldtime, 0);
        this.enemy                              = NULL;
        this.velocity                   = '0 0 0';
        this.moveto                             = this.origin;