From 80001c9a15e2cd11c1e9d6bd2c00d996cd4544bb Mon Sep 17 00:00:00 2001 From: Coder12a <38924418+Coder12a@users.noreply.github.com> Date: Fri, 26 Oct 2018 18:42:10 -0500 Subject: [PATCH] Faction chest bug fix Faction chests can be dug up even tho they have stuff in them. --- README.md | 28 ++++------------------------ factions.lua | 1 - nodes.lua | 21 ++++++++++++++++++++- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 1385b44..73bb987 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ Mod for handling in game factions and reputation. # TODO LIST -Redo the parcel attack system. +Redo the parcel attack system(Can be turned on in settings). Add command to show or hide all parcel position locations as markers. Add money. -Player tax. +Player money tax. faction territory titles. @@ -35,26 +35,6 @@ Parcels should show up at a more accurate position just like in mc factions. Allow faction chest to become big when you place two chests by each other like in mc. -mc style tnt. +Add-on mod mc style tnt. -lag-free fire(if thats possible). - -# COMPLETED BUT NEEDS TESTING LIST - -None. - -# COMPLETED - -Make factions power max based on how many players are in the team, and players with the same ip address can not add to the power max. - -Make factions without parcels disband after a few hours. - -Complete the diplomacy system. - -Make claim's depth not go to high or low. Or make it act like a protection block where you have to claim land upwards and downwards. - -Add a show claim command (show small entity boxes like in protection mod). - -Remove banner code. - -Add command to set the faction message of the day. \ No newline at end of file +Add-on mod lag-free fire(if thats possible). \ No newline at end of file diff --git a/factions.lua b/factions.lua index 2e99557..3fc9258 100644 --- a/factions.lua +++ b/factions.lua @@ -377,7 +377,6 @@ function factions.Faction.disband(self, reason) self:on_disband(reason) local playerslist = self.onlineplayers for i,l in pairs(playerslist) do - local faction = factions.get_player_faction(i) removeHud(i,"factionName") removeHud(i,"powerWatch") end diff --git a/nodes.lua b/nodes.lua index a5321c6..7794423 100644 --- a/nodes.lua +++ b/nodes.lua @@ -32,8 +32,27 @@ minetest.register_node("factions:chest", { description = "Faction chest", paramtype2 = "facedir", on_construct = function(pos) - minetest.get_meta(pos):get_inventory():set_size("main", 8*4) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Faction Chest") + meta:set_string("faction", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) end, + after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + local cf = factions.get_player_faction(placer:get_player_name()) + if cf ~= nil then + meta:set_string("faction", cf.name or "") + meta:set_string("infotext", "Faction Chest (owned by faction " .. + meta:get_string("faction") .. ")") + end + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and + default.can_interact_with_node(player, pos) + end, allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) if factions.can_use_chest(pos, player:get_player_name()) then return count