Grass_1 Protection Bug...

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Grass_1 Protection Bug...

by TenPlus1 » Tue Apr 01, 2014 08:53

When trying to place default:grass_1 near a protection block the server shuts down... It does this every time and brings up the following error:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
09:50:28: ERROR[main]: ERROR: An unhandled exception occurred: ...e/minetest/games/minetest_game/mods/farming/init.lua:212: attempt to index local 'ret' (a nil value)
09:50:28: ERROR[main]: stack traceback:
09:50:28: ERROR[main]:     ...e/minetest/games/minetest_game/mods/farming/init.lua:212: in function <...e/minetest/games/minetest_game/mods/farming/init.lua:208>

In thread b6cea700:
/build/buildd/minetestc55-201403250546/src/main.cpp:1875: int main(int, char**): Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD b3cffb40:
#0  virtual void* CurlFetchThread::Thread()
DEBUG STACK FOR THREAD b6cea700:
#0  int main(int, char**)
(Leftover data: #1  Dedicated server branch)
(Leftover data: #2  virtual void ServerMap::save(ModifiedState))
(Leftover data: #3  virtual void Database_SQLite3::saveBlock(MapBlock*))
(Leftover data: #4  void ItemStack::serialize(std::ostream&) const)
Aborted


I've had to edit the /usr/share/minetest/games/minetest_game/mods/farming/init.lua file and comment out lines 208 to 213 so it wont happen on our server...

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--    on_place = function(itemstack, placer, pointed_thing)
--        -- place a random grass node
--        local stack = ItemStack("default:grass_"..math.random(1,5))
--        local ret = minetest.item_place(stack, placer, pointed_thing)
--        return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
--    end,
Last edited by TenPlus1 on Tue Apr 01, 2014 08:56, edited 1 time in total.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Tue Apr 01, 2014 10:33

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.item_place(itemstack, placer, pointed_thing)

In the protection mod must return an itemstack!

Like in MyExampleProtection_mod:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
myProtectionMod.default_item_place = minetest.item_place
function minetest.item_place(itemstack, placer, pointed_thing)
    local name = placer:get_player_name()
    if myProtectionMod.isProtected(pointed_thing.above) then
        return myProtectionMod.default_item_place(itemstack, placer, pointed_thing) --default function of item_place returns itemstack, too
    else
        minetest.chat_send_player(name, "This area is protected!")
        return itemstack --it returns itemstack
    end
end
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 


Return to Minetest Problems

Who is online

Users browsing this forum: No registered users and 13 guests