]> git.lizzy.rs Git - skycraft.git/commitdiff
LuckyBlock Updates
authorElias Fleckenstein <eliasfleckenstein@web.de>
Wed, 10 Jun 2020 16:07:54 +0000 (18:07 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Wed, 10 Jun 2020 16:07:54 +0000 (18:07 +0200)
modules.txt
src/main/god_stick.lua
src/main/lucky_block.lua
src/main/shopping.lua [new file with mode: 0644]
src/onload/shop.lua [deleted file]
src/onload/shop_signs.lua [new file with mode: 0644]

index ebcf94d3c9f1fb9e5bf54f6c4989d6825194bf09..8d349fb4125892a83b57f1645bcfb34f9a754aa1 100644 (file)
@@ -1 +1 @@
-return {common={"common","random","request","schems",},main={"alpha","commands","flower_spread","god_stick","join_skyblock_mob","lobby","lucky_block","mapgen","money","netherrack_fix","plots","ranks","spawns","tpa","trade","wither_spawn",},onload={"lava_cooling","lobby_grass","monster_egg_stone_block","nether_portal","sapling_mutation","shop","spawn","void",},}
\ No newline at end of file
+return {common={"common","random","request","schems",},main={"alpha","commands","flower_spread","god_stick","join_skyblock_mob","lobby","lucky_block","mapgen","money","netherrack_fix","plots","ranks","shopping","spawns","tpa","trade","wither_spawn",},onload={"lava_cooling","lobby_grass","monster_egg_stone_block","nether_portal","sapling_mutation","shop_signs","spawn","void",},}
\ No newline at end of file
index e1ce23da6e63ef3a410cdc30328cb4dbe19ed3fc..a40553804823de65cec397ead63936b5f4009066 100644 (file)
@@ -21,7 +21,7 @@ minetest.register_tool("skycraft:god_stick", {
 minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
        if hitter:get_wielded_item():get_name() == "skycraft:god_stick" then
                lightning.strike(player:get_pos())
-               minetest.ban_player(player:get_player_name())
+               minetest.after(0.5, minetest.ban_player, player:get_player_name())
                return true
        end
 end)
index a372b8e956da5f10dffbc60eea85a2248bdc22a1..7bb00d48bddb56c6736a38ccfbec2980cb5c6f8c 100644 (file)
@@ -24,6 +24,12 @@ end
 
 lucky_block:add_blocks({
        {"dro", {"mcl_core:dirt", "mcl_core:sand", "mcl_core:gravel"}, 100},
-       {"dro", discs, 1}
+       {"dro", discs, 1},
+       {"spw", "mobs_mc:zombie", 5},
+       {"spw", "mobs_mc:spider", 4},
+       {"spw", "mobs_mc:skeleton", 2},
+       {"spw", "mobs_mc:creeper", 1},
+       {"spw", "mobs_mc:enderman", 1},
+       
 })
 
diff --git a/src/main/shopping.lua b/src/main/shopping.lua
new file mode 100644 (file)
index 0000000..8e80617
--- /dev/null
@@ -0,0 +1,13 @@
+function skycraft.sell(player, item, money)
+       local inv = player:get_inventory()
+       if not inv:contains_item("main", item) then return minetest.chat_send_player(player:get_player_name(), "You don't have enough items!") end
+       inv:remove_item("main", item)
+       skycraft.give_money(player, money)
+end
+
+function skycraft.buy(player, item, money)
+       local inv = player:get_inventory()
+       if not inv:room_for_item("main", item) then return minetest.chat_send_player(player:get_player_name(), "You don't have enough space in your inventory!") end
+       if not skycraft.take_money(player, money) then return end
+       inv:add_item("main", item)
+end 
diff --git a/src/onload/shop.lua b/src/onload/shop.lua
deleted file mode 100644 (file)
index cffafcf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-function skycraft.sell(player, item, money)
-       local inv = player:get_inventory()
-       if not inv:contains_item("main", item) then return minetest.chat_send_player(player:get_player_name(), "You don't have enough items!") end
-       inv:remove_item("main", item)
-       skycraft.give_money(player, money)
-end
-
-function skycraft.buy(player, item, money)
-       local inv = player:get_inventory()
-       if not inv:room_for_item("main", item) then return minetest.chat_send_player(player:get_player_name(), "You don't have enough space in your inventory!") end
-       if not skycraft.take_money(player, money) then return end
-       inv:add_item("main", item)
-end
-
-for nodename, nodedef in pairs(minetest.registered_nodes) do
-       if nodename:find("mcl_signs:") then
-               minetest.override_item(nodename, {
-                       on_rightclick = function(pos, node, player, itemstack, pointed_thing)
-                               if pos.y < 5000 then return end
-                               local text = minetest.get_meta(pos):get_string("text") or ""
-                               local lines = text:split("\n")
-                               local action, amount, price = lines[1], lines[2], lines[3]
-                               print(action, amount, price)
-                               if not (action and amount and price) then return end
-                               price = string.gsub(price, "%$", "")
-                               price = tonumber(price)
-                               amount = string.gsub(amount, "x", "")
-                               amount = tonumber(amount)
-                               print(action, amount, price)
-                               if not (amount and price) then return end
-                               local func, frameoffset
-                               if action == "Buy" then
-                                       func, frameoffset = skycraft.buy, -1
-                               elseif action == "Sell" then
-                                       func, frameoffset = skycraft.sell, 1
-                               else
-                                       return
-                               end
-                               local framepos = vector.add(pos, {x = 0, y = frameoffset, z = 0})
-                               if minetest.get_node(framepos).name ~= "mcl_itemframes:item_frame" then return end
-                               local inv = minetest.get_meta(framepos):get_inventory()
-                               if inv:is_empty("main") then return end
-                               local itemstack = inv:get_stack("main", 1)
-                               func(player, itemstack:get_name() .. " " .. tostring(amount), price)
-                       end,
-               })
-       end
-end
diff --git a/src/onload/shop_signs.lua b/src/onload/shop_signs.lua
new file mode 100644 (file)
index 0000000..217049e
--- /dev/null
@@ -0,0 +1,35 @@
+for nodename, nodedef in pairs(minetest.registered_nodes) do
+       if nodename:find("mcl_signs:") then
+               minetest.override_item(nodename, {
+                       on_rightclick = function(pos, node, player, itemstack, pointed_thing)
+                               if pos.y < 5000 then return end
+                               local text = minetest.get_meta(pos):get_string("text") or ""
+                               local lines = text:split("\n")
+                               local action, amount, price = lines[1], lines[2], lines[3]
+                               print(action, amount, price)
+                               if not (action and amount and price) then return end
+                               price = string.gsub(price, "%$", "")
+                               price = tonumber(price)
+                               amount = string.gsub(amount, "x", "")
+                               amount = tonumber(amount)
+                               print(action, amount, price)
+                               if not (amount and price) then return end
+                               local func, frameoffset
+                               if action == "Buy" then
+                                       func, frameoffset = skycraft.buy, -1
+                               elseif action == "Sell" then
+                                       func, frameoffset = skycraft.sell, 1
+                               else
+                                       return
+                               end
+                               local framepos = vector.add(pos, {x = 0, y = frameoffset, z = 0})
+                               if minetest.get_node(framepos).name ~= "mcl_itemframes:item_frame" then return end
+                               local inv = minetest.get_meta(framepos):get_inventory()
+                               if inv:is_empty("main") then return end
+                               local itemstack = inv:get_stack("main", 1)
+                               func(player, itemstack:get_name() .. " " .. tostring(amount), price)
+                       end,
+               })
+       end
+end