Flak chunk damage accumulator works properly now.
This commit is contained in:
parent
3bf0b8db74
commit
670bbb37d9
2 changed files with 36 additions and 17 deletions
|
|
@ -89,3 +89,5 @@ This mod requires GZDoom g4.3pre-79-gbcef44051 or later.
|
||||||
|
|
||||||
- Translocator allows telefragging other players in coop (no idea if I can
|
- Translocator allows telefragging other players in coop (no idea if I can
|
||||||
even fix this)
|
even fix this)
|
||||||
|
- Biorifle sludge doesn't attach properly when it lands on the edge between
|
||||||
|
sectors. This is most noticeable with moving sectors and 3d floors.
|
||||||
|
|
|
||||||
|
|
@ -109,19 +109,26 @@ Class ChunkTrail : Actor
|
||||||
|
|
||||||
Class FlakAccumulator : Thinker
|
Class FlakAccumulator : Thinker
|
||||||
{
|
{
|
||||||
Actor victim;
|
Actor victim, inflictor, source;
|
||||||
int amount;
|
Array<Int> amounts;
|
||||||
int cnt;
|
int total;
|
||||||
|
Name type;
|
||||||
|
|
||||||
override void Tick()
|
override void Tick()
|
||||||
{
|
{
|
||||||
Super.Tick();
|
Super.Tick();
|
||||||
cnt++;
|
bool oldxd = inflictor.bEXTREMEDEATH;
|
||||||
if ( cnt < 5 ) return;
|
int gibhealth = victim.GetGibHealth();
|
||||||
|
// おまえはもう死んでいる
|
||||||
|
if ( victim.health-total <= gibhealth ) inflictor.bEXTREMEDEATH = true;
|
||||||
|
// 何?
|
||||||
|
for ( int i=0; i<amounts.Size(); i++ )
|
||||||
|
victim.DamageMobj(inflictor,source,amounts[i],type,DMG_THRUSTLESS);
|
||||||
|
inflictor.bEXTREMEDEATH = oldxd;
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Accumulate( Actor victim, int amount )
|
static void Accumulate( Actor victim, int amount, Actor inflictor, Actor source, Name type )
|
||||||
{
|
{
|
||||||
let ti = ThinkerIterator.Create("FlakAccumulator",STAT_USER);
|
let ti = ThinkerIterator.Create("FlakAccumulator",STAT_USER);
|
||||||
FlakAccumulator a, match = null;
|
FlakAccumulator a, match = null;
|
||||||
|
|
@ -136,19 +143,23 @@ Class FlakAccumulator : Thinker
|
||||||
match = new("FlakAccumulator");
|
match = new("FlakAccumulator");
|
||||||
match.ChangeStatNum(STAT_USER);
|
match.ChangeStatNum(STAT_USER);
|
||||||
match.victim = victim;
|
match.victim = victim;
|
||||||
|
match.amounts.Clear();
|
||||||
}
|
}
|
||||||
match.cnt = 0;
|
match.amounts.Push(amount);
|
||||||
match.amount += amount;
|
match.total += amount;
|
||||||
|
match.inflictor = inflictor;
|
||||||
|
match.source = source;
|
||||||
|
match.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetAmount( Actor victim )
|
static clearscope int GetAmount( Actor victim )
|
||||||
{
|
{
|
||||||
let ti = ThinkerIterator.Create("FlakAccumulator",STAT_USER);
|
let ti = ThinkerIterator.Create("FlakAccumulator",STAT_USER);
|
||||||
FlakAccumulator a;
|
FlakAccumulator a, match = null;
|
||||||
while ( a = FlakAccumulator(ti.Next()) )
|
while ( a = FlakAccumulator(ti.Next()) )
|
||||||
{
|
{
|
||||||
if ( a.victim != victim ) continue;
|
if ( a.victim != victim ) continue;
|
||||||
return a.amount;
|
return a.total;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -313,18 +324,24 @@ Class FlakChunk : Actor
|
||||||
}
|
}
|
||||||
override int DoSpecialDamage( Actor target, int damage, Name damagetype )
|
override int DoSpecialDamage( Actor target, int damage, Name damagetype )
|
||||||
{
|
{
|
||||||
|
if ( bAMBUSH ) return damage;
|
||||||
if ( vel.length() <= 5.0 ) return -1;
|
if ( vel.length() <= 5.0 ) return -1;
|
||||||
FlakAccumulator.Accumulate(target,damage);
|
FlakAccumulator.Accumulate(target,damage,self,self.target,damagetype);
|
||||||
int gibhealth = (target.GibHealth==int.min)?-target.SpawnHealth():target.GibHealth;
|
bAMBUSH = true;
|
||||||
int calcdmg = FlakAccumulator.GetAmount(target);
|
|
||||||
if ( target.Health-calcdmg <= (gibhealth/2) ) bEXTREMEDEATH = true;
|
|
||||||
if ( !target.bNOBLOOD )
|
if ( !target.bNOBLOOD )
|
||||||
{
|
{
|
||||||
target.SpawnBlood(pos,AngleTo(target),damage);
|
target.SpawnBlood(pos,AngleTo(target),damage);
|
||||||
A_PlaySound("flak/meat",volume:0.3);
|
A_PlaySound("flak/meat",volume:0.3);
|
||||||
A_AlertMonsters();
|
A_AlertMonsters();
|
||||||
}
|
}
|
||||||
return damage;
|
return -1;
|
||||||
|
}
|
||||||
|
override int SpecialMissileHit( Actor victim )
|
||||||
|
{
|
||||||
|
int amt = FlakAccumulator.GetAmount(victim);
|
||||||
|
// go through actors that are already gibbed
|
||||||
|
if ( victim.health-amt <= victim.GetGibHealth() ) return 1;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
States
|
States
|
||||||
{
|
{
|
||||||
|
|
@ -368,7 +385,7 @@ Class FlakChunk : Actor
|
||||||
A_AlertMonsters();
|
A_AlertMonsters();
|
||||||
}
|
}
|
||||||
XDeath:
|
XDeath:
|
||||||
TNT1 A 1;
|
TNT1 A 2; // must exist for at least two tics so the accumulator doesn't break
|
||||||
Stop;
|
Stop;
|
||||||
Dummy:
|
Dummy:
|
||||||
FCH1 ABCDEFGHIJKL -1;
|
FCH1 ABCDEFGHIJKL -1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue