forgottenserver
forgottenserver copied to clipboard
fluidcontainer/trashholding mechanic
Desired functionality
- create a vial filled with any fluid type, example /i vial, 2
- use the vial with lava target tile
what should happen is the vial should empty and effect should be displayed on target tile, in this case "fire"
so need a way to check for trashholder type and effect
<item fromid="598" toid="601" name="lava">
<attribute key="type" value="trashholder"/>
<attribute key="effect" value="fire"/>
<attribute key="allowpickupable" value="1"/>
</item>
https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/other/fluids.lua
leaving this code here for later, cba do a pr atm
first need to check if itemType is trahsholder and that it has effect (todo)
here is how to get the effect and empty the vial
toPosition:sendMagicEffect(targetItemType:getMagicEffect())
item:transform(item.itemid, FLUID_NONE)
luascript.cpp
registerMethod("ItemType", "getMagicEffect", LuaScriptInterface::luaItemTypeGetMagicEffect);
int LuaScriptInterface::luaItemTypeGetMagicEffect(lua_State* L) { // itemType:getMagicEffect() const ItemType* itemType = getUserdata<const ItemType>(L, 1); if (itemType) { lua_pushnumber(L, itemType->magicEffect); } else { lua_pushnil(L); } return 1; }
luascript.h
static int luaItemTypeGetMagicEffect(lua_State* L);