853 lc_gethogname:= 1 |
853 lc_gethogname:= 1 |
854 end; |
854 end; |
855 |
855 |
856 function lc_sethogname(L : Plua_State) : LongInt; Cdecl; |
856 function lc_sethogname(L : Plua_State) : LongInt; Cdecl; |
857 var gear : PGear; |
857 var gear : PGear; |
858 hogName: ShortString; |
|
859 begin |
858 begin |
860 if lua_gettop(L) <> 2 then |
859 if lua_gettop(L) <> 2 then |
861 begin |
860 begin |
862 LuaError('Lua: Wrong number of parameters passed to SetHogName!'); |
861 LuaError('Lua: Wrong number of parameters passed to SetHogName!'); |
863 lua_pushnil(L) |
862 lua_pushnil(L) |
864 end |
863 end |
865 else |
864 else |
866 begin |
865 begin |
867 gear:= GearByUID(lua_tointeger(L, 1)); |
866 gear:= GearByUID(lua_tointeger(L, 1)); |
868 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then |
867 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then |
869 |
868 begin |
870 hogName:= lua_tostring(L, 2); |
869 gear^.Hedgehog^.Name:= lua_tostring(L, 2); |
871 gear^.Hedgehog^.Name:= hogName; |
870 |
872 |
871 FreeTexture(gear^.Hedgehog^.NameTagTex); |
873 FreeTexture(gear^.Hedgehog^.NameTagTex); |
872 gear^.Hedgehog^.NameTagTex:= RenderStringTex(gear^.Hedgehog^.Name, gear^.Hedgehog^.Team^.Clan^.Color, fnt16) |
874 gear^.Hedgehog^.NameTagTex:= RenderStringTex(gear^.Hedgehog^.Name, gear^.Hedgehog^.Team^.Clan^.Color, fnt16); |
873 end |
875 |
|
876 end; |
874 end; |
877 lc_sethogname:= 0; |
875 lc_sethogname:= 0; |
878 end; |
876 end; |
879 |
877 |
880 function lc_gettimer(L : Plua_State) : LongInt; Cdecl; |
878 function lc_gettimer(L : Plua_State) : LongInt; Cdecl; |
1742 end |
1740 end |
1743 else |
1741 else |
1744 begin |
1742 begin |
1745 gear:= GearByUID(lua_tointeger(L, 1)); |
1743 gear:= GearByUID(lua_tointeger(L, 1)); |
1746 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then |
1744 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then |
|
1745 begin |
1747 hat:= lua_tostring(L, 2); |
1746 hat:= lua_tostring(L, 2); |
1748 gear^.Hedgehog^.Hat:= hat; |
1747 gear^.Hedgehog^.Hat:= hat; |
1749 AddFileLog('Changed hat to: '+hat); |
1748 AddFileLog('Changed hat to: '+hat); |
1750 if (Length(hat) > 39) and (Copy(hat,1,8) = 'Reserved') and (Copy(hat,9,32) = gear^.Hedgehog^.Team^.PlayerHash) then |
1749 if (Length(hat) > 39) and (Copy(hat,1,8) = 'Reserved') and (Copy(hat,9,32) = gear^.Hedgehog^.Team^.PlayerHash) then |
1751 LoadHedgehogHat(gear^.Hedgehog^, 'Reserved/' + Copy(hat,9,Length(hat)-8)) |
1750 LoadHedgehogHat(gear^.Hedgehog^, 'Reserved/' + Copy(hat,9,Length(hat)-8)) |
1752 else |
1751 else |
1753 LoadHedgehogHat(gear^.Hedgehog^, hat); |
1752 LoadHedgehogHat(gear^.Hedgehog^, hat) |
|
1753 end |
1754 end; |
1754 end; |
1755 lc_sethoghat:= 0; |
1755 lc_sethoghat:= 0; |
1756 end; |
1756 end; |
1757 |
1757 |
1758 function lc_placegirder(L : Plua_State) : LongInt; Cdecl; |
1758 function lc_placegirder(L : Plua_State) : LongInt; Cdecl; |