8820c71727
* 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:
15 lines
392 B
Lua
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)
|