diff --git a/npc.lua b/npc.lua index 3d3de28..9e230e8 100755 --- a/npc.lua +++ b/npc.lua @@ -898,7 +898,7 @@ mobs:register_mob("advanced_npc:npc", { stepheight = 0.6, walk_velocity = 1, run_velocity = 3, - jump = true, + jump = false, drops = { {name = "default:wood", chance = 1, min = 1, max = 3}, {name = "default:apple", chance = 2, min = 1, max = 2}, diff --git a/relationships.lua b/relationships.lua index f924f46..d4dd02f 100644 --- a/relationships.lua +++ b/relationships.lua @@ -57,7 +57,8 @@ npc.relationships.MARRIED_NPC_DIALOGUE = { response_id = 2, action = function(self, player) self.order = "stand" - minetest.chat_send_player(player:get_player_name(), S("Ok dear, I will wait here for you.")) + npc.chat(self.npc_name, player:get_player_name(), + S("Ok dear, I will wait here for you.")) end }, [3] = { @@ -66,7 +67,7 @@ npc.relationships.MARRIED_NPC_DIALOGUE = { response_id = 3, action = function(self, player) self.order = "follow" - minetest.chat_send_player(player:get_player_name(), S("Ok, let's go!")) + npc.chat(self.npc_name, player:get_player_name(), S("Ok, let's go!")) end } } @@ -114,7 +115,7 @@ function npc.relationships.get_response_for_disliked_item(item_name, sex) for i = 1, #items do minetest.log(dump(items[i])) if items[i].item == item_name then - minetest.log("Returning: "..dump(items[i].response)) + --minetest.log("Returning: "..dump(items[i].response)) return items[i].response end end @@ -350,16 +351,16 @@ local function show_receive_gift_reaction(self, item_name, modifier, clicker_nam end -- Send message -- TODO: There might be an error with getting the message... - minetest.log("Item_name: "..dump(item_name)..", sex: "..dump(self.sex)..", phase: "..dump(phase)) + --minetest.log("Item_name: "..dump(item_name)..", sex: "..dump(self.sex)..", phase: "..dump(phase)) local message_to_send = npc.relationships.get_response_for_favorite_item(item_name, self.sex, phase) - minetest.chat_send_player(clicker_name, message_to_send) + npc.chat(self.npc_name, clicker_name, message_to_send) -- Disliked items reactions elseif modifier < 0 then effect({x = pos.x, y = pos.y + 1, z = pos.z}, 8, "default_item_smoke.png") - minetest.log("Item name: "..item_name..", sex: "..self.sex) + --minetest.log("Item name: "..item_name..", sex: "..self.sex) local message_to_send = npc.relationships.get_response_for_disliked_item(item_name, self.sex) - minetest.chat_send_player(clicker_name, message_to_send) + npc.name(self.npc_name, clicker_name, message_to_send) end end @@ -381,7 +382,7 @@ function npc.relationships.receive_gift(self, clicker) -- If NPC received a gift from this person, then reject any more gifts for now if check_npc_can_receive_gift(self, clicker_name) == false then - minetest.chat_send_player(clicker_name, "Thanks, but I don't need anything for now") + npc.chat(self.npc_name, clicker_name, "Thanks, but I don't need anything for now") return false end @@ -392,9 +393,9 @@ function npc.relationships.receive_gift(self, clicker) npc.relationships.RELATIONSHIP_PHASE["phase5"].limit and self.owner ~= clicker_name and item:get_name() ~= "advanced_npc:marriage_ring" then - minetest.chat_send_player(clicker_name, + npc.chat(self.npc_name, clicker_name, "Thank you my love, but I think that you have given me") - minetest.chat_send_player(clicker_name, + npc.chat(self.npc_name, clicker_name, "enough gifts for now. Maybe we should go a step further") -- Reset gift timer reset_gift_timer(self, clicker_name) @@ -407,7 +408,7 @@ function npc.relationships.receive_gift(self, clicker) local receive_chance = math.random(1, 10) -- Receive ring and get married if receive_chance < 6 then - minetest.chat_send_player(clicker_name, + npc.chat(self.npc_name, clicker_name, "Oh, oh you make me so happy! Yes! I will marry you!") -- Get ring item:take_item() @@ -422,7 +423,7 @@ function npc.relationships.receive_gift(self, clicker) self.owner = clicker_name -- Reject ring for now else - minetest.chat_send_player(clicker_name, + npc.chat(self.npc_name, clicker_name, "Dear, I feel the same as you. But maybe not yet...") end @@ -446,7 +447,7 @@ function npc.relationships.receive_gift(self, clicker) show_receive_gift_reaction(self, item:get_name(), modifier, clicker_name, false) else -- Neutral item reaction - minetest.chat_send_player(clicker_name, "Thank you honey!") + npc.chat(self.npc_name, clicker_name, "Thank you honey!") end -- Take item item:take_item() @@ -480,9 +481,9 @@ function npc.relationships.receive_gift(self, clicker) -- if 70% local receive_chance = math.random(1,10) if receive_chance < 7 then - minetest.chat_send_player(clicker_name, "Thanks. I will find some use for this.") + npc.chat(self.npc_name, clicker_name, "Thanks. I will find some use for this.") else - minetest.chat_send_player(clicker_name, "Thank you, but no, I have no use for this.") + npc.chat(self.npc_name, clicker_name, "Thank you, but no, I have no use for this.") take = false end show_reaction = false @@ -502,7 +503,7 @@ function npc.relationships.receive_gift(self, clicker) clicker:set_wielded_item(item) end - minetest.log(dump(self)) + npc.log("DEBUG", "NPC: "..dump(self)) -- Reset gift timer reset_gift_timer(self, clicker_name) return true diff --git a/spawner.lua b/spawner.lua index f6a4ae3..2c7fb9a 100644 --- a/spawner.lua +++ b/spawner.lua @@ -463,6 +463,10 @@ end -- Also, the building is scanned for NPC-usable nodes and the amount -- of NPCs to spawn and the interval is calculated. function spawner.replace_mg_villages_plotmarker(pos) + -- Check if it is already replaced + -- if minetest.get_node(pos).name == "advanced_npc:plotmarker_auto_spawner" then + -- return + -- end -- Get the meta at the current position local meta = minetest.get_meta(pos) local village_id = meta:get_string("village_id") @@ -471,7 +475,7 @@ function spawner.replace_mg_villages_plotmarker(pos) -- Following line from mg_villages mod, protection.lua local btype = mg_villages.all_villages[village_id].to_add_data.bpos[plot_nr].btype local building_data = mg_villages.BUILDINGS[btype] - local building_type = building_data.typ + local building_type = building_data.typ -- Check if the building is of the support types for _,value in pairs(npc.spawner.mg_villages_supported_building_types) do @@ -525,6 +529,8 @@ function spawner.replace_mg_villages_plotmarker(pos) child_total = 0 } meta:set_string("npc_stats", minetest.serialize(npc_stats)) + -- Set replaced + meta:set_string("replaced", "true") -- Stop searching for building type break @@ -618,6 +624,10 @@ if minetest.get_modpath("mg_villages") ~= nil then chance = 1, --5, catch_up = true, action = function(pos, node, active_object_count, active_object_count_wider) + -- Check if replacement is needed + if minetest.get_meta(pos):get_string("replaced") == "true" then + return + end -- Check if replacement is activated if npc.spawner.replace_activated then -- Replace mg_villages:plotmarker diff --git a/textures/npc_baby_male1.png b/textures/npc_baby_male1.png index 9356398..9d56a1d 100755 Binary files a/textures/npc_baby_male1.png and b/textures/npc_baby_male1.png differ