# HG changeset patch # User Wuzzy # Date 1479926341 -3600 # Node ID 553f97b1e4fe504ab0c226111d2d9eca2acc5910 # Parent f71e34babe8c325990b10f5ef71983884796fc36 Add GetHogFort to Lua API diff -r f71e34babe8c -r 553f97b1e4fe ChangeLog.txt --- a/ChangeLog.txt Wed Nov 23 18:57:08 2016 +0100 +++ b/ChangeLog.txt Wed Nov 23 19:39:01 2016 +0100 @@ -121,6 +121,7 @@ + New call: GetVisualGearType(vgUid) -- returns the visual gear type + New call: SetAmmoTexts(ammoType, name, caption, description) -- Overwrite displayed name and description of an ammo type + New call: SetAmmoDescriptionAppendix(ammoType, descAppend) -- Append a custom text to the description of an ammo type without overwriting it + + New call: GetHogFort(gearUid) -- Returns the name of the fort of the hog's team + New hook: onVisualGearAdd(vgUid) -- called when a visual gear is added + New hook: onVisualGearDelete(vgUid) -- called when a visual gear is deleted + New variable: AirMinesNum -- Number of air mines being placed on a medium-sized map diff -r f71e34babe8c -r 553f97b1e4fe hedgewars/uScript.pas --- a/hedgewars/uScript.pas Wed Nov 23 18:57:08 2016 +0100 +++ b/hedgewars/uScript.pas Wed Nov 23 19:39:01 2016 +0100 @@ -1362,6 +1362,23 @@ lc_gethogflag:= 1 end; +function lc_gethogfort(L : Plua_State) : LongInt; Cdecl; +var gear : PGear; +begin + if CheckLuaParamCount(L, 1, 'GetHogFort', 'gearUid') then + begin + gear:= GearByUID(lua_tointeger(L, 1)); + // TODO error messages + if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then + lua_pushstring(L, str2pchar(gear^.Hedgehog^.Team^.FortName)) + else + lua_pushnil(L); + end + else + lua_pushnil(L); // return value on stack (nil) + lc_gethogfort:= 1 +end; + function lc_ishoglocal(L : Plua_State) : LongInt; Cdecl; var gear : PGear; begin @@ -3405,6 +3422,7 @@ lua_register(luaState, _P'SetClanColor', @lc_setclancolor); lua_register(luaState, _P'GetHogVoicepack', @lc_gethogvoicepack); lua_register(luaState, _P'GetHogFlag', @lc_gethogflag); +lua_register(luaState, _P'GetHogFort', @lc_gethogfort); lua_register(luaState, _P'GetHogGrave', @lc_gethoggrave); lua_register(luaState, _P'IsHogLocal', @lc_ishoglocal); lua_register(luaState, _P'GetHogTeamName', @lc_gethogteamname);