============================================*/
-.string aiment_classname;
-.float aiment_deadflag;
-void SetMovetypeFollow(entity ent, entity e)
-{
- // FIXME this may not be warpzone aware
- ent.movetype = MOVETYPE_FOLLOW; // make the hole follow
- ent.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid - this means this cannot be teleported by warpzones any more! Instead, we must notice when our owner gets teleported.
- ent.aiment = e; // make the hole follow bmodel
- ent.punchangle = e.angles; // the original angles of bmodel
- ent.view_ofs = ent.origin - e.origin; // relative origin
- ent.v_angle = ent.angles - e.angles; // relative angles
- ent.aiment_classname = strzone(e.classname);
- ent.aiment_deadflag = e.deadflag;
-}
-void UnsetMovetypeFollow(entity ent)
-{
- ent.movetype = MOVETYPE_FLY;
- PROJECTILE_MAKETRIGGER(ent);
- ent.aiment = world;
-}
-float LostMovetypeFollow(entity ent)
-{
-/*
- if(ent.movetype != MOVETYPE_FOLLOW)
- if(ent.aiment)
- error("???");
-*/
- if(ent.aiment)
- {
- if(ent.aiment.classname != ent.aiment_classname)
- return 1;
- if(ent.aiment.deadflag != ent.aiment_deadflag)
- return 1;
- }
- return 0;
-}
-
.float hook_length;
.float hook_switchweapon;
e.think = defer_think;
e.nextthink = time + fdelay;
}
+
+.string aiment_classname;
+.float aiment_deadflag;
+void SetMovetypeFollow(entity ent, entity e)
+{
+ // FIXME this may not be warpzone aware
+ ent.movetype = MOVETYPE_FOLLOW; // make the hole follow
+ ent.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid - this means this cannot be teleported by warpzones any more! Instead, we must notice when our owner gets teleported.
+ ent.aiment = e; // make the hole follow bmodel
+ ent.punchangle = e.angles; // the original angles of bmodel
+ ent.view_ofs = ent.origin - e.origin; // relative origin
+ ent.v_angle = ent.angles - e.angles; // relative angles
+ ent.aiment_classname = strzone(e.classname);
+ ent.aiment_deadflag = e.deadflag;
+}
+void UnsetMovetypeFollow(entity ent)
+{
+ ent.movetype = MOVETYPE_FLY;
+ PROJECTILE_MAKETRIGGER(ent);
+ ent.aiment = world;
+}
+float LostMovetypeFollow(entity ent)
+{
+/*
+ if(ent.movetype != MOVETYPE_FOLLOW)
+ if(ent.aiment)
+ error("???");
+*/
+ if(ent.aiment)
+ {
+ if(ent.aiment.classname != ent.aiment_classname)
+ return 1;
+ if(ent.aiment.deadflag != ent.aiment_deadflag)
+ return 1;
+ }
+ return 0;
+}
weapon_defaultspawnfunc(WEP_MINE_LAYER);
}
-void W_Mine_Stick ()
+void W_Mine_Stick (entity to)
{
spamsound (self, CHAN_PROJECTILE, "weapons/mine_stick.wav", VOL_BASE, ATTN_NORM);
remove(self);
self = newmine;
+
+ if(to)
+ SetMovetypeFollow(self, to);
}
void W_Mine_Explode ()
self.event_damage = SUB_Null;
self.takedamage = DAMAGE_NO;
- if(self.movetype == MOVETYPE_NONE)
+ if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
self.velocity = self.oldvelocity;
RadiusDamage (self, self.owner, autocvar_g_balance_minelayer_remote_damage, autocvar_g_balance_minelayer_remote_edgedamage, autocvar_g_balance_minelayer_remote_radius, world, autocvar_g_balance_minelayer_remote_force, self.projectiledeathtype | HITTYPE_BOUNCE, world);
entity head;
self.nextthink = time;
+
+ if(self.movetype == MOVETYPE_FOLLOW)
+ {
+ if(LostMovetypeFollow(self))
+ {
+ UnsetMovetypeFollow(self);
+ self.movetype = MOVETYPE_NONE;
+ }
+ }
// our lifetime has expired, it's time to die - mine_time just allows us to play a sound for this
// TODO: replace this mine_trigger.wav sound with a real countdown
void W_Mine_Touch (void)
{
PROJECTILE_TOUCH;
- if(!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))
- W_Mine_Stick();
- else if(self.movetype != MOVETYPE_NONE) // don't unstick a locked mine when someone touches it
- self.velocity = '0 0 0';
+
+ if(other && other.takedamage == DAMAGE_AIM)
+ {
+ // hit some enemy
+ // we do nothing, other than clearing velocity (falling straight down)
+ // but only if we're still moving (not stuck yet)
+ if(self.movetype != MOVETYPE_NONE && self.movetype != MOVETYPE_FOLLOW)
+ {
+ // allow falling down, but no other movement, when hit an enemy
+ self.velocity_x = 0;
+ self.velocity_y = 0;
+ if(self.velocity_z > 0)
+ self.velocity_z = 0;
+ }
+ }
+ else
+ {
+ W_Mine_Stick(other);
+ }
}
void W_Mine_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)