]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Tweak wyvern attack and animations a bit
authorMario <mario@smbclan.net>
Tue, 24 Apr 2018 09:19:47 +0000 (19:19 +1000)
committerMario <mario@smbclan.net>
Tue, 24 Apr 2018 09:19:47 +0000 (19:19 +1000)
qcsrc/common/monsters/monster.qh
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/wyvern.qh
qcsrc/common/monsters/sv_monsters.qc

index 632d9b65ded53312e87ed2085bdc9c769193ed57..cca74b8e6f0077b9887fb8a0c8a931262408bce1 100644 (file)
@@ -46,6 +46,8 @@ CLASS(Monster, Object)
     METHOD(Monster, mr_setup, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
     /** (SERVER) logic to run every frame */
     METHOD(Monster, mr_think, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
+    /** (SERVER) logic to run every frame after the monster has died */
+    METHOD(Monster, mr_deadthink, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
     /** (SERVER) called when monster dies */
     METHOD(Monster, mr_death, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
     /** (SERVER) called when monster is damaged */
index 7dcbd1f588e1144786b02fa4e80d0c6a29e4de86..8163c33f7227d341c7bbd25571da808c0927ef6a 100644 (file)
@@ -19,16 +19,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity
     if (fire & 1)
     if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, weaponentity, false, 1.2)) {
         if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_WyvernAttack_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_WYVERN.m_id);
-               if (IS_MONSTER(actor)) {
-                       //actor.anim_finished = time + 1.2;
-                       setanim(actor, actor.anim_shoot, false, true, true);
-                       if(actor.animstate_endtime > time)
-                               actor.anim_finished = actor.animstate_endtime;
-                       else
-                               actor.anim_finished = time + 1.2;
-                       actor.attack_finished_single[0] = actor.anim_finished + 0.2;
-                       monster_makevectors(actor, actor.enemy);
-               }
+               if (IS_MONSTER(actor)) monster_makevectors(actor, actor.enemy);
 
                entity missile = spawn();
                missile.owner = missile.realowner = actor;
@@ -77,9 +68,9 @@ void M_Wyvern_Attack_Fireball_Explode(entity this)
        entity own = this.realowner;
 
        RadiusDamage(this, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force,
-                                               NULL, NULL, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, DMG_NOWEP, NULL);
+                                               own, NULL, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, DMG_NOWEP, NULL);
 
-       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_wyvern_attack_fireball_radius, it.takedamage == DAMAGE_AIM,
+       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_wyvern_attack_fireball_radius, it.takedamage == DAMAGE_AIM && it != own,
        {
                Fire_AddDamage(it, own, 5 * MONSTER_SKILLMOD(own), autocvar_g_monster_wyvern_attack_fireball_damagetime, this.projectiledeathtype);
        });
@@ -94,6 +85,15 @@ void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher)
        M_Wyvern_Attack_Fireball_Explode(this);
 }
 
+void M_Wyvern_Attack_Fireball(entity this)
+{
+       w_shotdir = normalize((this.enemy.origin + '0 0 10') - this.origin);
+       Weapon wep = WEP_WYVERN_ATTACK;
+       // TODO
+       .entity weaponentity = weaponentities[0];
+       wep.wr_think(wep, this, weaponentity, 1);
+}
+
 bool M_Wyvern_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
 {
        switch(attack_type)
@@ -101,9 +101,14 @@ bool M_Wyvern_Attack(int attack_type, entity actor, entity targ, .entity weapone
                case MONSTER_ATTACK_MELEE:
                case MONSTER_ATTACK_RANGED:
                {
-                       w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
-                       Weapon wep = WEP_WYVERN_ATTACK;
-                       wep.wr_think(wep, actor, weaponentity, 1);
+                       Monster_Delay(actor, 0, 1, M_Wyvern_Attack_Fireball);
+                       //actor.anim_finished = time + 1.2;
+                       setanim(actor, actor.anim_shoot, false, true, true);
+                       if(actor.animstate_endtime > time)
+                               actor.anim_finished = actor.animstate_endtime;
+                       else
+                               actor.anim_finished = time + 1.2;
+                       actor.attack_finished_single[0] = actor.anim_finished + 0.2;
                        return true;
                }
        }
@@ -121,6 +126,14 @@ METHOD(Wyvern, mr_think, bool(Wyvern this, entity actor))
     return true;
 }
 
+METHOD(Wyvern, mr_deadthink, bool(Wyvern this, entity actor))
+{
+    TC(Wyvern, this);
+    if(IS_ONGROUND(actor))
+       setanim(actor, actor.anim_die2, true, false, false);
+    return true;
+}
+
 METHOD(Wyvern, mr_pain, float(Wyvern this, entity actor, float damage_take, entity attacker, float deathtype))
 {
     TC(Wyvern, this);
@@ -152,7 +165,7 @@ METHOD(Wyvern, mr_anim, bool(Wyvern this, entity actor))
     actor.anim_melee = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
     actor.anim_shoot = animfixfps(actor, '6 1 5', none); // analyze models and set framerate
     actor.anim_die1 = animfixfps(actor, '7 1 0.5', none); // 2 seconds
-    //actor.anim_dead = animfixfps(actor, '8 1 0.5', none); // 2 seconds
+    actor.anim_die2 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
     return true;
 }
 #endif
index 829ea4229dd8c0832ade1658bd7059dbbdf6ed47..cbd0fe45f40f28f45cd627c55f59b1946850e37c 100644 (file)
@@ -8,7 +8,7 @@ MODEL(MON_WYVERN, M_Model("dragon.dpm"));
 
 CLASS(Wyvern, Monster)
     ATTRIB(Wyvern, spawnflags, int, MONSTER_TYPE_FLY | MON_FLAG_RANGED | MON_FLAG_RIDE);
-    ATTRIB(Wyvern, m_mins, vector, '-30 -30 -24');
+    ATTRIB(Wyvern, m_mins, vector, '-30 -30 -48');
     ATTRIB(Wyvern, m_maxs, vector, '30 30 30');
 #ifdef GAMEQC
     ATTRIB(Wyvern, m_model, Model, MDL_MON_WYVERN);
index 16f803e0c430d20e714a925ea634e7c62160f1eb..7363c35c6501fd740f36ddae56ad9601dcd6cd1a 100644 (file)
@@ -886,6 +886,9 @@ void Monster_Dead_Think(entity this)
 {
        this.nextthink = time + this.ticrate;
 
+       Monster mon = Monsters_from(this.monsterid);
+       mon.mr_deadthink(mon, this);
+
        if(this.monster_lifetime != 0)
        if(time >= this.monster_lifetime)
        {
@@ -992,6 +995,7 @@ void Monster_Dead(entity this, entity attacker, float gibbed)
        this.state                      = 0;
        this.attack_finished_single[0] = 0;
        this.effects = 0;
+       this.dphitcontentsmask &= ~DPCONTENTS_BODY;
 
        if(!((this.flags & FL_FLY) || (this.flags & FL_SWIM)))
                this.velocity = '0 0 0';
@@ -1394,7 +1398,6 @@ bool Monster_Spawn(entity this, bool check_appear, int mon_id)
        this.monster_attackfunc = mon.monster_attackfunc;
        this.monster_name               = mon.monster_name;
        this.candrop                    = true;
-       this.view_ofs                   = '0 0 0.7' * (this.maxs_z * 0.5);
        this.oldtarget2                 = this.target2;
        //this.pass_distance            = 0;
        this.deadflag                   = DEAD_NO;
@@ -1424,6 +1427,7 @@ bool Monster_Spawn(entity this, bool check_appear, int mon_id)
                this.scale *= 1.3;
 
        setsize(this, mon.m_mins * this.scale, mon.m_maxs * this.scale);
+       this.view_ofs                   = '0 0 0.7' * (this.maxs_z * 0.5);
 
        this.ticrate = bound(sys_frametime, ((!this.ticrate) ? autocvar_g_monsters_think_delay : this.ticrate), 60);