672 end; |
672 end; |
673 |
673 |
674 function lc_hogsay(L : Plua_State) : LongInt; Cdecl; |
674 function lc_hogsay(L : Plua_State) : LongInt; Cdecl; |
675 var gear : PGear; |
675 var gear : PGear; |
676 vgear : PVisualGear; |
676 vgear : PVisualGear; |
677 begin |
677 s : LongWord; |
678 if lua_gettop(L) <> 3 then |
678 begin |
679 begin |
679 if lua_gettop(L) = 4 then s:= lua_tointeger(L, 4) |
680 LuaError('Lua: Wrong number of parameters passed to HogSay!'); |
680 else s:= 0; |
681 end |
681 |
682 else |
682 if (lua_gettop(L) = 4) or (lua_gettop(L) = 3) then |
683 begin |
683 begin |
684 gear:= GearByUID(lua_tointeger(L, 1)); |
684 gear:= GearByUID(lua_tointeger(L, 1)); |
685 if gear <> nil then |
685 if gear <> nil then |
686 begin |
686 begin |
687 vgear:= AddVisualGear(0, 0, vgtSpeechBubble); |
687 vgear:= AddVisualGear(0, 0, vgtSpeechBubble, s, true); |
688 if vgear <> nil then |
688 if vgear <> nil then |
689 begin |
689 begin |
690 vgear^.Text:= lua_tostring(L, 2); |
690 vgear^.Text:= lua_tostring(L, 2); |
691 vgear^.Hedgehog:= gear^.Hedgehog; |
691 vgear^.Hedgehog:= gear^.Hedgehog; |
692 vgear^.FrameTicks:= lua_tointeger(L, 3); |
692 vgear^.FrameTicks:= lua_tointeger(L, 3); |
693 if (vgear^.FrameTicks < 1) or (vgear^.FrameTicks > 3) then vgear^.FrameTicks:= 1; |
693 if (vgear^.FrameTicks < 1) or (vgear^.FrameTicks > 3) then vgear^.FrameTicks:= 1; |
694 end; |
694 end; |
695 end |
695 end |
696 end; |
696 end |
|
697 else LuaError('Lua: Wrong number of parameters passed to HogSay!'); |
697 lc_hogsay:= 0 |
698 lc_hogsay:= 0 |
698 end; |
699 end; |
699 |
700 |
700 function lc_addammo(L : Plua_State) : LongInt; Cdecl; |
701 function lc_addammo(L : Plua_State) : LongInt; Cdecl; |
701 var gear : PGear; |
702 var gear : PGear; |