goblins update

master
daretmavi 2021-02-04 19:36:52 +01:00
parent bb13aa1dce
commit 6a8d66e8c5
10 changed files with 327 additions and 304 deletions

View File

@ -38,7 +38,7 @@ MOD_PATCH=( ) #patch names
#MOD_PATCHES - all patches defined
#MOD_PATCHES - first is path and all patch names are separeted by ":"
#MOD_PATCHES=("mobs/water_life:poison.patch" "buildings/doors:doors_update.patch" "player/3d_armor:mob_damage.patch" "player/hbsprint:no_damage.patch" "player/hunger_ng:effects.patch")
MOD_PATCHES=("buildings/doors:doors_update.patch" "player/hbsprint:no_damage.patch" "environment/dynamic_liquid:bucket.patch" "mobs/water_life:poison.patch" "mobs/water_life:poison_hunger_ng.patch" "mobs/goblins:mod_conf.patch")
MOD_PATCHES=("buildings/doors:doors_update.patch" "player/hbsprint:no_damage.patch" "environment/dynamic_liquid:bucket.patch" "mobs/water_life:poison.patch" "mobs/water_life:poison_hunger_ng.patch")
#MOD_PATCHES=( )
echo "---------------------------------------------------------------"

View File

@ -131,8 +131,8 @@ origin https://github.com/berengma/aerotest (fetch)
* master c60a500 [origin/master] lagfree
Mod: mobs/aerotest
origin git@gitlab.com:daretmavi/pa-sources.git (fetch)
* master f1d1350 [origin/master: ahead 1] New dynamic liquid patch
origin https://github.com/FreeLikeGNU/goblins.git (fetch)
* master dd48144 [origin/master] fix #13
Mod: mobs/goblins
origin https://codeberg.org/Hamlet/mobs_ghost_redo (fetch)

View File

@ -119,7 +119,7 @@ goblins.gobdog_template = {
self.secret_name = goblins.generate_name(gob_name_parts, name_rules)
end
--print (dump(self.secret_name))
local pos = vector.round(self.object:getpos())
local pos = vector.round(self.object:get_pos())
if not pos then return end
if not self.secret_territory then
local territory = {goblins.territory(pos)}

View File

@ -68,7 +68,8 @@ function goblins.attack(self, target, type)
return
end
local pos = vector.round(self.object:getpos())
local pos = vector.round(self.object:get_pos())
if pos then
local s = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(s, self.view_range)
local aggro_wielded = {}
@ -169,6 +170,7 @@ function goblins.attack(self, target, type)
--group_attack mobs nearby
end
end
end
--- Drops a special personlized item
function goblins.special_gifts(self, pname, drop_chance, max_drops)
@ -185,7 +187,8 @@ function goblins.special_gifts(self, pname, drop_chance, max_drops)
end
if #rares > 0 then
--print_s("rares = "..dump(rares))
local pos = self.object:getpos()
local pos = self.object:get_pos()
if pos then
pos.y = pos.y + 0.5
goblins.mixitup(pos)
if #rares > max_drops then
@ -216,6 +219,7 @@ function goblins.special_gifts(self, pname, drop_chance, max_drops)
end
end
end
end
---grab the score for a territory
--@rel_names are a table of relations to reference
@ -284,10 +288,10 @@ end
function goblins.give_gift(self,clicker)
--if mobs:feed_tame(self, clicker, 14, false, false) then
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
local pname = clicker:get_player_name()
local gift_accepted = nil
local gift_declined = nil
local pname = clicker:get_player_name()
local name_told = goblins.secret_name(self, pname)
local territory_told = goblins.secret_territory(self, pname)
local trade_shrewdness = goblins_trade_shrewdness
@ -332,7 +336,7 @@ function goblins.give_gift(self,clicker)
self.path.way = nil
end
end
--print_s(dump(self.object:get_luaentity()).. " at " ..dump(self.object:getpos()).. " takes: " ..dump(item:get_name()))
--print_s(dump(self.object:get_luaentity()).. " at " ..dump(self.object:get_pos()).. " takes: " ..dump(item:get_name()))
if self.drops then
if debug_goblins_trade then
print_s("you may get some of "..dump(#self.drops).. " things such as: ")
@ -342,7 +346,8 @@ function goblins.give_gift(self,clicker)
end
-- we can make some mobs extra stingy despite trade relations
if not self.shrewdness then self.shrewdness = 1 end
local pos = self.object:getpos()
local pos = self.object:get_pos()
if pos then
pos.y = pos.y + 0.5
for _,v in pairs(self.drops) do
--@d_chance takes all the factors of trade into account for each item in drop list
@ -369,6 +374,7 @@ function goblins.give_gift(self,clicker)
end
end
end
end
gift_accepted = true
if name_told and territory_told then
minetest.chat_send_player(pname,S("@1 of @2 takes your @3!",self.secret_name,self.secret_territory.name,gift_description))
@ -382,12 +388,14 @@ function goblins.give_gift(self,clicker)
if debug_goblins_trade == true then print_s("You did not offer " .. dump(string.split(v,":")[2]) ) end
end
end
local pos = self.object:getpos()
local pos = self.object:get_pos()
if pos then
minetest.sound_play("goblins_goblin_damage", {
pos = pos,
gain = 0.2,
max_hear_distance = self.sounds.distance or 10
})
end
if name_told and territory_told then
minetest.chat_send_player(
pname,S("@1 of @2 does not want your @3",
@ -417,28 +425,28 @@ function goblins.search_replace(
decorate, --this is for placing attached nodes like goblin mushrooms and torches
debug_me,
tools) -- {primary, secondary} based on index# of self.goblin_tools
local pos = self.object:getpos()
if mobs_griefing and not minetest.is_protected(pos, "") and math.random(1, search_rate) == 1 then
local pos = self.object:get_pos()
if pos and mobs_griefing and not minetest.is_protected(pos, "") and math.random(1, search_rate) == 1 then
-- look for nodes
local pos = self.object:getpos()
local pos1 = self.object:getpos()
local pos2 = self.object:getpos()
local pos = self.object:get_pos()
local pos1 = self.object:get_pos()
local pos2 = self.object:get_pos()
--local pos = vector.round(self.object:getpos()) --will have to investigate these further
--local pos1 = vector.round(self.object:getpos())
--local pos2 = vector.round(self.object:getpos())
--local pos = vector.round(self.object:get_pos()) --will have to investigate these further
--local pos1 = vector.round(self.object:get_pos())
--local pos2 = vector.round(self.object:get_pos())
local tool_set = {}
if tools then
tool_set = tools
end
-- if we are looking, will we look below and by how much?
if math.random(1, search_rate_below) == 1 then
if pos1 and math.random(1, search_rate_below) == 1 then
pos1.y = pos1.y - search_offset_below
end
-- if we are looking, will we look above and by how much?
if math.random(1, search_rate_above) == 1 then
if pos2 and math.random(1, search_rate_above) == 1 then
pos2.y = pos2.y + search_offset_above
end
@ -547,8 +555,8 @@ function goblins.tunneling(self, type)
type = "digger"
end
local pos = self.object:getpos()
if mobs_griefing and not minetest.is_protected(pos, "") then
local pos = self.object:get_pos()
if pos and mobs_griefing and not minetest.is_protected(pos, "") then
if self.state == "tunnel" then
self:set_animation("walk")
self:set_velocity(self.walk_velocity)
@ -655,13 +663,14 @@ function goblins.tunneling(self, type)
if debug_goblins_tunneling then print_s("goblineer is now making a room") end
elseif self.state == "tunnel" and math.random() < 0.1 then
self.state = "stand"
if debug_goblins_tunneling then print_s(dump(vector.round(self.object:getpos())).. "goblineer is thinking...") end
if debug_goblins_tunneling then print_s(dump(vector.round(self.object:get_pos())).. "goblineer is thinking...") end
end
end
end
function goblins.danger_dig(self,freq,depth)
local pos = vector.round(self.object:getpos())
local pos = vector.round(self.object:get_pos())
if pos then
local lol = minetest.get_node_light(pos) or 0
local freq = freq or 0.1
local depth = depth or 1
@ -690,10 +699,10 @@ function goblins.danger_dig(self,freq,depth)
self:set_velocity(0)
self:set_animation("punch")
minetest.remove_node(target)
local node_above = vector.round(self.object:getpos())
local node_above = vector.round(self.object:get_pos())
node_above.y = node_above.y + 2
local nb_node1 = vector.round(self.object:getpos())
local nb_node2 = vector.round(self.object:getpos())
local nb_node1 = vector.round(self.object:get_pos())
local nb_node2 = vector.round(self.object:get_pos())
nb_node1.y = node_above.y
nb_node2.y = node_above.y
nb_node1.x = nb_node1.x - 1
@ -706,12 +715,14 @@ function goblins.danger_dig(self,freq,depth)
minetest.set_node(node_above, {name = target_node.name})
end
end
end
end
function goblins.goblin_dog_behaviors(self)
local pos = self.object:getpos()
local pos = self.object:get_pos()
if pos then
if math.random() < 0.1 then
goblins.attack(self)
--print("looking for a reason to fight")
@ -802,5 +813,6 @@ function goblins.goblin_dog_behaviors(self)
end
--]]
end
end

View File

@ -77,7 +77,7 @@ goblins.gob_types = {
)
end
elseif math.random() < 0.5 then
--and self.object:getpos().y < 0 then
--and self.object:get_pos().y < 0 then
goblins.search_replace(
self,
50, --search_rate how often do we search?
@ -782,7 +782,7 @@ goblins.goblin_template = { --your average goblin,
end
--print (dump(self.secret_name))
--print (dump(self.special_gifts).. " are precious to "..dump(self.secret_name).. "!")
local pos = vector.round(self.object:getpos())
local pos = vector.round(self.object:get_pos())
if not pos then print(dump(self).."\n **position error!** \n") return end --something went wrong!
if not self.secret_territory then
local opt_data = {}

View File

@ -2,7 +2,3 @@ name = goblins
descriptions = add goblins that dig tunnels, set traps and create lairs.
depends = default, mobs
optional_depends = ambience, hunger_ng
author = FreeLikeGNU
description = (Respectfully) Destructive! Goblin NPCs burrow underground, build lairs, set traps and cultivate foodstuffs. They like to steal torches! This is a Work In Progress, but quite playable!
title = Goblins

View File

@ -0,0 +1,4 @@
name = goblins
descriptions = add goblins that dig tunnels, set traps and create lairs.
depends = default, mobs
optional_depends = ambience, hunger_ng

View File

@ -0,0 +1,11 @@
--- mod.conf
+++ mod.conf
@@ -2,7 +2,7 @@ name = goblins
descriptions = add goblins that dig tunnels, set traps and create lairs.
depends = default, mobs
optional_depends = ambience, hunger_ng
-release = 4547
+
author = FreeLikeGNU
description = (Respectfully) Destructive! Goblin NPCs burrow underground, build lairs, set traps and cultivate foodstuffs. They like to steal torches! This is a Work In Progress, but quite playable!
title = Goblins

View File

@ -173,7 +173,7 @@ function goblins.moss_spread(pos, node)
--print("moss spread abm"..minetest.pos_to_string(pos))
if math.random() < 0.1 then
minetest.place_node(pos,{name = "goblins:mushroom_goblin"})
minetest.set_node(pos,{name = "goblins:mushroom_goblin"})
else
local positions = minetest.find_nodes_in_area_under_air(
{x = pos.x - 1, y = pos.y - 2, z = pos.z - 1},

View File

@ -195,7 +195,7 @@ end
-- Purely for debugging or curiosity it can be enabled at the top of this page
function goblins.announce_spawn(self)
if announce_spawning == true then
local pos = vector.round(self.object:getpos())
local pos = vector.round(self.object:get_pos())
if not pos then return end
if self.secret_name then
print_s( self.name:split(":")[2].. ", "..self.secret_name.." spawned at: " .. minetest.pos_to_string(pos))