- Corrections on Power Shield behaviour, added option to make it absorb damage normally like in Unreal instead of individual hits, although this will make it less viable as an Invulnerability replacement.
343 lines
7.3 KiB
Text
343 lines
7.3 KiB
Text
Class UnrealArmor : UTArmor
|
|
{
|
|
int priority;
|
|
|
|
Property AbsorptionPriority : priority;
|
|
|
|
Default
|
|
{
|
|
-INVENTORY.ALWAYSPICKUP;
|
|
UnrealArmor.AbsorptionPriority 0;
|
|
}
|
|
|
|
override void AttachToOwner( Actor other )
|
|
{
|
|
Super.AttachToOwner(other);
|
|
// find last armor that's better than us
|
|
Inventory found = null;
|
|
for ( Inventory i=other.Inv; i; i=i.Inv )
|
|
{
|
|
if ( !(i is 'UnrealArmor') || (i == self) || (UnrealArmor(i).priority < priority) ) continue;
|
|
found = i;
|
|
}
|
|
if ( !found ) return;
|
|
// place ourselves right after it
|
|
Inventory saved = found.Inv;
|
|
found.Inv = self;
|
|
other.Inv = Inv;
|
|
Inv = saved;
|
|
}
|
|
}
|
|
|
|
Class UArmor : UnrealArmor
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_UARMOR";
|
|
Inventory.Amount 100;
|
|
Inventory.MaxAmount 100;
|
|
Inventory.InterHubAmount 100;
|
|
UTArmor.ArmorAbsorption 90;
|
|
UnrealArmor.AbsorptionPriority 7;
|
|
Inventory.PickupMessage "$I_UARMOR";
|
|
Inventory.PickupSound "misc/u1armor";
|
|
Inventory.Icon "I_Armor";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UARM A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class AsbestosSuit : UnrealArmor
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_ASBSUIT";
|
|
Inventory.Amount 50;
|
|
Inventory.MaxAmount 50;
|
|
Inventory.InterHubAmount 50;
|
|
UTArmor.ArmorAbsorption 50;
|
|
UnrealArmor.AbsorptionPriority 6;
|
|
Inventory.PickupMessage "$I_ASBSUIT";
|
|
Inventory.PickupSound "misc/suit";
|
|
Inventory.Icon "I_Suit";
|
|
}
|
|
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
|
|
{
|
|
if ( passive && (Amount > 0) && ((damageType == 'Fire') || (damageType == 'Ice')) )
|
|
newdamage = 0;
|
|
}
|
|
override void AttachToOwner( Actor other )
|
|
{
|
|
Super.AttachToOwner(other);
|
|
if ( sting_allsuits ) return;
|
|
// remove other suits
|
|
Inventory i = other.FindInventory("ToxinSuit");
|
|
if ( i ) other.RemoveInventory(i);
|
|
i = other.FindInventory("KevlarSuit");
|
|
if ( i ) other.RemoveInventory(i);
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
ASBS A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class ToxinSuit : UnrealArmor
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_TOXSUIT";
|
|
Inventory.Amount 50;
|
|
Inventory.MaxAmount 50;
|
|
Inventory.InterHubAmount 50;
|
|
UTArmor.ArmorAbsorption 50;
|
|
UnrealArmor.AbsorptionPriority 6;
|
|
Inventory.PickupMessage "$I_TOXSUIT";
|
|
Inventory.PickupSound "misc/suit";
|
|
Inventory.Icon "I_TSuit";
|
|
}
|
|
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags )
|
|
{
|
|
if ( passive && (Amount > 0) && ((damageType == 'Slime') || (damageType == 'Poison')) )
|
|
newdamage = 0;
|
|
}
|
|
override void AttachToOwner( Actor other )
|
|
{
|
|
Super.AttachToOwner(other);
|
|
if ( sting_allsuits ) return;
|
|
// remove other suits
|
|
Inventory i = other.FindInventory("AsbestosSuit");
|
|
if ( i ) other.RemoveInventory(i);
|
|
i = other.FindInventory("KevlarSuit");
|
|
if ( i ) other.RemoveInventory(i);
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
TOXS A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class KevlarSuit : UnrealArmor
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_KEVSUIT";
|
|
Inventory.Amount 100;
|
|
Inventory.MaxAmount 100;
|
|
Inventory.InterHubAmount 100;
|
|
UTArmor.ArmorAbsorption 80;
|
|
UnrealArmor.AbsorptionPriority 6;
|
|
Inventory.PickupMessage "$I_KEVSUIT";
|
|
Inventory.PickupSound "misc/suit";
|
|
Inventory.Icon "I_Kevlar";
|
|
}
|
|
override void AttachToOwner( Actor other )
|
|
{
|
|
Super.AttachToOwner(other);
|
|
if ( sting_allsuits ) return;
|
|
// remove other suits
|
|
Inventory i = other.FindInventory("AsbestosSuit");
|
|
if ( i ) other.RemoveInventory(i);
|
|
i = other.FindInventory("ToxinSuit");
|
|
if ( i ) other.RemoveInventory(i);
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
KEVS A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class ShieldBelt : UnrealArmor
|
|
{
|
|
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
|
|
{
|
|
if ( (damage > 0) && (amount > 0) && !DamageTypeDefinition.IgnoreArmor(damageType) )
|
|
{
|
|
Owner.A_PlaySound("belt/absorb",CHAN_7);
|
|
UTMainHandler.DoFlash(Owner,Color(80,255,224,0),5);
|
|
}
|
|
Super.AbsorbDamage(damage,damageType,newdamage);
|
|
}
|
|
override void DepleteOrDestroy()
|
|
{
|
|
if ( (amount <= 0) && Owner.CheckLocalView() )
|
|
Console.Printf(StringTable.Localize("$D_SHIELDBELT"));
|
|
Super.DepleteOrDestroy();
|
|
}
|
|
Default
|
|
{
|
|
Tag "$T_SHIELDBELT";
|
|
+COUNTITEM;
|
|
+INVENTORY.BIGPOWERUP;
|
|
+INVENTORY.ALWAYSPICKUP;
|
|
Inventory.Amount 100;
|
|
Inventory.MaxAmount 100;
|
|
Inventory.InterHubAmount 100;
|
|
UTArmor.ArmorAbsorption 100;
|
|
UnrealArmor.AbsorptionPriority 10;
|
|
Inventory.PickupMessage "$I_SHIELDBELT";
|
|
Inventory.PickupSound "belt/pickup";
|
|
Inventory.RespawnTics 2100;
|
|
Inventory.Icon "I_Shield";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
BELT A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class PowerShield : UnrealArmor
|
|
{
|
|
bool gothit;
|
|
int draintimer;
|
|
|
|
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
|
|
{
|
|
if ( (damage > 0) && (amount > 0) && !DamageTypeDefinition.IgnoreArmor(damageType) )
|
|
{
|
|
Owner.A_PlaySound("belt/absorb",CHAN_7);
|
|
UTMainHandler.DoFlash(Owner,Color(80,224,0,255),5);
|
|
if ( !sting_pshield )
|
|
{
|
|
gothit = true;
|
|
damage = 0;
|
|
newdamage = 0;
|
|
}
|
|
}
|
|
if ( sting_pshield )
|
|
{
|
|
Super.AbsorbDamage(damage,damageType,newdamage);
|
|
return;
|
|
}
|
|
if ( damage > 0 ) newdamage = ApplyDamageFactors(GetClass(),damageType,damage,damage);
|
|
}
|
|
override void DepleteOrDestroy()
|
|
{
|
|
if ( (amount <= 0) && Owner.CheckLocalView() )
|
|
Console.Printf(StringTable.Localize("$D_POWERSHIELD"));
|
|
Super.DepleteOrDestroy();
|
|
}
|
|
override void Tick()
|
|
{
|
|
Super.Tick();
|
|
if ( !Owner || !Owner.player ) return;
|
|
if ( gothit )
|
|
{
|
|
amount--;
|
|
gothit = false;
|
|
}
|
|
draintimer++;
|
|
if ( draintimer > 35 )
|
|
{
|
|
amount--;
|
|
draintimer = 0;
|
|
}
|
|
if ( amount <= 0 ) DepleteOrDestroy();
|
|
}
|
|
Default
|
|
{
|
|
Tag "$T_POWERSHIELD";
|
|
+COUNTITEM;
|
|
+INVENTORY.BIGPOWERUP;
|
|
+INVENTORY.ALWAYSPICKUP;
|
|
Inventory.Amount 200;
|
|
Inventory.MaxAmount 200;
|
|
Inventory.InterHubAmount 200;
|
|
UTArmor.ArmorAbsorption 100;
|
|
UnrealArmor.AbsorptionPriority 11; // wow dude
|
|
Inventory.PickupMessage "$I_POWERSHIELD";
|
|
Inventory.PickupSound "sbelt/pickup";
|
|
Inventory.RespawnTics 3500;
|
|
Inventory.Icon "I_PBelt";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
BELT A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class UArmorBonus : UArmor
|
|
{
|
|
override bool TryPickup( in out Actor toucher )
|
|
{
|
|
if ( !sting_abonus ) return false; // not allowed
|
|
bool valid = Super.TryPickup(toucher);
|
|
if ( valid ) level.allmap = true;
|
|
return valid;
|
|
}
|
|
override void Tick()
|
|
{
|
|
Super.Tick();
|
|
if ( sting_abonus ) return;
|
|
if ( !Owner )
|
|
{
|
|
let r = Spawn("ArmorBonus",pos,ALLOW_REPLACE);
|
|
r.spawnangle = spawnangle;
|
|
r.spawnpoint = spawnpoint;
|
|
r.angle = angle;
|
|
r.pitch = pitch;
|
|
r.roll = roll;
|
|
r.special = special;
|
|
r.args[0] = args[0];
|
|
r.args[1] = args[1];
|
|
r.args[2] = args[2];
|
|
r.args[3] = args[3];
|
|
r.args[4] = args[4];
|
|
r.ChangeTid(tid);
|
|
r.SpawnFlags = SpawnFlags&~MTF_SECRET;
|
|
r.HandleSpawnFlags();
|
|
r.SpawnFlags = SpawnFlags;
|
|
r.bCountSecret = SpawnFlags&MTF_SECRET;
|
|
r.vel = vel;
|
|
r.master = master;
|
|
r.target = target;
|
|
r.tracer = tracer;
|
|
r.bDropped = bDropped;
|
|
Destroy();
|
|
}
|
|
else
|
|
{
|
|
Owner.RemoveInventory(self);
|
|
Destroy();
|
|
}
|
|
}
|
|
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
|
|
{
|
|
absorb = Clamp(Amount-50,25,100);
|
|
Super.AbsorbDamage(damage,damageType,newdamage);
|
|
}
|
|
Default
|
|
{
|
|
Tag "$T_ARMORBONUS";
|
|
+COUNTITEM;
|
|
+INVENTORY.ALWAYSPICKUP;
|
|
Inventory.Amount 5;
|
|
Inventory.MaxAmount 200;
|
|
Inventory.InterHubAmount 200;
|
|
UTArmor.ArmorAbsorption 25;
|
|
UnrealArmor.AbsorptionPriority 1;
|
|
Inventory.PickupMessage "$I_ARMORBONUS";
|
|
Inventory.PickupSound "misc/u1armor";
|
|
Inventory.Icon "I_Bonus";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XANH A -1;
|
|
Stop;
|
|
}
|
|
}
|