723 end; |
723 end; |
724 end |
724 end |
725 end |
725 end |
726 else LuaError('Lua: Wrong number of parameters passed to HogSay!'); |
726 else LuaError('Lua: Wrong number of parameters passed to HogSay!'); |
727 lc_hogsay:= 0 |
727 lc_hogsay:= 0 |
|
728 end; |
|
729 |
|
730 function lc_switchhog(L : Plua_State) : LongInt; Cdecl; |
|
731 var gear, prevgear : PGear; |
|
732 begin |
|
733 if lua_gettop(L) <> 1 then |
|
734 LuaError('Lua: Wrong number of parameters passed to SwitchHog!') |
|
735 else |
|
736 begin |
|
737 gear:= GearByUID(lua_tointeger(L, 1)); |
|
738 // should we allow this when there is no current hedgehog? might do some odd(er) things to turn sequence. |
|
739 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) and (CurrentHedgehog <> nil) then |
|
740 begin |
|
741 prevgear := CurrentHedgehog^.Gear; |
|
742 prevgear^.Active := false; |
|
743 prevgear^.State:= prevgear^.State and not gstHHDriven; |
|
744 prevgear^.Z := cHHZ; |
|
745 RemoveGearFromList(prevgear); |
|
746 InsertGearToList(prevgear); |
|
747 |
|
748 CurrentHedgehog := gear^.Hedgehog; |
|
749 // yes, this will muck up turn sequence |
|
750 CurrentTeam := gear^.Hedgehog^.Team; |
|
751 |
|
752 gear^.State:= gear^.State or gstHHDriven; |
|
753 gear^.Active := true; |
|
754 gear^.Z := cCurrHHZ; |
|
755 RemoveGearFromList(gear); |
|
756 InsertGearToList(gear); |
|
757 end |
|
758 end; |
|
759 lc_switchhog:= 0 |
728 end; |
760 end; |
729 |
761 |
730 function lc_addammo(L : Plua_State) : LongInt; Cdecl; |
762 function lc_addammo(L : Plua_State) : LongInt; Cdecl; |
731 var gear : PGear; |
763 var gear : PGear; |
732 begin |
764 begin |
1532 lua_register(luaState, 'SetTimer', @lc_settimer); |
1564 lua_register(luaState, 'SetTimer', @lc_settimer); |
1533 lua_register(luaState, 'GetTimer', @lc_gettimer); |
1565 lua_register(luaState, 'GetTimer', @lc_gettimer); |
1534 lua_register(luaState, 'SetZoom', @lc_setzoom); |
1566 lua_register(luaState, 'SetZoom', @lc_setzoom); |
1535 lua_register(luaState, 'GetZoom', @lc_getzoom); |
1567 lua_register(luaState, 'GetZoom', @lc_getzoom); |
1536 lua_register(luaState, 'HogSay', @lc_hogsay); |
1568 lua_register(luaState, 'HogSay', @lc_hogsay); |
|
1569 lua_register(luaState, 'SwitchHog', @lc_switchhog); |
1537 lua_register(luaState, 'HogTurnLeft', @lc_hogturnleft); |
1570 lua_register(luaState, 'HogTurnLeft', @lc_hogturnleft); |
1538 lua_register(luaState, 'CampaignLock', @lc_campaignlock); |
1571 lua_register(luaState, 'CampaignLock', @lc_campaignlock); |
1539 lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock); |
1572 lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock); |
1540 lua_register(luaState, 'GetGearElasticity', @lc_getgearelasticity); |
1573 lua_register(luaState, 'GetGearElasticity', @lc_getgearelasticity); |
1541 lua_register(luaState, 'GetGearMessage', @lc_getgearmessage); |
1574 lua_register(luaState, 'GetGearMessage', @lc_getgearmessage); |