Hide Lämp after 10 seconds of inactivity.

This commit is contained in:
Mari the Deer 2023-08-21 11:23:32 +02:00
commit b014a26965
3 changed files with 17 additions and 3 deletions

View file

@ -498,6 +498,8 @@ Class SWWMLamp : Inventory
Actor thelamp;
int charge;
int inactivetime;
Property Charge : charge;
override Inventory CreateCopy( Actor other )
@ -580,6 +582,18 @@ Class SWWMLamp : Inventory
f.A_StartSound("lamp/appear",CHAN_VOICE);
}
if ( bActive && !(level.maptime%35) && !isFrozen() ) Charge--;
if ( bActive || !thelamp ) inactivetime = 0;
else if ( thelamp )
{
inactivetime++;
if ( inactivetime > 350 ) // hide the lamp after 10 seconds of inactivity, so it doesn't get in your way
{
let f = Spawn("SWWMItemFog",thelamp.pos);
f.A_StartSound("lamp/disappear",CHAN_VOICE);
thelamp.Destroy();
bActivated = false;
}
}
if ( Charge <= 0 )
{
Amount--;