mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-13 14:24:55 +02:00
introduce changes from streamside fork
This commit is contained in:
@@ -9,3 +9,4 @@ dofile('data/lib/core/player.lua')
|
||||
dofile('data/lib/core/position.lua')
|
||||
dofile('data/lib/core/teleport.lua')
|
||||
dofile('data/lib/core/tile.lua')
|
||||
dofile('data/lib/core/vocation.lua')
|
@@ -9,7 +9,7 @@ function Game.removeItemsOnMap(position)
|
||||
local i = 0
|
||||
while i < tileCount do
|
||||
local tileItem = tile:getThing(i)
|
||||
if tileItem and not tileItem:isCreature() and ItemType(tileItem:getId()):isMovable() then
|
||||
if tileItem and tileItem:getType():isMovable() then
|
||||
tileItem:remove()
|
||||
else
|
||||
i = i + 1
|
||||
@@ -24,10 +24,8 @@ function Game.transformItemOnMap(position, itemId, toItemId, subtype)
|
||||
|
||||
local tile = Tile(position)
|
||||
local item = tile:getItemById(itemId)
|
||||
if item ~= nil then
|
||||
item:transform(toItemId, subtype)
|
||||
item:decay()
|
||||
end
|
||||
item:transform(toItemId, subtype)
|
||||
item:decay()
|
||||
return item
|
||||
end
|
||||
|
||||
|
@@ -21,3 +21,45 @@ end
|
||||
function Tile.isTile(self)
|
||||
return true
|
||||
end
|
||||
|
||||
function Tile.relocateTo(self, toPosition, pushMove, monsterPosition)
|
||||
if self:getPosition() == toPosition then
|
||||
return false
|
||||
end
|
||||
|
||||
if not Tile(toPosition) then
|
||||
return false
|
||||
end
|
||||
|
||||
for i = self:getThingCount() - 1, 0, -1 do
|
||||
local thing = self:getThing(i)
|
||||
if thing then
|
||||
if thing:isItem() then
|
||||
if ItemType(thing.itemid):isMovable() then
|
||||
thing:moveTo(toPosition)
|
||||
end
|
||||
elseif thing:isCreature() then
|
||||
if monsterPosition and thing:isMonster() then
|
||||
thing:teleportTo(monsterPosition, pushMove)
|
||||
else
|
||||
thing:teleportTo(toPosition, pushMove)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function Tile:getPlayers()
|
||||
local players = {}
|
||||
local creatures = self:getCreatures()
|
||||
if (creatures) then
|
||||
for i = 1, #creatures do
|
||||
if (creatures[i]:isPlayer()) then
|
||||
table.insert(players, creatures[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return players
|
||||
end
|
7
data/lib/core/vocation.lua
Normal file
7
data/lib/core/vocation.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
function Vocation.getBase(self)
|
||||
local base = self
|
||||
while base:getDemotion() do
|
||||
base = base:getDemotion()
|
||||
end
|
||||
return base
|
||||
end
|
Reference in New Issue
Block a user