- Sound overhaul, migrated everything to A_StartSound, new sound channels, CHANF_OVERLAP where needed. - Fancy titlemap (two variants, one based on the ps2 menu, one based on the v222 menu).
228 lines
5.1 KiB
Text
228 lines
5.1 KiB
Text
Class UTArmor : Armor
|
|
{
|
|
int absorb, priority;
|
|
|
|
Property ArmorAbsorption : absorb;
|
|
Property AbsorptionPriority : priority;
|
|
|
|
Default
|
|
{
|
|
+INVENTORY.AUTOACTIVATE;
|
|
+INVENTORY.UNTOSSABLE;
|
|
+INVENTORY.KEEPDEPLETED;
|
|
+INVENTORY.ALWAYSPICKUP;
|
|
}
|
|
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 'UTArmor') || (i == self) || (UTArmor(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;
|
|
}
|
|
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
|
|
{
|
|
int saved;
|
|
if ( (amount > 0) && !DamageTypeDefinition.IgnoreArmor(damageType) )
|
|
{
|
|
saved = int(damage*absorb/100.);
|
|
if ( amount <= saved ) saved = amount;
|
|
newdamage -= saved;
|
|
amount -= saved;
|
|
damage = newdamage;
|
|
if ( amount <= 0 )
|
|
{
|
|
if ( damage > 0 ) newdamage = ApplyDamageFactors(GetClass(),damageType,damage,damage);
|
|
DepleteOrDestroy();
|
|
return;
|
|
}
|
|
}
|
|
if ( damage > 0 ) newdamage = ApplyDamageFactors(GetClass(),damageType,damage,damage);
|
|
}
|
|
}
|
|
|
|
Class UTArmorBonus : UTArmor
|
|
{
|
|
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
|
|
{
|
|
absorb = Clamp(amount*2,25,75);
|
|
Super.AbsorbDamage(damage,damageType,newdamage);
|
|
}
|
|
|
|
Default
|
|
{
|
|
Tag "$T_ARMORBONUS";
|
|
+COUNTITEM;
|
|
Inventory.Amount 5;
|
|
Inventory.MaxAmount 50;
|
|
Inventory.InterHubAmount 50;
|
|
UTArmor.ArmorAbsorption 25;
|
|
UTArmor.AbsorptionPriority 1;
|
|
Inventory.PickupMessage "$I_ARMORBONUS";
|
|
Inventory.PickupSound "misc/ut_shard";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
XANH A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class UTThighPads : UTArmor
|
|
{
|
|
override bool HandlePickup( Inventory item )
|
|
{
|
|
if ( flak_vanillaarmor && (item is 'UTThighPads') )
|
|
{
|
|
let s = Owner.FindInventory("UTShieldBelt");
|
|
if ( s )
|
|
{
|
|
// sum up current amounts
|
|
let a = Owner.FindInventory("UTBodyArmor");
|
|
int samount = s.amount;
|
|
if ( a ) samount += a.amount;
|
|
if ( amount < item.amount ) amount = item.amount;
|
|
amount = min(s.maxamount-samount,amount);
|
|
item.bPickupGood = true;
|
|
return true;
|
|
}
|
|
}
|
|
return Super.HandlePickup(item);
|
|
}
|
|
Default
|
|
{
|
|
Tag "$T_THIGHPADS";
|
|
Inventory.Amount 50;
|
|
Inventory.MaxAmount 50;
|
|
Inventory.InterHubAmount 50;
|
|
UTArmor.ArmorAbsorption 50;
|
|
UTArmor.AbsorptionPriority 7;
|
|
Inventory.PickupMessage "$I_THIGHPADS";
|
|
Inventory.PickupSound "misc/ut_armor";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
THIG A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class UTBodyArmor : UTArmor
|
|
{
|
|
override bool HandlePickup( Inventory item )
|
|
{
|
|
if ( flak_vanillaarmor && (item is 'UTBodyArmor') )
|
|
{
|
|
let s = Owner.FindInventory("UTShieldBelt");
|
|
if ( s )
|
|
{
|
|
// sum up current amounts
|
|
let p = Owner.FindInventory("UTThighPads");
|
|
int samount = s.amount;
|
|
if ( p ) samount += p.amount;
|
|
if ( amount < item.amount ) amount = item.amount;
|
|
amount = min(s.maxamount-samount,amount);
|
|
item.bPickupGood = true;
|
|
return true;
|
|
}
|
|
}
|
|
return Super.HandlePickup(item);
|
|
}
|
|
Default
|
|
{
|
|
Tag "$T_BODYARMOR";
|
|
Inventory.Amount 100;
|
|
Inventory.MaxAmount 100;
|
|
Inventory.InterHubAmount 100;
|
|
UTArmor.ArmorAbsorption 75;
|
|
UTArmor.AbsorptionPriority 7;
|
|
Inventory.PickupMessage "$I_BODYARMOR";
|
|
Inventory.PickupSound "misc/ut_armor";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UARM A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class UTShieldBelt : UTArmor
|
|
{
|
|
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
|
|
{
|
|
if ( (amount > 0) && !DamageTypeDefinition.IgnoreArmor(damageType) )
|
|
{
|
|
Owner.A_StartSound("belt/absorb",CHAN_POWERUP4,CHANF_OVERLAP);
|
|
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();
|
|
}
|
|
override bool HandlePickup( Inventory item )
|
|
{
|
|
if ( flak_vanillaarmor && ((item is 'UTBodyArmor') || (item is 'UTThighPads')) )
|
|
{
|
|
// sum up current amounts
|
|
let a = Owner.FindInventory("UTBodyArmor");
|
|
let p = Owner.FindInventory("UTThighPads");
|
|
int samount = amount;
|
|
if ( a ) samount += a.amount;
|
|
if ( p ) samount += p.amount;
|
|
item.amount = min(item.amount,maxamount-samount);
|
|
if ( item.amount <= 0 )
|
|
{
|
|
item.amount = 1;
|
|
amount -= 1;
|
|
}
|
|
}
|
|
if ( item is 'UTShieldBelt' ) Use(true);
|
|
return Super.HandlePickup(item);
|
|
}
|
|
override bool Use( bool pickup )
|
|
{
|
|
// removes thigh pads and body armor like in UT
|
|
if ( flak_vanillaarmor )
|
|
{
|
|
Owner.TakeInventory("UTThighPads",50);
|
|
Owner.TakeInventory("UTBodyArmor",150);
|
|
}
|
|
return false;
|
|
}
|
|
Default
|
|
{
|
|
Tag "$T_SHIELDBELT";
|
|
+COUNTITEM;
|
|
+INVENTORY.BIGPOWERUP;
|
|
Inventory.Amount 150;
|
|
Inventory.MaxAmount 150;
|
|
Inventory.InterHubAmount 150;
|
|
UTArmor.ArmorAbsorption 100;
|
|
UTArmor.AbsorptionPriority 10;
|
|
Inventory.PickupMessage "$I_SHIELDBELT";
|
|
Inventory.PickupSound "belt/pickup";
|
|
Inventory.RespawnTics 2100;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
BELT A -1;
|
|
Stop;
|
|
}
|
|
}
|