# HG changeset patch # User nemo # Date 1417379451 18000 # Node ID 98ea597e5cd9ae812c29fbe0daec77764300a1b7 # Parent 6189bb1c903df3f0d281eb4411c1a03dcf483af7 expose FlightTime to lua, disable in-air flame harming moving hogs ☹ aaaand override that in ClimbHome ☺ diff -r 6189bb1c903d -r 98ea597e5cd9 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Sun Nov 30 21:15:46 2014 +0100 +++ b/hedgewars/uGearsHandlersMess.pas Sun Nov 30 15:30:51 2014 -0500 @@ -4770,7 +4770,7 @@ SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); flame^.CollisionMask:= lfNotCurrentMask; - flame^.FlightTime:= 500; + //flame^.FlightTime:= 500; use the default huge value to avoid sticky flame suddenly being damaging as opposed to other flames if (Gear^.Health mod 30) = 0 then begin @@ -4778,7 +4778,7 @@ SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); flame^.CollisionMask:= lfNotCurrentMask; - flame^.FlightTime:= 500; + //flame^.FlightTime:= 500; end end; Gear^.Timer:= Gear^.Tag diff -r 6189bb1c903d -r 98ea597e5cd9 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Sun Nov 30 21:15:46 2014 +0100 +++ b/hedgewars/uGearsList.pas Sun Nov 30 15:30:51 2014 -0500 @@ -408,6 +408,7 @@ gear^.Radius:= 1; gear^.Health:= 5; gear^.Density:= _1; + gear^.FlightTime:= 9999999; // determines whether in-air flames do damage. disabled by default if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then begin gear^.dY:= (getrandomf - _0_8) * _0_03; diff -r 6189bb1c903d -r 98ea597e5cd9 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sun Nov 30 21:15:46 2014 +0100 +++ b/hedgewars/uScript.pas Sun Nov 30 15:30:51 2014 -0500 @@ -1144,6 +1144,22 @@ lc_gettimer:= 1 end; +function lc_getflighttime(L : Plua_State) : LongInt; Cdecl; +var gear : PGear; +begin + if CheckLuaParamCount(L, 1, 'GetFlightTime', 'gearUid') then + begin + gear:= GearByUID(lua_tointeger(L, 1)); + if gear <> nil then + lua_pushinteger(L, gear^.FlightTime) + else + lua_pushnil(L); + end + else + lua_pushnil(L); // return value on stack (nil) + lc_getflighttime:= 1 +end; + function lc_gethealth(L : Plua_State) : LongInt; Cdecl; var gear : PGear; begin @@ -1380,6 +1396,17 @@ lc_settimer:= 0 end; +function lc_setflighttime(L : Plua_State) : LongInt; Cdecl; +var gear : PGear; +begin + if CheckLuaParamCount(L, 2, 'SetFlightTime', 'gearUid, flighttime') then + begin + gear:= GearByUID(lua_tointeger(L, 1)); + if gear <> nil then gear^.FlightTime:= lua_tointeger(L, 2) + end; + lc_setflighttime:= 0 +end; + function lc_seteffect(L : Plua_State) : LongInt; Cdecl; var gear: PGear; t : LongInt; @@ -2877,6 +2904,8 @@ lua_register(luaState, _P'SetTag', @lc_settag); lua_register(luaState, _P'SetTimer', @lc_settimer); lua_register(luaState, _P'GetTimer', @lc_gettimer); +lua_register(luaState, _P'SetFlightTime', @lc_setflighttime); +lua_register(luaState, _P'GetFlightTime', @lc_getflighttime); lua_register(luaState, _P'SetZoom', @lc_setzoom); lua_register(luaState, _P'GetZoom', @lc_getzoom); lua_register(luaState, _P'HogSay', @lc_hogsay); diff -r 6189bb1c903d -r 98ea597e5cd9 share/hedgewars/Data/Maps/ClimbHome/map.lua --- a/share/hedgewars/Data/Maps/ClimbHome/map.lua Sun Nov 30 21:15:46 2014 +0100 +++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua Sun Nov 30 15:30:51 2014 -0500 @@ -161,6 +161,7 @@ end flame = AddGear(x+fx, y+fy, gtFlame, gsttmpFlag, fdx, fdy, 0) SetTag(flame, 999999+i) + SetFlightTime(flame, 0) Fire[flame]=1 -- BoomFire[flame]=1 end