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
--- 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;
--- 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