| 1 | Cheat template files use the [wiki:JSON JSON] format and are put in [source:/ps/trunk/binaries/data/mods/public/simulation/data/cheats simulation/data/cheats] (see [wiki:Mod_Layout mod layout]). |
| 2 | |
| 3 | The basic format is: |
| 4 | {{{ |
| 5 | #!js |
| 6 | { |
| 7 | "Name": "i want pizza", |
| 8 | "Data": { |
| 9 | "Action": "addresource", |
| 10 | "Type": "food", |
| 11 | "DefaultParameter": 1000, |
| 12 | "isNumeric": true, |
| 13 | "Templates": [] |
| 14 | } |
| 15 | } |
| 16 | }}} |
| 17 | |
| 18 | '''Name''' is the string which has to be entered in the chat to execute the '''Action''' (if cheats are enabled). The code which decides what to do (based on the '''Action''' is [source:/ps/trunk/binaries/data/mods/public/simulation/helpers/Cheat.js Cheat.js]. |
| 19 | |
| 20 | '''Type''': '''Optional''' passed as an additional parameter (to differentiate between similar actions). |
| 21 | |
| 22 | '''!DefaultParameter''': '''Optional'''. If this is defined the cheat takes an additional parameter. The default, which is used if no additional parameter is provided is the value of '''!DefaultParameter'''. |
| 23 | |
| 24 | '''isNumeric''': '''Optional''', only used iff the cheat takes a parameter. If true the parameter is passed as a number, else it is passed as a string. Only positive integers are currently passed on. |
| 25 | |
| 26 | '''Templates''': '''Optional'''. Array of templates that the cheat uses (eg [source:/ps/trunk/binaries/data/mods/public/simulation/data/cheats/createPlane.json createPlane.json]). |