removething.lua

main 34 lines · 740 bytes Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1function onSay(player, words, param)
2 if player:getGroup():getId() < 3 then
3 return false
4 end
5
6 local position = player:getPosition()
7 position:getNextPosition(player:getDirection())
8
9 local tile = Tile(position)
10 if not tile then
11 player:sendCancelMessage("Object not found.")
12 return false
13 end
14
15 local thing = tile:getTopVisibleThing(player)
16 if not thing then
17 player:sendCancelMessage("Thing not found.")
18 return false
19 end
20
21 if thing:isCreature() then
22 thing:remove()
23 elseif thing:isItem() then
24 if thing == tile:getGround() then
25 player:sendCancelMessage("You may not remove a ground tile.")
26 return false
27 end
28 thing:remove(tonumber(param) or -1)
29 end
30
31 position:sendMagicEffect(CONST_ME_MAGIC_RED)
32 return false
33end
34
Top