fixes
parent
621cf5c980
commit
aee98ec744
|
@ -65,5 +65,21 @@ function petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
|
|||
self.warn_attack = true
|
||||
mobkit.clear_queue_high(self)
|
||||
end
|
||||
if self.type == "mr_pumpkin" then --teleport to player's back
|
||||
if math.random(1, 3) == 1 then
|
||||
--petz.lookat(self, puncher:get_pos())
|
||||
if (self.hp <= self.max_hp / 2) then
|
||||
petz.bh_teleport(self, pos, player, player_pos)
|
||||
else
|
||||
petz.do_sound_effect("object", self.object, "petz_fireball")
|
||||
petz.spawn_throw_object(self.object, 20, "petz:ent_jack_o_lantern_grenade")
|
||||
end
|
||||
end
|
||||
elseif self.type == "tarantula" then
|
||||
if math.random(1, 5) == 1 then
|
||||
--petz.lookat(self, puncher:get_pos())
|
||||
petz.spawn_throw_object(self.object, 20, "petz:ent_cobweb")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,8 +10,13 @@ petz.get_node_below = function(pos)
|
|||
return node
|
||||
end
|
||||
|
||||
petz.spawn_mob = function(spawn_pos, limit_max_mobs, abr)
|
||||
local node = petz.get_node_below(spawn_pos) --the node below the spawn pos
|
||||
petz.spawn_mob = function(spawn_pos, limit_max_mobs, abr, liquidflag)
|
||||
local node
|
||||
if not(liquidflag) then
|
||||
node = petz.get_node_below(spawn_pos) --the node below the spawn pos
|
||||
else
|
||||
node = minetest.get_node(spawn_pos)
|
||||
end
|
||||
local candidates_list = {} --Create a sublist of the petz with the same node to spawnand between max_height and min_height
|
||||
for i = 1, #petz.petz_list do
|
||||
local pet_name
|
||||
|
@ -169,7 +174,7 @@ minetest.register_globalstep(function(dtime)
|
|||
local interval = petz.settings.spawn_interval
|
||||
local spawn_pos, liquidflag, cave = mobkit.get_spawn_pos_abr(dtime, interval, radius, petz.settings.spawn_chance, 0.2)
|
||||
if spawn_pos then
|
||||
petz.spawn_mob(spawn_pos, true, abr)
|
||||
petz.spawn_mob(spawn_pos, true, abr, liquidflag)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ local modpath, S = ...
|
|||
|
||||
--effects can be: fire
|
||||
|
||||
function petz.throw(self, dtime, damage, effect, particles)
|
||||
function petz.throw(self, dtime, damage, effect, particles, sound)
|
||||
if self.shooter_name == "" then
|
||||
if self.object:get_attach() == nil then
|
||||
self.object:remove()
|
||||
|
@ -23,14 +23,28 @@ function petz.throw(self, dtime, damage, effect, particles)
|
|||
--minetest.chat_send_player("singleplayer", thing.type)
|
||||
local thing_ent = thing.ref:get_luaentity()
|
||||
if not(thing.ref:is_player()) or (thing.ref:is_player() and not(thing.ref:get_player_name() == self.shooter_name)) then
|
||||
local ent_pos
|
||||
if thing.ref:is_player() then
|
||||
thing.ref:punch(thing.ref, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy=damage}}, nil)
|
||||
petz.do_sound_effect("player", thing.ref, "petz_firecracker")
|
||||
ent_pos = thing.ref:get_pos()
|
||||
if sound then
|
||||
petz.do_sound_effect("player", thing.ref, sound)
|
||||
end
|
||||
else
|
||||
mobkit.hurt(thing_ent, damage)
|
||||
petz.do_sound_effect("object", thing.ref, "petz_firecracker")
|
||||
end
|
||||
petz.do_particles_effect(nil, pos, "fire")
|
||||
ent_pos = thing_ent:get_pos()
|
||||
if sound then
|
||||
petz.do_sound_effect("object", thing.ref, sound)
|
||||
end
|
||||
end
|
||||
if effect then
|
||||
if effect == "cobweb" then
|
||||
minetest.set_node(ent_pos, {name = "petz:cobweb"})
|
||||
end
|
||||
end
|
||||
if particles then
|
||||
petz.do_particles_effect(nil, pos, particles)
|
||||
end
|
||||
self.waiting_for_removal = true
|
||||
self.object:remove()
|
||||
return
|
||||
|
@ -58,6 +72,16 @@ function petz.throw(self, dtime, damage, effect, particles)
|
|||
--end
|
||||
end
|
||||
petz.do_sound_effect("pos", node_pos, "petz_firecracker")
|
||||
elseif effect == "cobweb" then
|
||||
local pos_above = {
|
||||
x = node_pos.x,
|
||||
y = node_pos.y +1,
|
||||
z = node_pos.z,
|
||||
}
|
||||
local node_above = minetest.get_node(pos_above)
|
||||
if node_above.name == "air" then
|
||||
minetest.set_node(pos_above, {name = "petz:cobweb"})
|
||||
end
|
||||
end
|
||||
end
|
||||
self.waiting_for_removal = true
|
||||
|
@ -70,9 +94,11 @@ function petz.throw(self, dtime, damage, effect, particles)
|
|||
self.old_pos = pos
|
||||
end
|
||||
|
||||
function petz.spawn_throw_object(user, strength, entity)
|
||||
function petz.spawn_throw_object(user, strength, entity)
|
||||
local pos = user:get_pos()
|
||||
pos.y = pos.y + 1.5 -- camera offset
|
||||
if user:is_player() then
|
||||
pos.y = pos.y + 1.5 -- camera offset
|
||||
end
|
||||
--minetest.chat_send_player("singleplayer", tostring(pos))
|
||||
local obj = minetest.add_entity(pos, entity)
|
||||
if not obj then
|
||||
|
@ -96,3 +122,32 @@ function petz.spawn_throw_object(user, strength, entity)
|
|||
obj:set_velocity(vector.multiply(dir, strength))
|
||||
return true
|
||||
end
|
||||
|
||||
function petz.register_throw_entity(name, textures, damage, effect, particles, sound)
|
||||
minetest.register_entity(name, {
|
||||
hp_max = 4, -- possible to catch the arrow (pro skills)
|
||||
physical = false, -- use Raycast
|
||||
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
|
||||
visual = "wielditem",
|
||||
textures = {textures},
|
||||
visual_size = {x = 1.0, y = 1.0},
|
||||
old_pos = nil,
|
||||
shooter_name = "",
|
||||
parent_entity = nil,
|
||||
waiting_for_removal = false,
|
||||
|
||||
on_activate = function(self)
|
||||
self.object:set_acceleration({x = 0, y = -9.81, z = 0})
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
return false
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
petz.throw(self, dtime, damage, effect, particles, sound)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -5,6 +5,16 @@ local modpath, S = ...
|
|||
-- Helpers Functions
|
||||
--
|
||||
|
||||
petz.lookback = function(self, pos2)
|
||||
local pos1 = self.object:get_pos()
|
||||
local vec = {x = pos1.x - pos2.x, y = pos1.y - pos2.y, z = pos1.z - pos2.z}
|
||||
local yaw = math.atan(vec.z / vec.x) - math.pi / 2
|
||||
if pos1.x >= pos2.x then
|
||||
yaw = yaw + math.pi
|
||||
end
|
||||
self.object:set_yaw(yaw + math.pi)
|
||||
end
|
||||
|
||||
petz.lookat = function(self, pos2)
|
||||
local pos1 = self.object:get_pos()
|
||||
local vec = {x = pos1.x - pos2.x, y = pos1.y - pos2.y, z = pos1.z - pos2.z}
|
||||
|
@ -269,7 +279,7 @@ function petz.bh_attack_player(self, pos, prty, player)
|
|||
end
|
||||
|
||||
petz.bh_afraid= function(self, pos)
|
||||
petz.lookat(self, pos)
|
||||
petz.lookback(self, pos)
|
||||
local x = self.object:get_velocity().x
|
||||
local z = self.object:get_velocity().z
|
||||
self.object:set_velocity({x= 4.0, y= 0, z= 4.0})
|
||||
|
|
|
@ -625,7 +625,7 @@ function petz.monster_brain(self)
|
|||
end
|
||||
end
|
||||
|
||||
if prty < 10 then
|
||||
if prty < 10 then
|
||||
if player then
|
||||
local werewolf = false
|
||||
if petz.settings["lycanthropy"] then
|
||||
|
@ -633,25 +633,11 @@ function petz.monster_brain(self)
|
|||
werewolf = true
|
||||
end
|
||||
end
|
||||
if (self.tamed == false and werewolf == false) or (self.tamed == true and self.status == "guard" and player:get_player_name() ~= self.owner) then
|
||||
if (self.tamed == false and werewolf == false) or (self.tamed == true and self.status == "guard" and player:get_player_name() ~= self.owner) then
|
||||
local player_pos = player:get_pos()
|
||||
if vector.distance(pos, player_pos) <= self.view_range then -- if player close
|
||||
if self.type == "mr_pumpkin" then --teleport to player's back
|
||||
local random_num = math.random(1, 3)
|
||||
if random_num == 1 then
|
||||
if (self.hp <= self.max_hp / 2) then
|
||||
petz.bh_teleport(self, pos, player, player_pos)
|
||||
return
|
||||
else
|
||||
petz.do_sound_effect("object", self.object, "petz_fireball")
|
||||
if not petz.spawn_throw_object(self.object, 20, "petz:ent_jack_o_lantern_grenade") then
|
||||
return -- something failed
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if vector.distance(pos, player_pos) <= self.view_range then -- if player close
|
||||
self.max_speed = 2.5
|
||||
mobkit.hq_hunt(self, 10, player)
|
||||
mobkit.hq_hunt(self, 10, player)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
|
@ -563,3 +563,4 @@ minetest.register_craft({
|
|||
{'petz:poop', 'petz:poop', 'petz:poop'},
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -20,34 +20,51 @@ minetest.register_node("petz:jack_o_lantern_grenade", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_entity("petz:ent_jack_o_lantern_grenade", {
|
||||
hp_max = 4, -- possible to catch the arrow (pro skills)
|
||||
physical = false, -- use Raycast
|
||||
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
|
||||
visual = "wielditem",
|
||||
textures = {"petz:jack_o_lantern_grenade"},
|
||||
visual_size = {x = 1.0, y = 1.0},
|
||||
old_pos = nil,
|
||||
shooter_name = "",
|
||||
parent_entity = nil,
|
||||
waiting_for_removal = false,
|
||||
|
||||
on_activate = function(self)
|
||||
self.object:set_acceleration({x = 0, y = -9.81, z = 0})
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
return false
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
petz.throw(self, dtime, petz.settings.pumpkin_grenade_damage, "fire", nil)
|
||||
end,
|
||||
})
|
||||
|
||||
petz.register_throw_entity("petz:ent_jack_o_lantern_grenade", "petz:jack_o_lantern_grenade", petz.settings.pumpkin_grenade_damage, "fire", "fire", "petz_firecracker")
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "petz:jack_o_lantern_grenade",
|
||||
recipe = {"petz:jack_o_lantern", "tnt:gunpowder", "farming:string"},
|
||||
})
|
||||
|
||||
|
||||
-- COBWEB
|
||||
minetest.register_node("petz:cobweb", {
|
||||
description = S("Cobweb"),
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.2,
|
||||
tiles = {"petz_cobweb.png"},
|
||||
inventory_image = "petz_cobweb.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
liquid_viscosity = 11,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "petz:cobweb",
|
||||
liquid_alternative_source = "petz:cobweb",
|
||||
liquid_renewable = false,
|
||||
liquid_range = 0,
|
||||
walkable = false,
|
||||
groups = {snappy = 1, disable_jump = 1},
|
||||
drop = "farming:string",
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(petz.settings.cobweb_decay)
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.remove_node(pos)
|
||||
return false
|
||||
end,
|
||||
})
|
||||
|
||||
petz.register_throw_entity("petz:ent_cobweb", "petz:cobweb", 1, "cobweb", nil, nil)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "petz:cobweb",
|
||||
recipe = {
|
||||
{"farming:string", "", "farming:string"},
|
||||
{"", "farming:string", ""},
|
||||
{"farming:string", "", "farming:string"},
|
||||
}
|
||||
})
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
##Change here the Petz Mod preferences
|
||||
|
||||
petz_list = kitty,puppy,ducky,lamb,lion,calf,panda,grizzly,pony,parrot,chicken,piggy,wolf,elephant,elephant_female,pigeon,moth,camel,clownfish,bat,silkworm,chimp,hamster,dolphin,tropicalfish,beaver,turtle,frog,toucan,bee,queen_bee,mr_pumpkin,foxy,penguin,polar_bear,santa_killer,werewolf
|
||||
petz_list = kitty,puppy,ducky,lamb,lion,calf,panda,grizzly,pony,parrot,chicken,piggy,wolf,elephant,elephant_female,pigeon,moth,camel,clownfish,bat,silkworm,chimp,hamster,dolphin,tropicalfish,beaver,turtle,frog,toucan,bee,queen_bee,mr_pumpkin,foxy,penguin,polar_bear,santa_killer,werewolf,tarantula
|
||||
|
||||
disable_monsters = false
|
||||
|
||||
|
@ -69,6 +69,9 @@ max_hear_distance = 8
|
|||
#Fly check time
|
||||
fly_check_time = 3
|
||||
|
||||
#Cobweb
|
||||
cobweb_decay = 1200
|
||||
|
||||
#Bee stuff
|
||||
initial_honey_behive = 3
|
||||
max_honey_behive = 10
|
||||
|
@ -121,6 +124,7 @@ foxy_spawn = true
|
|||
penguin_spawn = true
|
||||
polar_bear_spawn = true
|
||||
santa_killer_spawn = true
|
||||
tarantula = false
|
||||
|
||||
##Enviromental Damage
|
||||
air_damage = 1
|
||||
|
@ -379,3 +383,9 @@ santa_killer_seasonal = christmas
|
|||
werewolf_follow = group:food_meat_raw
|
||||
werewolf_spawn_chance = 0.1
|
||||
werewolf_spawn_nodes = default:dirt_with_coniferous_litter,default:dirt_with_grass
|
||||
|
||||
##Tarantula Specific
|
||||
tarantula_follow = farming:string
|
||||
tarantula_spawn_chance = 0.5
|
||||
tarantula_spawn_nodes = default:dirt_with_coniferous_litter,default:dirt_with_grass
|
||||
tarantula_spawn_biome = default
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
--
|
||||
--TARANTULA
|
||||
--
|
||||
local S = ...
|
||||
|
||||
local pet_name = "tarantula"
|
||||
local scale_model = 2.0
|
||||
local mesh = 'petz_tarantula.b3d'
|
||||
local textures = {"petz_tarantula_orange.png", "petz_tarantula_black.png"}
|
||||
local visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model}
|
||||
local p1 = {x= -0.25, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.1875, y = -0.125, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
type = "tarantula",
|
||||
init_tamagochi_timer = false,
|
||||
is_pet = false,
|
||||
is_monster = true,
|
||||
is_boss = true,
|
||||
has_affinity = false,
|
||||
is_wild = true,
|
||||
attack_player = true,
|
||||
give_orders = false,
|
||||
can_be_brushed = false,
|
||||
capture_item = nil,
|
||||
follow = petz.settings.tarantula_follow,
|
||||
drops = {
|
||||
{name = "farming:string", chance = 3, min = 1, max = 1,},
|
||||
},
|
||||
rotate = petz.settings.rotate,
|
||||
physical = true,
|
||||
stepheight = 0.1, --EVIL!
|
||||
collide_with_objects = true,
|
||||
collisionbox = collisionbox,
|
||||
visual = petz.settings.visual,
|
||||
mesh = mesh,
|
||||
textures = textures,
|
||||
visual_size = visual_size,
|
||||
static_save = true,
|
||||
get_staticdata = mobkit.statfunc,
|
||||
-- api props
|
||||
springiness= 0,
|
||||
buoyancy = 0.5, -- portion of hitbox submerged
|
||||
max_speed = 1.5,
|
||||
jump_height = 1.5,
|
||||
view_range = 10,
|
||||
lung_capacity = 10, -- seconds
|
||||
max_hp = 30,
|
||||
|
||||
attack={range=0.5, damage_groups={fleshy=9}},
|
||||
animation = {
|
||||
walk= {range={x=1, y=21}, speed=30, loop=true},
|
||||
stand= {range={x=23, y=34}, speed=5, loop=true},
|
||||
attack= {range={x=34, y=40}, speed=30, loop=false},
|
||||
},
|
||||
sounds = {
|
||||
misc = "petz_merry_christmas",
|
||||
attack = "petz_ho_ho_ho",
|
||||
die = "petz_monster_die",
|
||||
},
|
||||
|
||||
logic = petz.monster_brain,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s) --on_activate, required
|
||||
mobkit.actfunc(self, staticdata, dtime_s)
|
||||
petz.set_initial_properties(self, staticdata, dtime_s)
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
petz.on_rightclick(self, clicker)
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
mobkit.stepfunc(self, dtime) -- required
|
||||
petz.on_step(self, dtime)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
petz:register_egg("petz:tarantula", S("Tarantula"), "petz_spawnegg_tarantula.png", false)
|
|
@ -49,6 +49,8 @@ petz.settings.blood = settings:get_bool("blood", false)
|
|||
petz.settings.poop = settings:get_bool("poop", true)
|
||||
petz.settings.poop_rate = tonumber(settings:get("poop_rate", "200"))
|
||||
petz.settings.poop_decay = tonumber(settings:get("poop_decay", "1200"))
|
||||
--Cobweb
|
||||
petz.settings.cobweb_decay = tonumber(settings:get("cobweb_decay", "1200"))
|
||||
--Lashing
|
||||
petz.settings.lashing_tame_count = tonumber(settings:get("lashing_tame_count", "3"))
|
||||
--Bee Stuff
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 475 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 187 B |
Binary file not shown.
Before Width: | Height: | Size: 198 B |
Binary file not shown.
After Width: | Height: | Size: 704 B |
Binary file not shown.
After Width: | Height: | Size: 717 B |
Loading…
Reference in New Issue