]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/mage.qc
Merge branch 'master' into terencehill/spectatee_status_update
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / mage.qc
index c964b30827141bb9117abf762c4d1608bdf1c1f4..650999de1eaf4c7c63e7b295d6b5a6143ed94fb7 100644 (file)
@@ -1,39 +1,4 @@
-#ifndef MAGE_H
-#define MAGE_H
-
-#ifndef MENUQC
-MODEL(MON_MAGE, M_Model("mage.dpm"));
-#endif
-
-CLASS(Mage, Monster)
-    ATTRIB(Mage, spawnflags, int, MON_FLAG_MELEE | MON_FLAG_RANGED);
-    ATTRIB(Mage, mins, vector, '-36 -36 -24');
-    ATTRIB(Mage, maxs, vector, '36 36 50');
-#ifndef MENUQC
-    ATTRIB(Mage, m_model, Model, MDL_MON_MAGE);
-#endif
-    ATTRIB(Mage, netname, string, "mage");
-    ATTRIB(Mage, monster_name, string, _("Mage"));
-ENDCLASS(Mage)
-
-REGISTER_MONSTER(MAGE, NEW(Mage)) {
-#ifndef MENUQC
-    this.mr_precache(this);
-#endif
-}
-
-#include <common/weapons/all.qh>
-#include <common/items/all.qc>
-
-CLASS(MageSpike, PortoLaunch)
-/* flags     */ ATTRIB(MageSpike, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse   */ ATTRIB(MageSpike, impulse, int, 9);
-/* refname   */ ATTRIB(MageSpike, netname, string, "magespike");
-/* wepname   */ ATTRIB(MageSpike, m_name, string, _("Mage spike"));
-ENDCLASS(MageSpike)
-REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike));
-
-#endif
+#include "mage.qh"
 
 #ifdef IMPLEMENTATION
 
@@ -49,7 +14,7 @@ METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, .entity weapon
     if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) {
         if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range;
         actor.enemy = Monster_FindTarget(actor);
-        W_SetupShot_Dir(actor, v_forward, false, 0, SND_MageSpike_FIRE, CH_WEAPON_B, 0);
+        W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_MageSpike_FIRE, CH_WEAPON_B, 0);
        if (!IS_PLAYER(actor)) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
         M_Mage_Attack_Spike(actor, w_shotdir);
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
@@ -146,7 +111,7 @@ bool M_Mage_Defend_Heal_Check(entity this, entity targ)
        return false;
 }
 
-void M_Mage_Attack_Spike_Explode(entity this)
+void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity)
 {
        this.event_damage = func_null;
 
@@ -155,16 +120,16 @@ void M_Mage_Attack_Spike_Explode(entity this)
        this.realowner.mage_spike = NULL;
 
        Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1);
-       RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, other);
+       RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, directhitentity);
 
-       remove (this);
+       delete (this);
 }
 
-void M_Mage_Attack_Spike_Touch(entity this)
+void M_Mage_Attack_Spike_Touch(entity this, entity toucher)
 {
-       PROJECTILE_TOUCH(this);
+       PROJECTILE_TOUCH(this, toucher);
 
-       M_Mage_Attack_Spike_Explode(this);
+       M_Mage_Attack_Spike_Explode(this, toucher);
 }
 
 .float wait;
@@ -174,7 +139,7 @@ void M_Mage_Attack_Spike_Think(entity this)
 {
        if (time > this.ltime || (this.enemy && this.enemy.health <= 0) || this.owner.health <= 0) {
                this.projectiledeathtype |= HITTYPE_SPLASH;
-               M_Mage_Attack_Spike_Explode(this);
+               M_Mage_Attack_Spike_Explode(this, NULL);
        }
 
        float spd = vlen(this.velocity);
@@ -233,8 +198,9 @@ void M_Mage_Attack_Spike(entity this, vector dir)
        missile.ltime = time + 7;
        missile.nextthink = time;
        missile.solid = SOLID_BBOX;
-       missile.movetype = MOVETYPE_FLYMISSILE;
+       set_movetype(missile, MOVETYPE_FLYMISSILE);
        missile.flags = FL_PROJECTILE;
+       IL_PUSH(g_projectiles, missile);
        setorigin(missile, this.origin + v_forward * 14 + '0 0 30' + v_right * -14);
        setsize(missile, '0 0 0', '0 0 0');
        missile.velocity = dir * 400;
@@ -458,7 +424,7 @@ METHOD(Mage, mr_death, bool(Mage this, entity actor))
 }
 
 #endif
-#ifndef MENUQC
+#ifdef GAMEQC
 METHOD(Mage, mr_anim, bool(Mage this, entity actor))
 {
     TC(Mage, this);