-------------------------------------------------------------------
-- Wrapper functions for easy usage of CS2D commands in Lua      --
-- 08.03.2009 - www.UnrealSoftware.de                            --
-------------------------------------------------------------------

-------------------------------------------------------------------
-- These functions make it easier to use CS2D commands in Lua    --
-- They call the parse functions with the fitting parameters     --
--                                                               --
-- Example without wrapper function:                             --
-- parse("spawnplayer "..id.." "..x.." " ..y)                    --
--                                                               --
-- Example with wrapper function:                                --
-- spawnplayer(id,x,y)                                           --
--                                                               --
-- Both examples do exactly the same but using the wrapper       --
-- function is much easier and not as error-prone as using parse.--
-- Therefore it is recommended to use the wrapper functions.     --
--                                                               --
-- Use the following line to include the wrapper in your script: --
-- if wrapper~=TRUE then dofile("sys/lua/wrapper.lua") end       --
-------------------------------------------------------------------

-- Set Wrapper state to LOADED/TRUE!
wrapper=TRUE

-- Kill a player
function killplayer(id)
	parse("killplayer "..id)
end

-- Spawn a player at a certain position
function spawnplayer(id,x,y)
	parse("spawnplayer "..id.." "..x.." "..y)
end

-- Set a player to a certain position
function setpos(id,x,y)
	parse("setpos "..id.." "..x.." "..y)
end

-- Set money
function setmoney(id,money)
	parse("setmoney "..id.." "..money)
end

-- Set health
function sethealth(id,health)
	parse("sethealth "..id.." "..health)
end

-- Set maximum health
function setmaxhealth(id,maxhealth)
	parse("setmaxhealth "..id.." "..maxhealth)
end

-- Set armor
function setarmor(id,armor)
	parse("setarmor "..id.." "..armor)
end

-- Set score
function setscore(id,score)
	parse("setscore "..id.." "..score)
end

-- Set deaths
function setdeaths(id,deaths)
	parse("setdeaths "..id.." "..deaths)
end

-- Equip a player with an item
function equip(id,itemtype)
	parse("equip "..id.." "..itemtype)
end

-- Remove an item from a player
function strip(id,itemtype)
	parse("strip "..id.." "..itemtype)
end

-- Modify speed of a player
function speedmod(id,value)
	parse("speedmod "..id.." "..value)
end

-- Spawn item on map
function spawnitem(itemtype,x,y)
	parse("spawnitem "..itemtype.." "..x.." "..y)
end

-- Remove item from map
function removeitem(itemid)
	parse("removeitem "..itemid)
end

-- Trigger entities
function trigger(name)
	parse("trigger "..name)
end