# HG changeset patch # User smaxx # Date 1284144379 -7200 # Node ID 32ceb775906ba90b21c22b50f53f40b0cee23dae # Parent 771562124b168409be34f24f9721d4b97fb07e49 Engine: * Added new script call: OnGearDamage(GearID : integer, Damage : integer) - triggered once gears are damaged * Renamed script call: OnResurrect is now called OnGearResurrect * Added new script functions: CampaignLock(key : string), CampaignUnlock(key : string) - toggles for (not yet implemented) campaign access and progress flags diff -r 771562124b16 -r 32ceb775906b hedgewars/uGears.pas --- a/hedgewars/uGears.pas Fri Sep 10 16:42:11 2010 +0200 +++ b/hedgewars/uGears.pas Fri Sep 10 20:46:19 2010 +0200 @@ -731,6 +731,8 @@ Gear^.Tex:= RenderStringTex(inttostr(Gear^.Timer div 1000), cWhiteColor, fntSmall); end; Gear^.doStep(Gear); + // might be useful later + //ScriptCall('OnGearStep', Gear^.uid); end end; @@ -969,6 +971,7 @@ end; end; inc(Gear^.Damage, Damage); + ScriptCall('OnGearDamage', Gear^.UID, Damage); end; procedure SetAllToActive; @@ -1573,7 +1576,7 @@ FindPlace(gear, false, 0, LAND_WIDTH); if gear <> nil then begin RenderHealth(PHedgehog(gear^.Hedgehog)^); - ScriptCall('onResurrect', gear^.uid); + ScriptCall('onGearResurrect', gear^.uid); end; RecountTeamHealth(tempTeam); end; diff -r 771562124b16 -r 32ceb775906b hedgewars/uScript.pas --- a/hedgewars/uScript.pas Fri Sep 10 16:42:11 2010 +0200 +++ b/hedgewars/uScript.pas Fri Sep 10 20:46:19 2010 +0200 @@ -118,6 +118,28 @@ lc_hidemission:= 0; end; +function lc_campaignlock(L : Plua_State) : LongInt; Cdecl; +begin + if lua_gettop(L) = 1 then + begin + // to be done + end + else + LuaError('Lua: Wrong number of parameters passed to CampaignLock!'); + lc_campaignlock:= 0; +end; + +function lc_campaignunlock(L : Plua_State) : LongInt; Cdecl; +begin + if lua_gettop(L) = 1 then + begin + // to be done + end + else + LuaError('Lua: Wrong number of parameters passed to CampaignUnlock!'); + lc_campaignunlock:= 0; +end; + function lc_spawnhealthcrate(L: Plua_State) : LongInt; Cdecl; var gear: PGear; begin @@ -1056,6 +1078,8 @@ lua_register(luaState, 'GetZoom', @lc_getzoom); lua_register(luaState, 'HogSay', @lc_hogsay); lua_register(luaState, 'HogTurnLeft', @lc_hogturnleft); +lua_register(luaState, 'CampaignLock', @lc_campaignlock); +lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock); ScriptClearStack; // just to be sure stack is empty