From ef07daf266c13d68c448c99da54057e09735bd75 Mon Sep 17 00:00:00 2001 From: npx Date: Sun, 2 Apr 2017 23:49:06 +0200 Subject: [PATCH] Various additions and fixes --- darts.lua | 7 +-- mobs/mese_dragon.lua | 110 +++++++++++++++++++++++++++++++++++++++---- nssm_api.lua | 12 +++-- nssm_weapons.lua | 33 ++++++++++++- todo.txt | 3 ++ 5 files changed, 147 insertions(+), 18 deletions(-) diff --git a/darts.lua b/darts.lua index 139ac37..3e7f025 100644 --- a/darts.lua +++ b/darts.lua @@ -236,6 +236,7 @@ function explosion_thickweb(pos) end -- arrow=>phoenix arrow +--[[ mobs:register_arrow("nssm:phoenix_arrow", { visual = "sprite", visual_size = {x = 1, y = 1}, @@ -276,7 +277,7 @@ mobs:register_arrow("nssm:phoenix_arrow", { end, }) - +]] mobs:register_arrow("nssm:super_gas", { visual = "sprite", visual_size = {x = 1, y = 1}, @@ -399,7 +400,7 @@ mobs:register_arrow("nssm:lava_block_bomb", { end }) --- +--[[ mobs:register_arrow("nssm:roar_of_the_dragon", { visual = "sprite", visual_size = {x = 1, y = 1}, @@ -442,7 +443,7 @@ mobs:register_arrow("nssm:roar_of_the_dragon", { minetest.env:set_node(p, {name="air"}) end end -}) +})]] mobs:register_arrow("nssm:lava_arrow", { diff --git a/mobs/mese_dragon.lua b/mobs/mese_dragon.lua index cb7a076..2a429ef 100644 --- a/mobs/mese_dragon.lua +++ b/mobs/mese_dragon.lua @@ -2,11 +2,11 @@ mobs:register_mob("nssm:mese_dragon", { type = "monster", hp_max = 666, hp_min = 666, - collisionbox = {-1, 0, -1, 1, 5, 1}, + collisionbox = {-0.8, 0, -0.8, 0.8, 4, 0.8}, visual = "mesh", mesh = "mese_dragon.x", textures = {{"mese_dragon.png"}}, - visual_size = {x=12, y=12}, + visual_size = {x=8, y=8}, makes_footstep_sound = true, view_range = 45, rotate = 270, @@ -37,8 +37,7 @@ mobs:register_mob("nssm:mese_dragon", { lava_damage = 0, light_damage = 0, on_rightclick = nil, - attack_type = "dogshoot", - dogshoot_switch = true, + attack_type = "dogfight", blood_texture="mese_blood.png", blood_amount=30, stepheight=3.1, @@ -46,7 +45,7 @@ mobs:register_mob("nssm:mese_dragon", { jump_height=12, dogshoot_count_max = 9, arrow = "nssm:roar_of_the_dragon", - reach = 5, + reach = 25, shoot_interval = 3, shoot_offset = -1, animation = { @@ -62,13 +61,15 @@ mobs:register_mob("nssm:mese_dragon", { punch_end = 275, punch2_start = 330, punch2_end = 370, - dattack_start = 120, - dattack_end = 160, + shoot_start = 120, + shoot_end = 160, }, + --[[ do_custom = function(self) - midas_ability(self, "default:mese_block", self.run_velocity,2, 3) + --midas_ability(self, "default:mese_block", self.run_velocity,2, 3) end, + custom_attack = function(self) if self.timer > 1 then self.timer = 0 @@ -109,5 +110,96 @@ mobs:register_mob("nssm:mese_dragon", { end end end - end + end, + ]] + custom_attack = function(self) + local p = self.attack:getpos() + local s = self.object:getpos() + s.y = s.y + 5; + local vel = vector.subtract(p,s) + set_animation(self, "shoot") + + minetest.add_particlespawner( + 125, --amount + 0.5, --time + s, --minpos + s, --maxpos + vector.multiply(vel, 0.5), --minvel + vector.multiply(vel, 1.4), --maxvel + {x=0,y=0,z=0}, --minacc + {x=0,y=0,z=0}, --maxacc + 2, --minexptime + 4, --maxexptime + 1, --minsize + 2, --maxsize + true, --collisiondetection + "phoenix_fire.png" --texture + ) + + + local obj = minetest.add_entity(s, "nssm:mese_dart") + local ran = math.random(7,14)/10 + local vec = vector.multiply(vel, ran) + obj:setvelocity(vec) + + minetest.after(0.5, function() + if self.attack then + local p = self.attack:getpos() + local vel = vector.subtract(p,s) + local obj = minetest.add_entity(s, "nssm:mese_dart") + local ran = math.random(7,14)/10 + local vec = vector.multiply(vel, ran) + obj:setvelocity(vec) + end + end) + end, + --[[ + do_custom = function (self) + --minetest.chat_send_all(s.y.."-"..p.y.."="..(s.y-p.y)) + if self.state == "attack" then + if self.attack then + local s = self.object:getpos() + local p = self.attack:getpos() + if (s.y - p.y ) < 10 then + local v = self.object:getvelocity() + v.y = 10 + self.object:setvelocity(v) + end + end + end + end,]] +}) + +minetest.register_entity("nssm:mese_dart", { + textures = {"transparent.png"}, + on_step = function(self, dtime) + self.timer = (self.timer) or os.time() + self.attack = (self.attack) or os.time() + if os.time() - self.timer > 4 then + self.object:remove() + end + local p = self.object:getpos() + local all_objects = minetest.get_objects_inside_radius(p, 1) + local players = {} + local _,obj + for _,obj in ipairs(all_objects) do + if obj:is_player() then + obj:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 10} + }, nil) + self.object:remove() + end + end + local n = minetest.get_node(p).name + if n ~= "air" then + minetest.set_node(p, {name="default:mese_block"}) + self.object:remove(); + end + + local node = minetest.get_node(p).name + if node ~= "air" then + self.object:remove() + end + end, }) diff --git a/nssm_api.lua b/nssm_api.lua index 8a2f394..f2207b0 100644 --- a/nssm_api.lua +++ b/nssm_api.lua @@ -681,13 +681,13 @@ local function calc_velocity(pos1, pos2, old_vel, power) return vel end -local function entity_physics(pos, radius, drops) +local function entity_physics(pos, radius, drops, damage_all) local objs = minetest.get_objects_inside_radius(pos, radius) for _, obj in pairs(objs) do local obj_pos = obj:getpos() local dist = math.max(1, vector.distance(pos, obj_pos)) - local damage = (4 / dist) * radius + local damage = (8 / (dist+1)) * radius if obj:is_player() then -- currently the engine has no method to set -- player velocity. See #2960 @@ -708,7 +708,7 @@ local function entity_physics(pos, radius, drops) local name = luaobj.name if objdef and objdef.on_blast then - if ((name == "nssm:pumpking") or (name == "nssm:morvalar0") or (name== "nssm:morvalar5")) then + if ((not damage_all) and ((name == "nssm:pumpking") or (name == "nssm:morvalar0") or (name== "nssm:morvalar5"))) then do_damage = false do_knockback = false else @@ -882,7 +882,11 @@ function tnt_boom_nssm(pos, def, block, effects) local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, def.ignore_on_blast, block) -- append entity drops local damage_radius = (radius / def.radius) * def.damage_radius - entity_physics(pos, damage_radius, drops) + if def.damage_all then + entity_physics(pos, damage_radius, drops, def.damage_all) + else + entity_physics(pos, damage_radius, drops) + end if not def.disable_drops then eject_drops(drops, pos, radius) end diff --git a/nssm_weapons.lua b/nssm_weapons.lua index 67308eb..949a07b 100644 --- a/nssm_weapons.lua +++ b/nssm_weapons.lua @@ -57,7 +57,25 @@ local function search_on_step2( local obj_p = nil local vec_min = nil for _,obj in ipairs(objects) do - if (obj:is_player()) then + if ((obj:is_player()) or (obj:get_luaentity() and ( + (obj:get_luaentity().name == "mese_dart") or + (obj:get_luaentity().name == "phoenix_dart") or + (obj:get_luaentity().name == "duck_father") or + (obj:get_luaentity().name == "thickwebball") or + (obj:get_luaentity().name == "webball") or + (obj:get_luaentity().name == "super_gas") or + (obj:get_luaentity().name == "lava_arrow") or + (obj:get_luaentity().name == "snow_arrow") or + (obj:get_luaentity().name == "spine") or + (obj:get_luaentity().name == "mese_dart") or + (obj:get_luaentity().name == "morarrow") or + (obj:get_luaentity().name == "lava_block_bomb") or + (obj:get_luaentity().name == "crystal_gas_arrow") or + (obj:get_luaentity().name == "pumpkid_bomb")) + )) then + if (obj:get_luaentity()) then + minetest.chat_send_all(""..obj:get_luaentity().name) + end elseif (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= self.object:get_luaentity().name) then obj_p = obj:getpos() local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z} @@ -99,6 +117,10 @@ local function search_on_step2( --hit(pos,self) elseif min_dist<=1 and self.move==1 then + obj_min:punch(obj_min, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 20}, + }, nil) hit(pos,self) else self.object:setvelocity(vec_min) @@ -178,6 +200,12 @@ local function search_on_step( obj_p = obj_min:getpos() if min_dist < 1 then local node = node_ok(pos).name + + obj_min:punch(obj_min, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 30}, + }, nil) + self.hit_node(self, pos, node) self.object:remove() return @@ -387,7 +415,8 @@ nssm_register_weapon("spirit_ball", { search_on_step(self, dtime, 5, 30, 25) end, hit_node = function(self, pos, node) - tnt.boom(pos, {damage_radius=8,radius=4,ignore_protection=false}) + --tnt.boom(pos, {damage_radius=8,radius=4,ignore_protection=false}) + tnt_boom_nssm(pos, {damage_radius=4,radius=3,ignore_protection=false, damage_all = true}) end, material = "default:goldblock", diff --git a/todo.txt b/todo.txt index 1b88b9f..d3e5e51 100644 --- a/todo.txt +++ b/todo.txt @@ -13,6 +13,9 @@ Codice: - Spawn mostri nuovi - Danno River Lord e Sandonisc - Silversand Dragon (?) + - togliere le chat (hp_num -> envy sword) + - ascia esplosiva + Emmo vorrebbe: -Nuove armature dei nuovi mostri