expose InsertCoin and InsertCredit to Lua

This commit exposes InsertCoin() and InsertCredit() to Lua under GAMESTATE.  It adds a check to ensure overall credits don't become negative when deducting and only plays sounds if credits are being added.

Themers are instructed to deduct credits by passing negative values to InsertCoin.
This commit is contained in:
Dan Guzek
2014-09-01 19:00:00 -04:00
parent aac32f81ad
commit eae5fcb3ba
4 changed files with 82 additions and 53 deletions
+2
View File
@@ -810,6 +810,8 @@
<Function name='HasEarnedExtraStage'/>
<Function name='HaveProfileToLoad'/>
<Function name='HaveProfileToSave'/>
<Function name='InsertCoin'/>
<Function name='InsertCredit'/>
<Function name='InStepEditor'/>
<Function name='IsAnExtraStage'/>
<Function name='IsAnyHumanPlayerUsingMemoryCard'/>
+7
View File
@@ -2478,6 +2478,13 @@ save yourself some time, copy this for undocumented things:
editing portion. If in recording or playing mode, this will return
<code>false</code>.
</Function>
<Function name='InsertCoin' return='void' arguments='int iCoins'>
Inserts <code>iCoins</code> number of coins. <code>iCoins</code> can be negative or positive.
</Function>
<Function name='InsertCredit' return='void' arguments=''>
Inserts one credit. To deduct a credit, pass a negative integer representing the number
of coins per credit to <Link class='GameState' function='InsertCoin'>InsertCoin</Link>.
</Function>
<Function name='IsAnExtraStage' return='bool' arguments=''>
Returns <code>true</code> if this is an extra stage.
</Function>