Pistol start tweaking.
This commit is contained in:
parent
46c5ee866e
commit
ade23e99fc
8 changed files with 138 additions and 30 deletions
|
|
@ -106,16 +106,15 @@ extend Class SWWMHandler
|
|||
}
|
||||
// end of episode resets and enforced pistol starts
|
||||
LevelInfo nextlv = LevelInfo.FindLevelInfo(e.NextMap);
|
||||
if ( (level.nextsecretmap.Left(6) == "enDSeQ")
|
||||
|| (swwm_pistolstart && nextlv && (level.cluster != nextlv.cluster))
|
||||
|| ((swwm_pistolstart == 1) && !(level.clusterflags&LevelLocals.CLUSTER_HUB)) )
|
||||
for ( int i=0; i<MAXPLAYERS; i++ )
|
||||
{
|
||||
for ( int i=0; i<MAXPLAYERS; i++ )
|
||||
{
|
||||
if ( !playeringame[i] || !players[i].mo || (players[i].playerstate == PST_DEAD) ) continue;
|
||||
players[i].mo.GiveInventory("InventoryWipeToken",1);
|
||||
// the playerpawn will know what to do with this in its PreTravelled()
|
||||
}
|
||||
if ( !playeringame[i] || !players[i].mo || (players[i].playerstate == PST_DEAD) ) continue;
|
||||
let demo = Demolitionist(players[i].mo);
|
||||
if ( !demo ) continue;
|
||||
if ( level.nextsecretmap.Left(6) == "enDSeQ" ) demo.invwipe |= Demolitionist.WIPE_EPISODE;
|
||||
if ( nextlv && (level.cluster!=nextlv.cluster) ) demo.invwipe |= (Demolitionist.WIPE_CLUSTER|Demolitionist.WIPE_MAP);
|
||||
if ( !(level.clusterflags&LevelLocals.CLUSTER_HUB) ) demo.invwipe |= Demolitionist.WIPE_MAP;
|
||||
// the playerpawn will know what to do with this in its PreTravelled()
|
||||
}
|
||||
// did we complete this map without collecting any of its keys? (doesn't work for hubs)
|
||||
if ( (mapkeys.Size() > 0) && !(level.clusterflags&LevelLocals.CLUSTER_HUB) )
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// The Demolitionist
|
||||
|
||||
Class Demolitionist : PlayerPawn
|
||||
{
|
||||
int last_jump_held, last_boost, last_kick;
|
||||
|
|
@ -75,6 +76,15 @@ Class Demolitionist : PlayerPawn
|
|||
|
||||
transient bool bWalking;
|
||||
|
||||
enum EInvWipe
|
||||
{
|
||||
WIPE_EPISODE = 1,
|
||||
WIPE_CLUSTER = 2,
|
||||
WIPE_MAP = 4
|
||||
}
|
||||
|
||||
int invwipe; // inventory wipe flags for next level
|
||||
|
||||
Property DashFuel : dashfuel;
|
||||
|
||||
Default
|
||||
|
|
@ -2935,8 +2945,56 @@ Class Demolitionist : PlayerPawn
|
|||
// clean up attached actors
|
||||
if ( selflight ) selflight.Destroy();
|
||||
// inventory wipes
|
||||
if ( FindInventory("InventoryWipeToken") && (player.playerstate != PST_DEAD) )
|
||||
SWWMUtility.WipeInventory(self,swwm_resetscore);
|
||||
if ( invwipe && (player.playerstate != PST_DEAD) )
|
||||
{
|
||||
bool wiped = false;
|
||||
bool resetammo = false;
|
||||
bool resetitems = false;
|
||||
bool resethealth = false;
|
||||
if ( invwipe&WIPE_EPISODE )
|
||||
{
|
||||
SWWMUtility.WipeInventory(self,swwm_resetscore);
|
||||
wiped = true;
|
||||
}
|
||||
if ( invwipe&WIPE_CLUSTER )
|
||||
{
|
||||
if ( (swwm_ps_fullreset == 2) && !wiped )
|
||||
{
|
||||
SWWMUtility.WipeInventory(self,swwm_resetscore);
|
||||
wiped = true;
|
||||
}
|
||||
if ( (swwm_ps_resetammo == 2) && !wiped )
|
||||
{
|
||||
SWWMUtility.ResetAmmo(self);
|
||||
resetammo = true;
|
||||
}
|
||||
if ( (swwm_ps_resetitems == 2) && !wiped )
|
||||
{
|
||||
SWWMUtility.ResetItems(self);
|
||||
resetitems = true;
|
||||
}
|
||||
if ( (swwm_ps_resethealth == 2) && !wiped )
|
||||
{
|
||||
SWWMUtility.ResetHealth(self);
|
||||
resethealth = true;
|
||||
}
|
||||
}
|
||||
if ( invwipe&WIPE_MAP )
|
||||
{
|
||||
if ( (swwm_ps_fullreset == 1) && !wiped )
|
||||
{
|
||||
SWWMUtility.WipeInventory(self,swwm_resetscore);
|
||||
wiped = true;
|
||||
}
|
||||
if ( (swwm_ps_resetammo == 1) && !wiped && !resetammo )
|
||||
SWWMUtility.ResetAmmo(self);
|
||||
if ( (swwm_ps_resetitems == 1) && !wiped && !resetitems )
|
||||
SWWMUtility.ResetItems(self);
|
||||
if ( (swwm_ps_resethealth == 1) && !wiped && !resethealth )
|
||||
SWWMUtility.ResetHealth(self);
|
||||
}
|
||||
}
|
||||
invwipe = 0;
|
||||
}
|
||||
override void Travelled()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1876,6 +1876,50 @@ Class SWWMUtility
|
|||
p.health = p.mo.Health = p.mo.SpawnHealth();
|
||||
}
|
||||
|
||||
// sets all carried ammo back to zero
|
||||
static play void ResetAmmo( Actor mo )
|
||||
{
|
||||
PlayerInfo p = mo.player;
|
||||
if ( !p || !p.mo ) return;
|
||||
for ( Inventory i=p.mo.inv; i; i=i.inv )
|
||||
{
|
||||
if ( !(i is 'Ammo') ) continue;
|
||||
i.Amount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// removes all carried items that aren't weapons or ammo
|
||||
static play void ResetItems( Actor mo )
|
||||
{
|
||||
PlayerInfo p = mo.player;
|
||||
if ( !p || !p.mo ) return;
|
||||
Actor last = p.mo;
|
||||
while ( last.inv )
|
||||
{
|
||||
let inv = last.inv;
|
||||
if ( (inv is 'SWWMCollectible') || (inv is 'Weapon') || (inv is 'Ammo') || (inv is 'SWWMArmor') )
|
||||
{
|
||||
last = inv;
|
||||
continue;
|
||||
}
|
||||
inv.Destroy();
|
||||
if ( !inv.bDestroyed ) last = inv;
|
||||
}
|
||||
}
|
||||
|
||||
// resets health and removes worn armor
|
||||
static play void ResetHealth( Actor mo )
|
||||
{
|
||||
PlayerInfo p = mo.player;
|
||||
if ( !p || !p.mo ) return;
|
||||
p.health = p.mo.health = 100;
|
||||
for ( Inventory i=p.mo.inv; i; i=i.inv )
|
||||
{
|
||||
if ( !(i is 'SWWMArmor') ) continue;
|
||||
i.Amount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// WHACK
|
||||
static play void EndLevelDie( Actor victim )
|
||||
{
|
||||
|
|
@ -2229,14 +2273,3 @@ Class ShinemapDebugSphere : Actor
|
|||
Loop;
|
||||
}
|
||||
}
|
||||
|
||||
// used to indicate that the next level resets inventory
|
||||
Class InventoryWipeToken : Inventory
|
||||
{
|
||||
default
|
||||
{
|
||||
+INVENTORY.UNDROPPABLE;
|
||||
+INVENTORY.UNTOSSABLE;
|
||||
+INVENTORY.UNCLEARABLE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue