LuaAPI.wiki
changeset 1568 bd6376af4de2
parent 1539 7c038e79eddf
child 1569 6bdb276e48b6
equal deleted inserted replaced
1567:56b186f6de7f 1568:bd6376af4de2
  1010 Enables the listed !GameFlags, without changing the status of other !GameFlags. In missions, no !GameFlags are set initially.
  1010 Enables the listed !GameFlags, without changing the status of other !GameFlags. In missions, no !GameFlags are set initially.
  1011 
  1011 
  1012 ==== <tt>!GetGameFlag(gameflag)</tt> ====
  1012 ==== <tt>!GetGameFlag(gameflag)</tt> ====
  1013 Returns `true` if the specified gameflag is enabled, otherwise `false`.
  1013 Returns `true` if the specified gameflag is enabled, otherwise `false`.
  1014 
  1014 
       
  1015 === Turns ===
       
  1016 ==== `SkipTurn()` (0.9.24) ====
       
  1017 Forces the current hedgehog to skip its turn.
       
  1018 
       
  1019 ==== `EndTurn([noTaunts])` (0.9.23) ====
       
  1020 Ends the current turn immediately.
       
  1021 
       
  1022 Normally, a “Coward” taunt may be played and an announcer message may be shown (depending on the situation). Set the optional `noTaunts` parameter to `true` to force the engine to never play a taunt or show a message. `noTaunts` is `false` by default.
       
  1023 
       
  1024 ==== `Retreat(time [, respectGetAwayTimeFactor)` (0.9.25) ====
       
  1025 Forces the current turn into the retreating phase, as if the hog made an attack. That is, the current hedgehog is unable to attack or select a weapon, only movement is possible until the retreat time is up.
       
  1026 
       
  1027 The retreat time must be set with `time` in milliseconds. By default, this time is automatically multiplied with get-away time percentage from the game scheme for seamless integration with schemes. If you want to ignore the game scheme for some reason and set the retreat time no matter what, set `respectGetAwayTimeFactor` to `false`.
       
  1028 
       
  1029 If the current hedgehog was busy doing an attack, the attack is aborted, no shot is made. If this function is called in the ready phase of af a turn, the ready phase continues normally, but the turn will begin in the retreat phase instead.
       
  1030 
       
  1031 Note: If you want the turn to end instantly, it is recommended to use `EndTurn` instead.
       
  1032 
       
  1033 ==== <tt>!SetTurnTimeLeft(newTurnTimeLeft)</tt> (0.9.25) ====
       
  1034 Set the remaining turn time in milliseconds. The current remaining turn time can be read from the variable `TurnTimeLeft`.
       
  1035 
       
  1036 === <tt>!SetReadyTimeLeft(newReadyTimeLeft)</tt> (0.9.25)
       
  1037 Set the remaining ready time in milliseconds. The current remaining turn time can be read from the variable `ReadyTimeLeft`.
       
  1038 
       
  1039 ==== <tt>!EndGame()</tt> ====
       
  1040 Makes the game end.
       
  1041 
  1015 === Environment ===
  1042 === Environment ===
  1016 
       
  1017 ==== <tt>!SetGravity(percent)</tt> ====
  1043 ==== <tt>!SetGravity(percent)</tt> ====
  1018 Changes the current gravity of the game in percent (relative to default, integer value).
  1044 Changes the current gravity of the game in percent (relative to default, integer value).
  1019 Setting it to 100 will set gravity to default gravity of hedgewars, 200 will double it, etc.
  1045 Setting it to 100 will set gravity to default gravity of hedgewars, 200 will double it, etc.
  1020 
  1046 
  1021 ==== <tt>!GetGravity()</tt> ====
  1047 ==== <tt>!GetGravity()</tt> ====
  1067 Explode(500, 1000, 50, EXPLAutoSound + EXPLNoDamage + EXPLDontDraw)
  1093 Explode(500, 1000, 50, EXPLAutoSound + EXPLNoDamage + EXPLDontDraw)
  1068 
  1094 
  1069 -- Erase a circle of land without side effects
  1095 -- Erase a circle of land without side effects
  1070 Explode(500, 100, 100, EXPLNoDamage + EXPLDoNotTouchAny + EXPLNoGfx)
  1096 Explode(500, 100, 100, EXPLNoDamage + EXPLDoNotTouchAny + EXPLNoGfx)
  1071 </code>
  1097 </code>
  1072 
       
  1073 ==== `SkipTurn()` (0.9.24) ====
       
  1074 Forces the current hedgehog to skip its turn.
       
  1075 
       
  1076 ==== `EndTurn([noTaunts])` (0.9.23) ====
       
  1077 Ends the current turn immediately.
       
  1078 
       
  1079 Normally, a “Coward” taunt may be played and an announcer message may be shown (depending on the situation). Set the optional `noTaunts` parameter to `true` to force the engine to never play a taunt or show a message. `noTaunts` is `false` by default.
       
  1080 
       
  1081 ==== `Retreat(time [, respectGetAwayTimeFactor)` (0.9.25) ====
       
  1082 Forces the current turn into the retreating phase, as if the hog made an attack. That is, the current hedgehog is unable to attack or select a weapon, only movement is possible until the retreat time is up.
       
  1083 
       
  1084 The retreat time must be set with `time` in milliseconds. By default, this time is automatically multiplied with get-away time percentage from the game scheme for seamless integration with schemes. If you want to ignore the game scheme for some reason and set the retreat time no matter what, set `respectGetAwayTimeFactor` to `false`.
       
  1085 
       
  1086 If the current hedgehog was busy doing an attack, the attack is aborted, no shot is made. If this function is called in the ready phase of af a turn, the ready phase continues normally, but the turn will begin in the retreat phase instead.
       
  1087 
       
  1088 Note: If you want the turn to end instantly, it is recommended to use `EndTurn` instead.
       
  1089 
       
  1090 ==== <tt>!EndGame()</tt> ====
       
  1091 Makes the game end.
       
  1092 
  1098 
  1093 === Ammo ===
  1099 === Ammo ===
  1094 ==== <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ====
  1100 ==== <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ====
  1095 This updates the settings (initial ammo, crate probability, etc.) for a specified [AmmoTypes ammo type]. This must only be used in the `onAmmoStoreInit()` event handler. In other places, this function will not work.
  1101 This updates the settings (initial ammo, crate probability, etc.) for a specified [AmmoTypes ammo type]. This must only be used in the `onAmmoStoreInit()` event handler. In other places, this function will not work.
  1096 
  1102