hedgewars/uScript.pas
changeset 7072 159616c24bb8
parent 7063 a0326412e96a
child 7135 4d863aadd0b2
equal deleted inserted replaced
7071:c431a4a8ab0f 7072:159616c24bb8
  2053 luaopen_table(luaState);
  2053 luaopen_table(luaState);
  2054 
  2054 
  2055 // import some variables
  2055 // import some variables
  2056 ScriptSetInteger('LAND_WIDTH', LAND_WIDTH);
  2056 ScriptSetInteger('LAND_WIDTH', LAND_WIDTH);
  2057 ScriptSetInteger('LAND_HEIGHT', LAND_HEIGHT);
  2057 ScriptSetInteger('LAND_HEIGHT', LAND_HEIGHT);
  2058 ScriptSetString('L', cLocale);
  2058 ScriptSetString(_S'L', cLocale);
  2059 
  2059 
  2060 // import game flags
  2060 // import game flags
  2061 ScriptSetInteger('gfForts', gfForts);
  2061 ScriptSetInteger('gfForts', gfForts);
  2062 ScriptSetInteger('gfMultiWeapon', gfMultiWeapon);
  2062 ScriptSetInteger('gfMultiWeapon', gfMultiWeapon);
  2063 ScriptSetInteger('gfSolidLand', gfSolidLand);
  2063 ScriptSetInteger('gfSolidLand', gfSolidLand);
  2147 ScriptSetInteger('gstLoser'          ,$00080000);
  2147 ScriptSetInteger('gstLoser'          ,$00080000);
  2148 ScriptSetInteger('gstHHGone'         ,$00100000);
  2148 ScriptSetInteger('gstHHGone'         ,$00100000);
  2149 ScriptSetInteger('gstInvisible'      ,$00200000);
  2149 ScriptSetInteger('gstInvisible'      ,$00200000);
  2150 
  2150 
  2151 // register functions
  2151 // register functions
  2152 lua_register(luaState, 'band', @lc_band);
  2152 lua_register(luaState, _P'band', @lc_band);
  2153 lua_register(luaState, 'bor', @lc_bor);
  2153 lua_register(luaState, _P'bor', @lc_bor);
  2154 lua_register(luaState, 'bnot', @lc_bnot);
  2154 lua_register(luaState, _P'bnot', @lc_bnot);
  2155 lua_register(luaState, 'div', @lc_div);
  2155 lua_register(luaState, _P'div', @lc_div);
  2156 lua_register(luaState, 'GetInputMask', @lc_getinputmask);
  2156 lua_register(luaState, _P'GetInputMask', @lc_getinputmask);
  2157 lua_register(luaState, 'SetInputMask', @lc_setinputmask);
  2157 lua_register(luaState, _P'SetInputMask', @lc_setinputmask);
  2158 lua_register(luaState, 'AddGear', @lc_addgear);
  2158 lua_register(luaState, _P'AddGear', @lc_addgear);
  2159 lua_register(luaState, 'DeleteGear', @lc_deletegear);
  2159 lua_register(luaState, _P'DeleteGear', @lc_deletegear);
  2160 lua_register(luaState, 'AddVisualGear', @lc_addvisualgear);
  2160 lua_register(luaState, _P'AddVisualGear', @lc_addvisualgear);
  2161 lua_register(luaState, 'DeleteVisualGear', @lc_deletevisualgear);
  2161 lua_register(luaState, _P'DeleteVisualGear', @lc_deletevisualgear);
  2162 lua_register(luaState, 'GetVisualGearValues', @lc_getvisualgearvalues);
  2162 lua_register(luaState, _P'GetVisualGearValues', @lc_getvisualgearvalues);
  2163 lua_register(luaState, 'SetVisualGearValues', @lc_setvisualgearvalues);
  2163 lua_register(luaState, _P'SetVisualGearValues', @lc_setvisualgearvalues);
  2164 lua_register(luaState, 'SpawnHealthCrate', @lc_spawnhealthcrate);
  2164 lua_register(luaState, _P'SpawnHealthCrate', @lc_spawnhealthcrate);
  2165 lua_register(luaState, 'SpawnAmmoCrate', @lc_spawnammocrate);
  2165 lua_register(luaState, _P'SpawnAmmoCrate', @lc_spawnammocrate);
  2166 lua_register(luaState, 'SpawnUtilityCrate', @lc_spawnutilitycrate);
  2166 lua_register(luaState, _P'SpawnUtilityCrate', @lc_spawnutilitycrate);
  2167 lua_register(luaState, 'SpawnFakeHealthCrate', @lc_spawnfakehealthcrate);
  2167 lua_register(luaState, _P'SpawnFakeHealthCrate', @lc_spawnfakehealthcrate);
  2168 lua_register(luaState, 'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate);
  2168 lua_register(luaState, _P'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate);
  2169 lua_register(luaState, 'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate);
  2169 lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate);
  2170 lua_register(luaState, 'WriteLnToConsole', @lc_writelntoconsole);
  2170 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole);
  2171 lua_register(luaState, 'GetGearType', @lc_getgeartype);
  2171 lua_register(luaState, _P'GetGearType', @lc_getgeartype);
  2172 lua_register(luaState, 'EndGame', @lc_endgame);
  2172 lua_register(luaState, _P'EndGame', @lc_endgame);
  2173 lua_register(luaState, 'FindPlace', @lc_findplace);
  2173 lua_register(luaState, _P'FindPlace', @lc_findplace);
  2174 lua_register(luaState, 'SetGearPosition', @lc_setgearposition);
  2174 lua_register(luaState, _P'SetGearPosition', @lc_setgearposition);
  2175 lua_register(luaState, 'GetGearPosition', @lc_getgearposition);
  2175 lua_register(luaState, _P'GetGearPosition', @lc_getgearposition);
  2176 lua_register(luaState, 'SetGearTarget', @lc_setgeartarget);
  2176 lua_register(luaState, _P'SetGearTarget', @lc_setgeartarget);
  2177 lua_register(luaState, 'GetGearTarget', @lc_getgeartarget);
  2177 lua_register(luaState, _P'GetGearTarget', @lc_getgeartarget);
  2178 lua_register(luaState, 'SetGearVelocity', @lc_setgearvelocity);
  2178 lua_register(luaState, _P'SetGearVelocity', @lc_setgearvelocity);
  2179 lua_register(luaState, 'GetGearVelocity', @lc_getgearvelocity);
  2179 lua_register(luaState, _P'GetGearVelocity', @lc_getgearvelocity);
  2180 lua_register(luaState, 'ParseCommand', @lc_parsecommand);
  2180 lua_register(luaState, _P'ParseCommand', @lc_parsecommand);
  2181 lua_register(luaState, 'ShowMission', @lc_showmission);
  2181 lua_register(luaState, _P'ShowMission', @lc_showmission);
  2182 lua_register(luaState, 'HideMission', @lc_hidemission);
  2182 lua_register(luaState, _P'HideMission', @lc_hidemission);
  2183 lua_register(luaState, 'AddCaption', @lc_addcaption);
  2183 lua_register(luaState, _P'AddCaption', @lc_addcaption);
  2184 lua_register(luaState, 'SetAmmo', @lc_setammo);
  2184 lua_register(luaState, _P'SetAmmo', @lc_setammo);
  2185 lua_register(luaState, 'SetAmmoStore', @lc_setammostore);
  2185 lua_register(luaState, _P'SetAmmoStore', @lc_setammostore);
  2186 lua_register(luaState, 'PlaySound', @lc_playsound);
  2186 lua_register(luaState, _P'PlaySound', @lc_playsound);
  2187 lua_register(luaState, 'AddTeam', @lc_addteam);
  2187 lua_register(luaState, _P'AddTeam', @lc_addteam);
  2188 lua_register(luaState, 'AddHog', @lc_addhog);
  2188 lua_register(luaState, _P'AddHog', @lc_addhog);
  2189 lua_register(luaState, 'AddAmmo', @lc_addammo);
  2189 lua_register(luaState, _P'AddAmmo', @lc_addammo);
  2190 lua_register(luaState, 'GetAmmoCount', @lc_getammocount);
  2190 lua_register(luaState, _P'GetAmmoCount', @lc_getammocount);
  2191 lua_register(luaState, 'SetHealth', @lc_sethealth);
  2191 lua_register(luaState, _P'SetHealth', @lc_sethealth);
  2192 lua_register(luaState, 'GetHealth', @lc_gethealth);
  2192 lua_register(luaState, _P'GetHealth', @lc_gethealth);
  2193 lua_register(luaState, 'SetEffect', @lc_seteffect);
  2193 lua_register(luaState, _P'SetEffect', @lc_seteffect);
  2194 lua_register(luaState, 'GetEffect', @lc_geteffect);
  2194 lua_register(luaState, _P'GetEffect', @lc_geteffect);
  2195 lua_register(luaState, 'GetHogClan', @lc_gethogclan);
  2195 lua_register(luaState, _P'GetHogClan', @lc_gethogclan);
  2196 lua_register(luaState, 'GetClanColor', @lc_getclancolor);
  2196 lua_register(luaState, _P'GetClanColor', @lc_getclancolor);
  2197 lua_register(luaState, 'SetClanColor', @lc_setclancolor);
  2197 lua_register(luaState, _P'SetClanColor', @lc_setclancolor);
  2198 lua_register(luaState, 'GetHogTeamName', @lc_gethogteamname);
  2198 lua_register(luaState, _P'GetHogTeamName', @lc_gethogteamname);
  2199 lua_register(luaState, 'GetHogName', @lc_gethogname);
  2199 lua_register(luaState, _P'GetHogName', @lc_gethogname);
  2200 lua_register(luaState, 'SetHogName', @lc_sethogname);
  2200 lua_register(luaState, _P'SetHogName', @lc_sethogname);
  2201 lua_register(luaState, 'GetHogLevel', @lc_gethoglevel);
  2201 lua_register(luaState, _P'GetHogLevel', @lc_gethoglevel);
  2202 lua_register(luaState, 'SetHogLevel', @lc_sethoglevel);
  2202 lua_register(luaState, _P'SetHogLevel', @lc_sethoglevel);
  2203 lua_register(luaState, 'GetX', @lc_getx);
  2203 lua_register(luaState, _P'GetX', @lc_getx);
  2204 lua_register(luaState, 'GetY', @lc_gety);
  2204 lua_register(luaState, _P'GetY', @lc_gety);
  2205 lua_register(luaState, 'CopyPV', @lc_copypv);
  2205 lua_register(luaState, _P'CopyPV', @lc_copypv);
  2206 lua_register(luaState, 'FollowGear', @lc_followgear);
  2206 lua_register(luaState, _P'FollowGear', @lc_followgear);
  2207 lua_register(luaState, 'GetFollowGear', @lc_getfollowgear);
  2207 lua_register(luaState, _P'GetFollowGear', @lc_getfollowgear);
  2208 lua_register(luaState, 'SetState', @lc_setstate);
  2208 lua_register(luaState, _P'SetState', @lc_setstate);
  2209 lua_register(luaState, 'GetState', @lc_getstate);
  2209 lua_register(luaState, _P'GetState', @lc_getstate);
  2210 lua_register(luaState, 'SetTag', @lc_settag);
  2210 lua_register(luaState, _P'SetTag', @lc_settag);
  2211 lua_register(luaState, 'SetTimer', @lc_settimer);
  2211 lua_register(luaState, _P'SetTimer', @lc_settimer);
  2212 lua_register(luaState, 'GetTimer', @lc_gettimer);
  2212 lua_register(luaState, _P'GetTimer', @lc_gettimer);
  2213 lua_register(luaState, 'SetZoom', @lc_setzoom);
  2213 lua_register(luaState, _P'SetZoom', @lc_setzoom);
  2214 lua_register(luaState, 'GetZoom', @lc_getzoom);
  2214 lua_register(luaState, _P'GetZoom', @lc_getzoom);
  2215 lua_register(luaState, 'HogSay', @lc_hogsay);
  2215 lua_register(luaState, _P'HogSay', @lc_hogsay);
  2216 lua_register(luaState, 'SwitchHog', @lc_switchhog);
  2216 lua_register(luaState, _P'SwitchHog', @lc_switchhog);
  2217 lua_register(luaState, 'HogTurnLeft', @lc_hogturnleft);
  2217 lua_register(luaState, _P'HogTurnLeft', @lc_hogturnleft);
  2218 lua_register(luaState, 'CampaignLock', @lc_campaignlock);
  2218 lua_register(luaState, _P'CampaignLock', @lc_campaignlock);
  2219 lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock);
  2219 lua_register(luaState, _P'CampaignUnlock', @lc_campaignunlock);
  2220 lua_register(luaState, 'GetGearElasticity', @lc_getgearelasticity);
  2220 lua_register(luaState, _P'GetGearElasticity', @lc_getgearelasticity);
  2221 lua_register(luaState, 'GetGearRadius', @lc_getgearradius);
  2221 lua_register(luaState, _P'GetGearRadius', @lc_getgearradius);
  2222 lua_register(luaState, 'GetGearMessage', @lc_getgearmessage);
  2222 lua_register(luaState, _P'GetGearMessage', @lc_getgearmessage);
  2223 lua_register(luaState, 'SetGearMessage', @lc_setgearmessage);
  2223 lua_register(luaState, _P'SetGearMessage', @lc_setgearmessage);
  2224 lua_register(luaState, 'GetGearPos', @lc_getgearpos);
  2224 lua_register(luaState, _P'GetGearPos', @lc_getgearpos);
  2225 lua_register(luaState, 'SetGearPos', @lc_setgearpos);
  2225 lua_register(luaState, _P'SetGearPos', @lc_setgearpos);
  2226 lua_register(luaState, 'GetRandom', @lc_getrandom);
  2226 lua_register(luaState, _P'GetRandom', @lc_getrandom);
  2227 lua_register(luaState, 'SetWind', @lc_setwind);
  2227 lua_register(luaState, _P'SetWind', @lc_setwind);
  2228 lua_register(luaState, 'GetDataPath', @lc_getdatapath);
  2228 lua_register(luaState, _P'GetDataPath', @lc_getdatapath);
  2229 lua_register(luaState, 'GetUserDataPath', @lc_getuserdatapath);
  2229 lua_register(luaState, _P'GetUserDataPath', @lc_getuserdatapath);
  2230 lua_register(luaState, 'MapHasBorder', @lc_maphasborder);
  2230 lua_register(luaState, _P'MapHasBorder', @lc_maphasborder);
  2231 lua_register(luaState, 'GetHogHat', @lc_gethoghat);
  2231 lua_register(luaState, _P'GetHogHat', @lc_gethoghat);
  2232 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
  2232 lua_register(luaState, _P'SetHogHat', @lc_sethoghat);
  2233 lua_register(luaState, 'PlaceGirder', @lc_placegirder);
  2233 lua_register(luaState, _P'PlaceGirder', @lc_placegirder);
  2234 lua_register(luaState, 'GetCurAmmoType', @lc_getcurammotype);
  2234 lua_register(luaState, _P'GetCurAmmoType', @lc_getcurammotype);
  2235 lua_register(luaState, 'TestRectForObstacle', @lc_testrectforobstacle);
  2235 lua_register(luaState, _P'TestRectForObstacle', @lc_testrectforobstacle);
  2236 
  2236 
  2237 
  2237 
  2238 ScriptClearStack; // just to be sure stack is empty
  2238 ScriptClearStack; // just to be sure stack is empty
  2239 ScriptLoaded:= false;
  2239 ScriptLoaded:= false;
  2240 end;
  2240 end;