Files
Cataclysm-DDA/doc/sample_mods/lua_player_takeoff/preload.lua
T
PlasticPhoenix 8820c71727 Exposing player takeoff function to LUA (#18560)
* Exposing the player:takeoff function, since we have a function to put
items on, it would be nice to be able to take them off.

* Adding a sample mod to showcase the use of player:takeoff()

* Correcting location of takeoff function. Should be player:, not Character:
2016-10-01 14:58:32 +02:00

15 lines
392 B
Lua

local MOD = {}
mods["LUAPlayerTakeoff"] = MOD
function playertakeoff()
if (player:i_at(-2):display_name() ~= "none") then
game.add_msg("Taking off: "..player:i_at(-2):display_name())
player:takeoff(player:i_at(-2))
else
game.add_msg("Nothing in that slot!")
end
end
game.register_iuse("PLAYERTAKEOFF", playertakeoff)