Don't use inventory tokens for mapper-toggleable store/revive. Tokens are icky.
This commit is contained in:
parent
dc39f4a6fb
commit
a2855dfc9a
9 changed files with 31 additions and 32 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
# Notes for mappers
|
# Notes for mappers
|
||||||
|
|
||||||
### Tokens
|
### Toggling features
|
||||||
|
|
||||||
- **Disabling the store:**<br/>Give the player `"SWWMStoreDisabler"` item on map load.
|
- **Store:**<br/>`CallACS("SWWMHandler","ToggleStore",#)`<br/>Passing **0** disables the store, any other number will enable it again.
|
||||||
- **Disabling revives:**<br/>Give the player `"SWWMReviveDisabler"` item on map load.
|
- **Reviving:**<br/>`CallACS("SWWMHandler","ToggleRevive",#)`<br/>Passing **0** disables reviving, any other number will enable it again.
|
||||||
|
|
||||||
**Note:** Tokens are flagged as *"unclearable"*, so they have to be removed directly with `TakeInventory`.
|
**Note:** These settings will persist between level changes.
|
||||||
|
|
||||||
### Mission log
|
### Mission log
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
[default]
|
[default]
|
||||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r762 \cu(Sat 18 Feb 11:54:24 CET 2023)\c-";
|
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r763 \cu(Sat 18 Feb 11:54:30 CET 2023)\c-";
|
||||||
SWWM_SHORTVER="\cw1.3pre r762 \cu(2023-02-18 11:54:24)\c-";
|
SWWM_SHORTVER="\cw1.3pre r763 \cu(2023-02-18 11:54:30)\c-";
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,19 @@ Class SWWMHandler : EventHandler
|
||||||
prof_calls[idx]++;
|
prof_calls[idx]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static play void ToggleStore( bool val )
|
||||||
|
{
|
||||||
|
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||||
|
if ( !hnd || !hnd.gdat ) return; // shouldn't happen, but doesn't hurt to check
|
||||||
|
hnd.gdat.disablestore = !val;
|
||||||
|
}
|
||||||
|
static play void ToggleRevive( bool val )
|
||||||
|
{
|
||||||
|
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||||
|
if ( !hnd || !hnd.gdat ) return; // shouldn't happen, but doesn't hurt to check
|
||||||
|
hnd.gdat.disablerevive = !val;
|
||||||
|
}
|
||||||
|
|
||||||
override void OnRegister()
|
override void OnRegister()
|
||||||
{
|
{
|
||||||
// oneliner RNG must be relative to consoleplayer
|
// oneliner RNG must be relative to consoleplayer
|
||||||
|
|
|
||||||
|
|
@ -561,7 +561,7 @@ Class SWWMStatusBar : BaseStatusBar
|
||||||
xx = int((ss.x-len)/2.);
|
xx = int((ss.x-len)/2.);
|
||||||
yy = ss.y/2.;
|
yy = ss.y/2.;
|
||||||
Screen.DrawText(mSmallFont,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
|
Screen.DrawText(mSmallFont,Font.CR_WHITE,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
|
||||||
if ( goner || CPlayer.mo.FindInventory("SWWMReviveDisabler") || !swwm_revive )
|
if ( goner || hnd.gdat.disablerevive || !swwm_revive )
|
||||||
return (1.-dimalph);
|
return (1.-dimalph);
|
||||||
alph = clamp((deadtimer-160)/60.,0.,1.);
|
alph = clamp((deadtimer-160)/60.,0.,1.);
|
||||||
str = String.Format(StringTable.Localize("$SWWM_URDED3"));
|
str = String.Format(StringTable.Localize("$SWWM_URDED3"));
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ Class DemolitionistStoreTab : DemolitionistMenuTab
|
||||||
override DemolitionistMenuTab Init( DemolitionistMenu master )
|
override DemolitionistMenuTab Init( DemolitionistMenu master )
|
||||||
{
|
{
|
||||||
title = StringTable.Localize("$SWWM_STORETAB");
|
title = StringTable.Localize("$SWWM_STORETAB");
|
||||||
bDisabled = (deathmatch||(G_SkillPropertyInt(SKILLP_ACSReturn)>=4)||players[consoleplayer].mo.FindInventory("SWWMStoreDisabler"));
|
bDisabled = (deathmatch||(G_SkillPropertyInt(SKILLP_ACSReturn)>=4)||master.hnd.gdat.disablestore);
|
||||||
return Super.Init(master);
|
return Super.Init(master);
|
||||||
}
|
}
|
||||||
override void OnDestroy()
|
override void OnDestroy()
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,8 @@ Class Demolitionist : PlayerPawn
|
||||||
|
|
||||||
double bobtime, oldbobtime, oldbob;
|
double bobtime, oldbobtime, oldbob;
|
||||||
|
|
||||||
|
SWWMHandler hnd;
|
||||||
|
|
||||||
Default
|
Default
|
||||||
{
|
{
|
||||||
Tag "$T_DEMOLITIONIST";
|
Tag "$T_DEMOLITIONIST";
|
||||||
|
|
@ -363,7 +365,7 @@ Class Demolitionist : PlayerPawn
|
||||||
damage = 0;
|
damage = 0;
|
||||||
if ( (swwm_strictuntouchable >= 2) && (damage > 0) && player )
|
if ( (swwm_strictuntouchable >= 2) && (damage > 0) && player )
|
||||||
{
|
{
|
||||||
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||||
if ( hnd ) hnd.tookdamage[PlayerNumber()] = true;
|
if ( hnd ) hnd.tookdamage[PlayerNumber()] = true;
|
||||||
}
|
}
|
||||||
if ( (mod == 'Crush') && player && (player.mo == self) )
|
if ( (mod == 'Crush') && player && (player.mo == self) )
|
||||||
|
|
@ -559,7 +561,7 @@ Class Demolitionist : PlayerPawn
|
||||||
if ( !player ) return false;
|
if ( !player ) return false;
|
||||||
int score = 100;
|
int score = 100;
|
||||||
// last secret (this is called before counting it up, so have to subtract)
|
// last secret (this is called before counting it up, so have to subtract)
|
||||||
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||||
if ( !deathmatch && !(gameinfo.gametype&GAME_Hexen) && (level.found_secrets == level.total_secrets-1) && (!hnd || !hnd.allsecrets) )
|
if ( !deathmatch && !(gameinfo.gametype&GAME_Hexen) && (level.found_secrets == level.total_secrets-1) && (!hnd || !hnd.allsecrets) )
|
||||||
{
|
{
|
||||||
if ( hnd ) hnd.allsecrets = true;
|
if ( hnd ) hnd.allsecrets = true;
|
||||||
|
|
@ -718,7 +720,7 @@ Class Demolitionist : PlayerPawn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// re-add ourselves to the "suckable list" (otherwise the Ynykron Singularity won't hurt us)
|
// re-add ourselves to the "suckable list" (otherwise the Ynykron Singularity won't hurt us)
|
||||||
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||||
if ( hnd && (hnd.SuckableActors.Find(self) >= hnd.SuckableActors.Size()) )
|
if ( hnd && (hnd.SuckableActors.Find(self) >= hnd.SuckableActors.Size()) )
|
||||||
hnd.SuckableActors.Push(self);
|
hnd.SuckableActors.Push(self);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,5 @@
|
||||||
// player-specific item stuff
|
// player-specific item stuff
|
||||||
|
|
||||||
// tokens for custom maps
|
|
||||||
Class SWWMStoreDisabler : Inventory
|
|
||||||
{
|
|
||||||
Default
|
|
||||||
{
|
|
||||||
+INVENTORY.UNCLEARABLE;
|
|
||||||
+INVENTORY.UNDROPPABLE;
|
|
||||||
+INVENTORY.UNTOSSABLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Class SWWMReviveDisabler : Inventory
|
|
||||||
{
|
|
||||||
Default
|
|
||||||
{
|
|
||||||
+INVENTORY.UNCLEARABLE;
|
|
||||||
+INVENTORY.UNDROPPABLE;
|
|
||||||
+INVENTORY.UNTOSSABLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// lucky collar
|
// lucky collar
|
||||||
// made by Ashley Knox, given to you and Ibuki by Saya
|
// made by Ashley Knox, given to you and Ibuki by Saya
|
||||||
Class SayaCollar : SWWMArmor
|
Class SayaCollar : SWWMArmor
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,7 @@ extend Class Demolitionist
|
||||||
deadtimer++;
|
deadtimer++;
|
||||||
if ( (deadtimer == 60) && (player == players[consoleplayer]) )
|
if ( (deadtimer == 60) && (player == players[consoleplayer]) )
|
||||||
A_StartSound("demolitionist/youdied",CHAN_DEMOVOICE,CHANF_OVERLAP|CHANF_UI);
|
A_StartSound("demolitionist/youdied",CHAN_DEMOVOICE,CHANF_OVERLAP|CHANF_UI);
|
||||||
|
if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
|
||||||
if ( multiplayer || level.AllowRespawn || sv_singleplayerrespawn || G_SkillPropertyInt(SKILLP_PlayerRespawn) )
|
if ( multiplayer || level.AllowRespawn || sv_singleplayerrespawn || G_SkillPropertyInt(SKILLP_PlayerRespawn) )
|
||||||
{
|
{
|
||||||
// standard behaviour, respawn normally
|
// standard behaviour, respawn normally
|
||||||
|
|
@ -308,7 +309,7 @@ extend Class Demolitionist
|
||||||
player.playerstate = PST_ENTER;
|
player.playerstate = PST_ENTER;
|
||||||
if ( special1 > 2 ) special1 = 0;
|
if ( special1 > 2 ) special1 = 0;
|
||||||
}
|
}
|
||||||
else if ( (player.cmd.buttons&BT_ATTACK) && (deadtimer > 120) && !FindInventory("SWWMReviveDisabler") && swwm_revive )
|
else if ( (player.cmd.buttons&BT_ATTACK) && (deadtimer > 120) && (!hnd || !hnd.gdat.disablerevive) && swwm_revive )
|
||||||
{
|
{
|
||||||
// reboot (if possible)
|
// reboot (if possible)
|
||||||
if ( !FindInventory("ReviveCooldown") && (((swwm_revivecooldown >= 0) && (G_SkillPropertyInt(SKILLP_ACSReturn) < 4)) || !hasrevived) )
|
if ( !FindInventory("ReviveCooldown") && (((swwm_revivecooldown >= 0) && (G_SkillPropertyInt(SKILLP_ACSReturn) < 4)) || !hasrevived) )
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,9 @@ Class SWWMGlobals : SWWMStaticThinker
|
||||||
// for oneliners
|
// for oneliners
|
||||||
Array<OnelinerHistory> lastlines;
|
Array<OnelinerHistory> lastlines;
|
||||||
|
|
||||||
|
// toggleable mapping stuff
|
||||||
|
bool disablestore, disablerevive;
|
||||||
|
|
||||||
static play SWWMGlobals Get()
|
static play SWWMGlobals Get()
|
||||||
{
|
{
|
||||||
let ti = ThinkerIterator.Create("SWWMGlobals",STAT_STATIC);
|
let ti = ThinkerIterator.Create("SWWMGlobals",STAT_STATIC);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue