<commit_before>--[[
Illarion Server

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
details.

You should have received a copy of the GNU Affero General Public License along
with this program.  If not, see <http://www.gnu.org/licenses/>.
]]

local M = {}
local id_382_ceilingtrowel = require("gm.items.id_382_ceilingtrowel")

-- UPDATE items SET itm_script='item.id_316_sand' WHERE itm_id = 316;

local deleteIt

function M.MoveItemBeforeMove(User, SourceItem, TargetItem)
    deleteIt=false;
    local GroundItem = world:getItemOnField(TargetItem.pos)
    if (GroundItem.id==10) then
        world:erase(GroundItem,1)
        deleteIt=true
        world:gfx(45,TargetItem.pos)
        
        -- In case the portal is on a gm set spawnpoint, we remove the spawnpoint
        local removeCounter = 0
        for i = 1, #id_382_ceilingtrowel.gmSpawnpointSettings do
            local position = gmSpawnpointSettings[i - removeCounter][2]
            if position == TargetItem.pos then
                table.remove(id_382_ceilingtrowel.gmSpawnpointSettings, i - removeCounter)
                removeCounter = removecounter + 1
            end
        end
    end
    return true
end

function M.MoveItemAfterMove(User, SourceItem, TargetItem)
    if deleteIt then world:erase(TargetItem,1) end
end

return M

<commit_msg>Check wether variable is set<commit_after>--[[
Illarion Server

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
details.

You should have received a copy of the GNU Affero General Public License along
with this program.  If not, see <http://www.gnu.org/licenses/>.
]]

local M = {}
local id_382_ceilingtrowel = require("gm.items.id_382_ceilingtrowel")

-- UPDATE items SET itm_script='item.id_316_sand' WHERE itm_id = 316;

local deleteIt

function M.MoveItemBeforeMove(User, SourceItem, TargetItem)
    deleteIt=false;
    local GroundItem = world:getItemOnField(TargetItem.pos)
    if (GroundItem.id==10) then
        world:erase(GroundItem,1)
        deleteIt=true
        world:gfx(45,TargetItem.pos)
        
        -- In case the portal is on a gm set spawnpoint, we remove the spawnpoint
        if id_382_ceilingtrowel.gmSpawnpointSettings then
            local removeCounter = 0
            for i = 1, #id_382_ceilingtrowel.gmSpawnpointSettings do
                local position = gmSpawnpointSettings[i - removeCounter][2]
                if position == TargetItem.pos then
                    table.remove(id_382_ceilingtrowel.gmSpawnpointSettings, i - removeCounter)
                    removeCounter = removecounter + 1
                end
            end
        end
    end
    return true
end

function M.MoveItemAfterMove(User, SourceItem, TargetItem)
    if deleteIt then world:erase(TargetItem,1) end
end

return M


{'fraction_non_alphanumeric': 0.0615851974592654, 'fraction_numerical': 0.016846175089754212, 'mean_word_length': 3.1824480369515014, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3996488', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1027, 'n_words': 382}