From 00f150b8326d36a1d425ac61da43ae41a6faf23b Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Tue, 25 Jan 2022 01:40:52 +0100 Subject: [PATCH] A collection of hackfixes related to items. --- language.version | 4 +- zscript/handler/swwm_handler_process.zsc | 2 +- zscript/handler/swwm_handler_worldtick.zsc | 13 +- zscript/hud/swwm_hud.zsc | 21 ++- zscript/items/swwm_armor.zsc | 6 +- zscript/items/swwm_basearmor.zsc | 39 ++--- zscript/items/swwm_basehealth.zsc | 11 +- zscript/items/swwm_powerups.zsc | 173 +++++---------------- zscript/swwm_player.zsc | 33 ++-- zscript/swwm_player_items.zsc | 51 ++---- zscript/swwm_statichandler.zsc | 2 +- 11 files changed, 104 insertions(+), 251 deletions(-) diff --git a/language.version b/language.version index c02140181..6451fb19b 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.2pre r128 \cu(Sun 23 Jan 20:49:20 CET 2022)\c-"; -SWWM_SHORTVER="\cw1.2pre r128 \cu(2022-01-23 20:49:20)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.2pre r129 \cu(Tue 25 Jan 01:40:52 CET 2022)\c-"; +SWWM_SHORTVER="\cw1.2pre r129 \cu(2022-01-25 01:40:52)\c-"; diff --git a/zscript/handler/swwm_handler_process.zsc b/zscript/handler/swwm_handler_process.zsc index 8402296b4..18e7e43a9 100644 --- a/zscript/handler/swwm_handler_process.zsc +++ b/zscript/handler/swwm_handler_process.zsc @@ -27,7 +27,7 @@ extend Class SWWMHandler { if ( (gamestate != GS_LEVEL) || (players[consoleplayer].Health <= 0) || !(players[consoleplayer].mo is 'Demolitionist') ) return; - double maxval = players[consoleplayer].mo.FindInventory("Omnisight")?2.:1.; + double maxval = level.allmap?2.:1.; double val = swwm_mm_zoom; if ( val >= 1. ) val = min(maxval,val+.5); else val = min(1.,val+.25); diff --git a/zscript/handler/swwm_handler_worldtick.zsc b/zscript/handler/swwm_handler_worldtick.zsc index d0d991ff5..fd53b25a0 100644 --- a/zscript/handler/swwm_handler_worldtick.zsc +++ b/zscript/handler/swwm_handler_worldtick.zsc @@ -239,7 +239,6 @@ extend Class SWWMHandler return; } // update trackers for anything around the player - bool thesight = players[consoleplayer].mo.FindInventory("Omnisight"); double viewdist = SWWMStatusBar.MAPVIEWDIST*swwm_mm_zoom; BlockThingsIterator bt = BlockThingsIterator.Create(players[consoleplayer].Camera,viewdist); while ( bt.Next() ) @@ -255,7 +254,7 @@ extend Class SWWMHandler continue; if ( !a.player && !a.bSOLID && !a.bSHOOTABLE && !a.bISMONSTER && !a.bFRIENDLY && !(a is 'Inventory') && !(a is 'Chancebox') ) continue; - if ( !thesight && !(deathmatch && (a is 'Inventory') && !a.bDROPPED) && !(a.IsFriend(players[consoleplayer].mo) && !(a.player && (a.player.mo != a))) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) + if ( !level.allmap && !(deathmatch && (a is 'Inventory') && !a.bDROPPED) && !(a.IsFriend(players[consoleplayer].mo) && !(a.player && (a.player.mo != a))) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; if ( a.bKILLED || (a.Health <= 0) || a.bUnmorphed ) continue; @@ -273,7 +272,7 @@ extend Class SWWMHandler Vector2 rv = a.pos.xy-players[consoleplayer].Camera.pos.xy; if ( max(abs(rv.x)-a.radius,abs(rv.y)-a.radius) > viewdist ) continue; - if ( !thesight && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) + if ( !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; SWWMSimpleTracker.Track(a); } @@ -285,7 +284,7 @@ extend Class SWWMHandler double rad = a.speed*cos(a.pitch); if ( max(abs(rv.x)-rad,abs(rv.y)-rad) > viewdist ) continue; - if ( !thesight && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) + if ( !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; SWWMSimpleTracker.Track(a); } @@ -313,7 +312,7 @@ extend Class SWWMHandler continue; if ( !a.player && !a.bSOLID && !a.bSHOOTABLE && !a.bISMONSTER && !a.bFRIENDLY && !(a is 'Inventory') && !(a is 'Chancebox') ) continue; - if ( !thesight && !(deathmatch && (a is 'Inventory') && !a.bDROPPED) && !a.IsFriend(players[consoleplayer].mo) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) + if ( !level.allmap && !(deathmatch && (a is 'Inventory') && !a.bDROPPED) && !a.IsFriend(players[consoleplayer].mo) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; if ( a.bKILLED || (a.Health <= 0) || a.bUnmorphed ) continue; @@ -331,7 +330,7 @@ extend Class SWWMHandler Vector2 rv = a.pos.xy-relpos; if ( max(abs(rv.x)-a.radius,abs(rv.y)-a.radius) > viewdist ) continue; - if ( !thesight && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) + if ( !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; SWWMSimpleTracker.Track(a); } @@ -343,7 +342,7 @@ extend Class SWWMHandler double rad = a.speed*cos(a.pitch); if ( max(abs(rv.x)-rad,abs(rv.y)-rad) > viewdist ) continue; - if ( !thesight && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) + if ( !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; SWWMSimpleTracker.Track(a); } diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index 854061e7f..59517a9ff 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -902,8 +902,7 @@ Class SWWMStatusBar : BaseStatusBar // let weapons update their own interpolators if ( CPlayer.ReadyWeapon is 'SWWMWeapon' ) SWWMWeapon(CPlayer.ReadyWeapon).HudTick(); - bool thesight = CPlayer.mo.FindInventory("Omnisight"); - double desiredzoom = clamp(swwm_mm_zoom,.5,thesight?2.:1.); + double desiredzoom = clamp(swwm_mm_zoom,.5,level.allmap?2.:1.); if ( (minimapzoom != swwm_mm_zoom) || (oldminimapzoom != swwm_mm_zoom) ) { oldminimapzoom = minimapzoom; @@ -915,7 +914,7 @@ Class SWWMStatusBar : BaseStatusBar let cam = players[consoleplayer].camera; Vector3 viewvec = (cos(viewrot.x)*cos(viewrot.y),sin(viewrot.x)*cos(viewrot.y),sin(-viewrot.y)); int sz; - if ( thesight && swwm_pois ) + if ( level.allmap && swwm_pois ) { // update omnisight stuff if ( intpoints.Size() != hnd.intpoints_cnt ) @@ -952,7 +951,7 @@ Class SWWMStatusBar : BaseStatusBar if ( trk.mytarget == CPlayer.mo ) continue; if ( trk.mytarget is 'PlayerGone' ) continue; // ignore "gone" players int mtime = 35; - if ( thesight && (trk.lasthealth > 0) ) mtime += 105; + if ( level.allmap && (trk.lasthealth > 0) ) mtime += 105; if ( level.maptime > trk.updated+mtime ) continue; // ignore trackers clearly outside of player view Vector3 tdir = level.Vec3Diff(viewpos,trk.pos); @@ -1028,7 +1027,7 @@ Class SWWMStatusBar : BaseStatusBar i = 0; for ( SWWMItemSense s=demo.itemsense; s; s=s.next ) { - if ( !thesight && (level.maptime > s.updated+35) ) continue; + if ( !level.allmap && (level.maptime > s.updated+35) ) continue; // ignore points clearly outside of player view Vector3 tdir = level.Vec3Diff(viewpos,s.pos); if ( viewvec dot tdir < 0 ) continue; @@ -1183,10 +1182,9 @@ Class SWWMStatusBar : BaseStatusBar SWWMUtility.PrepareProjData(projdata,ViewPos,ViewRot.x,ViewRot.y,ViewRot.z,players[consoleplayer].fov); int cliptop = projdata.viewy, clipbottom = projdata.viewy+projdata.viewh, clipleft = projdata.viewx, clipright = projdata.viewx+projdata.vieww; - bool thesight = !!CPlayer.mo.FindInventory("Omnisight"); // points of interest String tag; - if ( thesight ) + if ( level.allmap ) { for ( int i=0; i= 1. ) continue; Vector2 vpos = SWWMUtility.NDCToViewport(projdata,ndc); - int mtime = thesight?70:35; + int mtime = level.allmap?70:35; double alph = clamp(((s.updated+mtime)-(level.maptime+fractic))/35.,0.,1.); - alph *= clamp(1.5-1.5*(tdir.length()/(thesight?1200.:800.)),0.,1.); + alph *= clamp(1.5-1.5*(tdir.length()/(level.allmap?1200.:800.)),0.,1.); tag = s.tag; Screen.DrawText(smallfont2,s.vipitem?Font.CR_PURPLE:s.scoreitem?Font.CR_GOLD:Font.CR_GREEN,(vpos.x-hsd*smallfont2.StringWidth(tag)/2.)/hsd,(vpos.y-hsd*smallfont2.GetHeight()/2.)/hsd,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); tag = String.Format("\cu(%s\cu)\c-",FormatDist(tdir.length())); @@ -1283,7 +1281,7 @@ Class SWWMStatusBar : BaseStatusBar if ( targ.bFRIENDLY ) tag = "\cg♥\c- "..tag.." \cg♥\c-"; } int mtime = 35; - if ( thesight && (targ.lasthealth > 0) ) mtime += 105; + if ( level.allmap && (targ.lasthealth > 0) ) mtime += 105; double alph = clamp(((targ.updated+mtime)-(level.maptime+fractic))/35.,0.,1.); Vector2 barsiz = TexMan.GetScaledSize(EnemyBTex); barsiz.x *= hsb; @@ -1976,7 +1974,6 @@ Class SWWMStatusBar : BaseStatusBar } private void DrawMapThings( Vector2 basepos ) { - bool thesight = !!CPlayer.mo.FindInventory("Omnisight"); double zoomlevel = oldminimapzoom*(1.-FracTic)+minimapzoom*FracTic; double zoomview = MAPVIEWDIST*zoomlevel, zoomclip = CLIPDIST*zoomlevel; Vector2 cpos = players[consoleplayer].Camera.prev.xy*(1.-FracTic)+players[consoleplayer].Camera.pos.xy*FracTic; @@ -2021,7 +2018,7 @@ Class SWWMStatusBar : BaseStatusBar plainactor = true; } int mtime = 35; - if ( thesight && !t.expired && t.target ) mtime += 105; + if ( level.allmap && !t.expired && t.target ) mtime += 105; Vector2 rv = pos-cpos; bool isportal = false; if ( swwm_mm_portaloverlay ) diff --git a/zscript/items/swwm_armor.zsc b/zscript/items/swwm_armor.zsc index 4f9139738..38da632f8 100644 --- a/zscript/items/swwm_armor.zsc +++ b/zscript/items/swwm_armor.zsc @@ -7,7 +7,7 @@ Class ArmorNugget : SWWMArmor Inventory.Amount 1; Inventory.MaxAmount 200; Inventory.InterHubAmount 200; - SWWMArmor.ArmorPriority 1; + SWWMArmor.ArmorPriority 3; SWWMArmor.GiverArmor "ArmorNuggetItem"; } @@ -73,7 +73,7 @@ Class BlastSuit : SWWMArmor Inventory.MaxAmount 150; Inventory.InterHubAmount 150; Inventory.RestrictedTo "Demolitionist"; - SWWMArmor.ArmorPriority 2; + SWWMArmor.ArmorPriority 4; SWWMArmor.DrainMessage "$D_BLASTSUIT"; SWWMArmor.GiverArmor "BlastSuitItem"; } @@ -126,7 +126,7 @@ Class WarArmor : SWWMArmor Inventory.MaxAmount 250; Inventory.InterHubAmount 250; Inventory.RestrictedTo "Demolitionist"; - SWWMArmor.ArmorPriority 6; + SWWMArmor.ArmorPriority 5; SWWMArmor.DrainMessage "$D_WARARMOR"; SWWMArmor.GiverArmor "WarArmorItem"; } diff --git a/zscript/items/swwm_basearmor.zsc b/zscript/items/swwm_basearmor.zsc index e1d843187..b11f73dab 100644 --- a/zscript/items/swwm_basearmor.zsc +++ b/zscript/items/swwm_basearmor.zsc @@ -4,11 +4,17 @@ Class SWWMArmor : Armor abstract int priority; String drainmsg; Class parent; + private int SArmorFlags; Property ArmorPriority : priority; Property DrainMessage : drainmsg; Property GiverArmor : parent; + FlagDef NoHitFlash : SArmorFlags, 0; // doesn't flash when taking damage + FlagDef NoHitSound : SArmorFlags, 1; // doesn't play a sound when taking damage + FlagDef NoDrain : SArmorFlags, 2; // amount is not drained, will always reduce as long as amount is non-zero + // useful for powerup-given armors + Default { +INVENTORY.AUTOACTIVATE; @@ -39,22 +45,6 @@ Class SWWMArmor : Armor abstract } } if ( !found ) - { - // is first item plating or a collar? - if ( (other.Inv is 'AlmasteelPlating') || (other.Inv is 'SayaCollar') ) - { - // we're good - return; - } - // find first item with plating or collar after it - for ( Inventory i=other.Inv; i; i=i.Inv ) - { - if ( (i == self) || (!(i.Inv is 'AlmasteelPlating' ) && !(i.Inv is 'SayaCollar')) ) continue; - found = i; - break; - } - } - if ( !found ) { // check if first item in inventory is health or a sandwich if ( (other.Inv is 'SWWMHealth') || (other.Inv is 'GrilledCheeseSandwich') ) @@ -70,15 +60,6 @@ Class SWWMArmor : Armor abstract break; } } - if ( !found ) - { - // find last of either invinciball/ragekit/barrier power - for ( Inventory i=other.Inv; i; i=i.Inv ) - { - if ( !(i is 'InvinciballPower') && !(i is 'RagekitPower') && !(i is 'BarrierPower') ) continue; - found = i; - } - } if ( !found ) return; // place ourselves right after it Inventory saved = found.Inv; @@ -96,12 +77,12 @@ Class SWWMArmor : Armor abstract int saved; if ( (amount <= 0) || DamageTypeDefinition.IgnoreArmor(damageType) || (damage <= 0) ) return; - SWWMHandler.DoFlash(Owner,Color(int(clamp(damage*.15,1,16)),255,224,192),3); - Owner.A_StartSound("armor/hit",CHAN_DAMAGE,CHANF_OVERLAP,clamp(damage*.03,0.,1.),2.5); + if ( !bNOHITFLASH ) SWWMHandler.DoFlash(Owner,Color(int(clamp(damage*.15,1,16)),255,224,192),3); + if ( !bNOHITSOUND ) Owner.A_StartSound("armor/hit",CHAN_DAMAGE,CHANF_OVERLAP,clamp(damage*.03,0.,1.),2.5); saved = HandleDamage(damage,damageType,flags); int healed = max(0,saved-damage); saved = min(saved,damage); - if ( amount <= saved ) saved = amount; + if ( !bNODRAIN && (amount <= saved) ) saved = amount; newdamage -= saved; if ( healed > 0 ) Owner.GiveBody(healed); if ( (swwm_strictuntouchable == 1) && (saved > 0) && Owner.player ) @@ -109,7 +90,7 @@ Class SWWMArmor : Armor abstract let hnd = SWWMHandler(EventHandler.Find("SWWMHandler")); if ( hnd ) hnd.tookdamage[Owner.PlayerNumber()] = true; } - amount -= saved; + if ( !bNODRAIN ) amount -= saved; damage = newdamage; bool shouldautouse = false; if ( swwm_enforceautousearmor == 1 ) shouldautouse = true; diff --git a/zscript/items/swwm_basehealth.zsc b/zscript/items/swwm_basehealth.zsc index 12e3d94f8..5b4306671 100644 --- a/zscript/items/swwm_basehealth.zsc +++ b/zscript/items/swwm_basehealth.zsc @@ -39,7 +39,7 @@ Class SWWMHealth : Inventory abstract // find last armor item, plating or collar for ( Inventory i=other.Inv; i; i=i.Inv ) { - if ( !(i is 'SWWMArmor') && !(i is 'AlmasteelPlating') && !(i is 'SayaCollar') ) continue; + if ( !(i is 'SWWMArmor') ) continue; found = i; } } @@ -59,15 +59,6 @@ Class SWWMHealth : Inventory abstract break; } } - if ( !found ) - { - // find last of either invinciball/ragekit/barrier power - for ( Inventory i=other.Inv; i; i=i.Inv ) - { - if ( !(i is 'InvinciballPower') && !(i is 'RagekitPower') && !(i is 'BarrierPower') ) continue; - found = i; - } - } if ( !found ) return; // place ourselves right after it Inventory saved = found.Inv; diff --git a/zscript/items/swwm_powerups.zsc b/zscript/items/swwm_powerups.zsc index c82996305..9ca3a995e 100644 --- a/zscript/items/swwm_powerups.zsc +++ b/zscript/items/swwm_powerups.zsc @@ -183,11 +183,11 @@ Class GrilledCheeseSandwich : Inventory override void AttachToOwner( Actor other ) { Super.AttachToOwner(other); - // find last armor/health item or invuln/ragekit/barrier or the collar + // find last armor/health item Inventory found = null; for ( Inventory i=other.Inv; i; i=i.Inv ) { - if ( !(i is 'SWWMHealth') && !(i is 'SWWMArmor') && !(i is 'InvinciballPower') && !(i is 'RagekitPower') && !(i is 'BarrierPower') && !(i is 'AlmasteelPlating') && !(i is 'SayaCollar') ) continue; + if ( !(i is 'SWWMHealth') && !(i is 'SWWMArmor') ) continue; found = i; } if ( !found ) return; @@ -828,33 +828,9 @@ Class InvinciballPower : Powerup if ( (EffectTics <= 0) && Owner && Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_INVINCIBALL")); } - override void AttachToOwner( Actor other ) + override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags ) { - Super.AttachToOwner(other); - // find first with health/armor, plating/collar, sandwich after it - Inventory found = null; - for ( Inventory i=other.Inv; i; i=i.Inv ) - { - if ( !(i.Inv is 'SWWMHealth') && !(i.Inv is 'SWWMArmor') && !(i.Inv is 'GrilledCheeseSandwich') && !(i.Inv is 'AlmasteelPlating') && !(i.Inv is 'SayaCollar') ) continue; - found = i; - break; - } - if ( !found ) - { - // we're good - 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, Actor inflictor, Actor source, int flags ) - { - if ( Owner.ApplyDamageFactor(damageType,damage) <= 0 ) - return; // this damage type is ignored, so don't flash + if ( !passive ) return; if ( damageType == 'EndLevel' ) return; // don't trigger on endlevel damage if ( damage > 0 ) @@ -1107,29 +1083,6 @@ Class RagekitPower : Powerup if ( (EffectTics <= 0) && Owner && Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_RAGEKIT")); } - override void AttachToOwner( Actor other ) - { - Super.AttachToOwner(other); - // find first with health/armor, plating/collar, sandwich or barrier after it - Inventory found = null; - for ( Inventory i=other.Inv; i; i=i.Inv ) - { - if ( !(i.Inv is 'SWWMHealth') && !(i.Inv is 'SWWMArmor') && !(i.Inv is 'GrilledCheeseSandwich') && !(i.Inv is 'AlmasteelPlating') && !(i.Inv is 'SayaCollar') && !(i.Inv is 'BarrierPower') ) continue; - found = i; - break; - } - if ( !found ) - { - // we're good - return; - } - // place ourselves right after it - Inventory saved = found.Inv; - found.Inv = self; - other.Inv = Inv; - Inv = saved; - } - void DoHitFX() { if ( level.maptime <= lasteffect+5 ) return; @@ -1146,16 +1099,14 @@ Class RagekitPower : Powerup Demolitionist(Owner).lastbump *= .9; } - override void AbsorbDamage( int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags ) - { - if ( damageType == 'EndLevel' ) - return; // don't trigger on endlevel damage - if ( damage > 0 ) newdamage = damage/4; - } - override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags ) { - if ( passive ) return; + if ( passive ) + { + if ( (damageType != 'EndLevel') && (damage > 0) ) + newdamage = damage/4; + return; + } if ( (damageType == 'Melee') || (damageType == 'Jump') || (damageType == 'Dash') || (damageType == 'Buttslam') || (damageType == 'GroundPound') ) { newdamage = damage*8; @@ -1265,64 +1216,42 @@ Class Omnisight : Inventory Mixin SWWMUseToPickup; Mixin SWWMRespawn; - override bool Use( bool pickup ) + override bool TryPickup( in out Actor toucher ) { if ( !level.allmap ) { - if ( Owner.player == players[consoleplayer] ) + Actor rt = toucher; + if ( toucher.player ) rt = toucher.player.mo; + if ( rt.player == players[consoleplayer] ) { - Owner.A_StartSound("powerup/omnisight",CHAN_ITEMEXTRA,CHANF_OVERLAP); + rt.A_StartSound("powerup/omnisight",CHAN_ITEMEXTRA,CHANF_OVERLAP); // automatically zoom out so the player can know how far this goes CVar.FindCVar('swwm_mm_zoom').SetFloat(2.); } - if ( Owner is 'Demolitionist' ) - Demolitionist(Owner).lastbump *= 1.1; + if ( rt is 'Demolitionist' ) + Demolitionist(rt).lastbump *= 1.1; level.allmap = true; - } - // activate all interest markers - let ti = ThinkerIterator.Create("SWWMInterestMarker",STAT_MAPMARKER); - Actor a; - while ( a = Actor(ti.Next()) ) a.bDORMANT = false; - // spread to all players - for ( int i=0; i 1.) ) - CVar.FindCVar('swwm_mm_zoom').SetFloat(1.); - Super.DetachFromOwner(); - } - override bool HandlePickup( Inventory item ) - { - if ( item.GetClass() == GetClass() ) - { - item.bPickupGood = true; - return true; - } - return false; - } - override bool ShouldSpawn() - { - if ( deathmatch ) return false; - return Super.ShouldSpawn(); + GoAwayAndDie(); + return true; } Default { @@ -1334,17 +1263,13 @@ Class Omnisight : Inventory Inventory.Icon "graphics/HUD/Icons/I_Omnisight.png"; Inventory.PickupSound "misc/p_pkup"; Inventory.PickupMessage "$I_OMNISIGHT"; - Inventory.MaxAmount 1; - Inventory.InterHubAmount 0; Inventory.RestrictedTo "Demolitionist"; Inventory.PickupFlash "SWWMPurplePickupFlash"; +INVENTORY.ALWAYSPICKUP; - +INVENTORY.AUTOACTIVATE; +COUNTITEM; +INVENTORY.BIGPOWERUP; - +INVENTORY.UNDROPPABLE; - +INVENTORY.UNTOSSABLE; +FLOATBOB; + +NOTDMATCH; FloatBobStrength 0.25; Radius 6; Height 26; @@ -2116,31 +2041,9 @@ Class BarrierPower : PowerIronFeet +INVENTORY.ADDITIVETIME; } - override void AttachToOwner( Actor other ) - { - Super.AttachToOwner(other); - // find first item with armor/health, plating/collar, sandwich, invincibility after it - Inventory found = null; - for ( Inventory i=other.Inv; i; i=i.Inv ) - { - if ( !(i.Inv is 'SWWMHealth') && !(i.Inv is 'SWWMArmor') && !(i.Inv is 'GrilledCheeseSandwich') && !(i.Inv is 'AlmasteelPlating') && !(i.Inv is 'SayaCollar') && !(i.Inv is 'InvinciballPower') ) continue; - found = i; - break; - } - if ( !found ) - { - // we're good - 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 ) + override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive, Actor inflictor, Actor source, int flags ) { + if ( !passive ) return; // negate elemental damage if ( (damageType == 'Fire') || (damageType == 'Ice') || (damageType == 'Slime') || (damageType == 'Electric') || (damageType == 'Plasma') || (damageType == 'Radiation') || (damageType == 'Wind') || (damageType == 'Water') || (damageType == 'Corroded') || (damageType == 'Lava') ) newdamage = 0; diff --git a/zscript/swwm_player.zsc b/zscript/swwm_player.zsc index 50b3bf1cb..ccbf72596 100644 --- a/zscript/swwm_player.zsc +++ b/zscript/swwm_player.zsc @@ -416,20 +416,20 @@ Class Demolitionist : PlayerPawn // we don't need hexen or basic armors // we can simplify the code a lot here since no handling of many special conditions is needed let sc = Inventory(Spawn('SayaCollar')); - sc.AttachToOwner(self); + if ( !sc.CallTryPickup(self) ) sc.Destroy(); let ap = Inventory(Spawn('AlmasteelPlating')); - ap.AttachToOwner(self); + if ( !ap.CallTryPickup(self) ) ap.Destroy(); let dp = Inventory(Spawn('DeepImpact')); - dp.AttachToOwner(self); + if ( !dp.CallTryPickup(self) ) dp.Destroy(); let eg = ExplodiumGun(Spawn('ExplodiumGun')); - eg.AttachToOwner(self); eg.firstselect = true; - player.ReadyWeapon = player.PendingWeapon = eg; + if ( !eg.CallTryPickup(self) ) eg.Destroy(); + else player.ReadyWeapon = player.PendingWeapon = eg; // in hexdd, we start with the chaos sphere in our grasp if ( SWWMUtility.IsDeathkings() && SWWMUtility.CheckMD5List("vanillahexen.list") ) { let cs = Inventory(Spawn('SWWMChaosSphere')); - cs.AttachToOwner(self); + if ( !cs.CallTryPickup(self) ) cs.Destroy(); } // in deathmatch, we start with 8 embiggeners if ( deathmatch ) @@ -448,7 +448,7 @@ Class Demolitionist : PlayerPawn while ( last.inv ) { let i = last.inv; - if ( (i is 'SWWMArmor') || (i is 'HammerspaceEmbiggener') ) + if ( ((i is 'SWWMArmor') && !i.bUNCLEARABLE) || (i is 'HammerspaceEmbiggener') ) { i.DepleteOrDestroy(); if ( !i.bDestroyed ) last = i; @@ -512,7 +512,6 @@ Class Demolitionist : PlayerPawn } void SenseItems() { - let thesight = FindInventory("Omnisight"); let bt = BlockThingsIterator.Create(self,800); while ( bt.Next() ) { @@ -521,7 +520,7 @@ Class Demolitionist : PlayerPawn if ( (i is 'Inventory') && (i.bINVISIBLE || !i.bSPECIAL || Inventory(i).Owner) ) continue; if ( (i is 'Chancebox') && (i.CurState != i.SpawnState) ) continue; if ( !SWWMUtility.SphereIntersect(i,pos,800) ) continue; - if ( !thesight && !CheckSight(i,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; + if ( !level.allmap && !CheckSight(i,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; SWWMItemSense.Spawn(self,i); } bt.Destroy(); @@ -989,12 +988,12 @@ Class Demolitionist : PlayerPawn if ( !FindInventory("AlmasteelPlating") ) { let ap = Inventory(Spawn("AlmasteelPlating")); - ap.AttachToOwner(self); + if ( !ap.CallTryPickup(self) ) ap.Destroy(); } if ( !FindInventory("SayaCollar") ) { let sc = Inventory(Spawn("SayaCollar")); - sc.AttachToOwner(self); + if ( !sc.CallTryPickup(self) ) sc.Destroy(); } // this is why we need mod cvar callbacks if ( swwm_singlefirst != oldsinglefirst ) @@ -2961,6 +2960,18 @@ Class Demolitionist : PlayerPawn { // clean up attached actors if ( selflight ) selflight.Destroy(); + // get rid of our internal armors to fix some nonsense + Actor last = player.mo; + while ( last.inv ) + { + let inv = last.inv; + if ( (inv is 'AlmasteelPlating') || (inv is 'SayaCollar') ) + { + inv.Destroy(); + if ( !inv.bDestroyed ) last = inv; + } + else last = inv; + } // inventory wipes if ( invwipe && (player.playerstate != PST_DEAD) ) { diff --git a/zscript/swwm_player_items.zsc b/zscript/swwm_player_items.zsc index 669ce7cc4..e7f48a0a3 100644 --- a/zscript/swwm_player_items.zsc +++ b/zscript/swwm_player_items.zsc @@ -2,12 +2,14 @@ // lucky collar // made by Ashley Knox, given to you and Ibuki by Saya -Class SayaCollar : Inventory +Class SayaCollar : SWWMArmor { Default { - +INVENTORY.UNDROPPABLE; - +INVENTORY.UNTOSSABLE; + Inventory.Amount 1; + Inventory.MaxAmount 1; + Inventory.InterHubAmount 1; + SWWMArmor.ArmorPriority 1; +INVENTORY.UNCLEARABLE; } override void AbsorbDamage( int damage, Name damageType, out int newdamage, Actor inflictor, Actor source, int flags ) @@ -25,37 +27,22 @@ Class SayaCollar : Inventory newdamage = splitdmg[0]+splitdmg[1]; } } - override void AttachToOwner( Actor other ) - { - Super.AttachToOwner(other); - // if first item is health or sandwich, ignore - if ( (other.Inv is 'SWWMHealth') || (other.Inv is 'GrilledCheeseSandwich') ) - return; - // if there's items before health/sandwich, squeeze right in - for ( Inventory i=other.Inv; i; i=i.Inv ) - { - if ( (i == self) || (!(i.Inv is 'SWWMHealth' ) && !(i.Inv is 'GrilledCheeseSandwich')) ) continue; - Inventory saved = i.Inv; - i.Inv = self; - other.Inv = Inv; - Inv = saved; - break; - } - } } // high-resonant almasteel plating // EXTRA THICC as Saya requested -Class AlmasteelPlating : Inventory +Class AlmasteelPlating : SWWMArmor { Inventory dbf; Default { - +INVENTORY.UNDROPPABLE; - +INVENTORY.UNTOSSABLE; - +INVENTORY.UNCLEARABLE; + Inventory.Amount 1; + Inventory.MaxAmount 1; + Inventory.InterHubAmount 1; Inventory.RestrictedTo "Demolitionist"; + SWWMArmor.ArmorPriority 2; + +INVENTORY.UNCLEARABLE; } override void DoEffect() { @@ -85,22 +72,6 @@ Class AlmasteelPlating : Inventory } return false; } - override void AttachToOwner( Actor other ) - { - Super.AttachToOwner(other); - // if first item is the collar, just ignore - if ( other.Inv is 'SayaCollar' ) return; - // if there's items before collar, squeeze right in - for ( Inventory i=other.Inv; i; i=i.Inv ) - { - if ( (i == self) || !(i.Inv is 'SayaCollar') ) continue; - Inventory saved = i.Inv; - i.Inv = self; - other.Inv = Inv; - Inv = saved; - break; - } - } } Class ReviveCooldown : Powerup diff --git a/zscript/swwm_statichandler.zsc b/zscript/swwm_statichandler.zsc index 2ca2af581..cddf3c760 100644 --- a/zscript/swwm_statichandler.zsc +++ b/zscript/swwm_statichandler.zsc @@ -61,7 +61,7 @@ Class SWWMStaticHandler : StaticEventHandler SWWMHandler.ClearAllShaders(players[consoleplayer]); // force a reset of the minimap zoom in case it's set beyond safe levels double mmz = swwm_mm_zoom; - if ( players[consoleplayer].mo && players[consoleplayer].mo.FindInventory("Omnisight") && (mmz >= 2.) ) mmz = 2.; + if ( level.allmap && (mmz >= 2.) ) mmz = 2.; else if ( mmz >= 1. ) mmz = 1.; else mmz = .5; CVar.FindCVar('swwm_mm_zoom').SetFloat(mmz);