E
Evil Puncker
Guest
my intent to make this into official tfs, it is working, but I think it can be made better, so here I am to ask you guys for help once again into making it friendlier and in tfs standard!
Lua:
local machines = {
[5469] = 5513,
[5470] = 5514
}
local sugarOat = Action()
function sugarOat.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if target.itemid == 2694 then
if toPosition.x ~= CONTAINER_POSITION then
Game.createItem(13939, 1, toPosition)
else
player:addItem(13939, 1)
toPosition = player:getPosition()
end
toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
item:remove(1)
target:remove(1)
return true
end
local targetId = target.itemid
if not targetId then
return true
end
local machine = machines[targetId]
if machine then
target:transform(machine)
target:decay()
item:remove(1)
toPosition:sendMagicEffect(CONST_ME_MAGIC_RED)
return true
end
return true
end
sugarOat:id(5467)
sugarOat:register()