Implement score increase/decrease accumulator in HUD.
This commit is contained in:
parent
a064184777
commit
68c01dbd63
5 changed files with 81 additions and 3 deletions
|
|
@ -385,6 +385,13 @@ Class SWWMCredits : SWWMStaticThinker
|
|||
else c.credits = min(999999999,c.credits+amount);
|
||||
let s = SWWMStats.Find(p);
|
||||
if ( s && (c.credits > s.hiscore) ) s.hiscore = c.credits;
|
||||
// append to hud
|
||||
for ( int i=0; i<MAXPLAYERS; i++ )
|
||||
{
|
||||
if ( players[i] != p ) continue;
|
||||
EventHandler.SendInterfaceEvent(i,"swwmhudgivescore",amount);
|
||||
break;
|
||||
}
|
||||
SWWMLoreLibrary.Add(p,"ScoreSystem");
|
||||
}
|
||||
|
||||
|
|
@ -399,7 +406,7 @@ Class SWWMCredits : SWWMStaticThinker
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool Take( PlayerInfo p, int amount, int hamount = 0 )
|
||||
static bool Take( PlayerInfo p, int amount )
|
||||
{
|
||||
let c = Find(p);
|
||||
if ( !c ) return false;
|
||||
|
|
@ -408,6 +415,13 @@ Class SWWMCredits : SWWMStaticThinker
|
|||
// too much!
|
||||
if ( (amount > 999999999) || (c.credits-amount < 0) || (c.credits-amount > c.credits) ) return false;
|
||||
c.credits -= amount;
|
||||
// append to hud
|
||||
for ( int i=0; i<MAXPLAYERS; i++ )
|
||||
{
|
||||
if ( players[i] != p ) continue;
|
||||
EventHandler.SendInterfaceEvent(i,"swwmhudtakescore",amount);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue