From b6591fa9a70c6883cf8bf50013e52e69e5a153d3 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sat, 23 May 2020 14:56:00 +0100 Subject: [PATCH 1/4] tweak spider climbing feature --- spider.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spider.lua b/spider.lua index bfe2854..c3777a6 100644 --- a/spider.lua +++ b/spider.lua @@ -114,8 +114,8 @@ mobs:register_mob("mobs_monster:spider", { self.spider_timer = 0 -- need to be stopped to go onwards - if get_velocity(self) > 0.2 then - self.disable_falling = false + if get_velocity(self) > 0.5 then + self.disable_falling = nil return end @@ -153,6 +153,7 @@ mobs:register_mob("mobs_monster:spider", { self.disable_falling = true -- move up facing + v.x = 0 ; v.y = 0 v.y = self.jump_height mobs:set_animation(self, "jump") self.object:set_velocity(v) From 4f135de146a8971f09f8fbb34bd4ac459e7af6f5 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 19 Jun 2020 16:07:55 +0100 Subject: [PATCH 2/4] spider has new jump attack --- spider.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spider.lua b/spider.lua index c3777a6..98def91 100644 --- a/spider.lua +++ b/spider.lua @@ -103,6 +103,7 @@ mobs:register_mob("mobs_monster:spider", { return true -- run only once, false/nil runs every activation end, + -- custom function to make spiders climb vertical facings do_custom = function(self, dtime) @@ -157,6 +158,22 @@ mobs:register_mob("mobs_monster:spider", { v.y = self.jump_height mobs:set_animation(self, "jump") self.object:set_velocity(v) + end, + + -- make spiders jump at you on attack + custom_attack = function(self, pos) + + local vel = self.object:get_velocity() + + self.object:set_velocity({ + x = vel.x * self.run_velocity, + y = self.jump_height * 1.5, + z = vel.z * self.run_velocity + }) + + self.pausetimer = 0.5 + + return true -- continue rest of attack function end }) From abae5bada40e8a4c24f5df1f982443217c981cf6 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 19 Jun 2020 20:26:21 +0100 Subject: [PATCH 3/4] add obsidian flan --- lava_flan.lua | 159 ++++++++++++++++++++++++++++++++ readme.md | 2 +- textures/mobs_obsidian_flan.png | Bin 0 -> 275 bytes 3 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 textures/mobs_obsidian_flan.png diff --git a/lava_flan.lua b/lava_flan.lua index aa045c8..7d1921f 100644 --- a/lava_flan.lua +++ b/lava_flan.lua @@ -78,6 +78,39 @@ mobs:register_mob("mobs_monster:lava_flan", { }) end, glow = 10, + on_die = function(self, pos) + + local cod = self.cause_of_death or {} + local def = cod.node and minetest.registered_nodes[cod.node] + + if def and def.groups and def.groups.water then + + pos.y = pos.y + 1 + + minetest.add_particlespawner({ + amount = 40, + time = 0.25, + minpos = pos, + maxpos = pos, + minvel = {x = -2, y = 0, z = -2}, + maxvel = {x = 2, y = 2, z = 2}, + minacc = {x = 0, y = 0, z = 0}, + maxacc = {x = 0, y = 10, z = 0}, + minexptime = 0.1, + maxexptime = 1, + minsize = 3.0, + maxsize = 5.0, + texture = "tnt_smoke.png", + }) + + minetest.sound_play("fire_extinguish_flame", + {pos = pos, max_hear_distance = 12, gain = 1.5}, true) + + if math.random(4) == 1 then + minetest.add_entity(pos, "mobs_monster:obsidian_flan") + end + end + end, }) @@ -188,3 +221,129 @@ minetest.override_item("mobs:pick_lava", { description = toolranks.create_description("Lava Pickaxe", 0, 1), after_use = toolranks.new_afteruse}) end + + +-- obsidian flan + +mobs:register_mob("mobs_monster:obsidian_flan", { + type = "monster", + passive = false, + attack_type = "shoot", + shoot_interval = 0.5, + shoot_offset = 1.0, + arrow = "mobs_monster:obsidian_arrow", + reach = 2, + damage = 3, + hp_min = 10, + hp_max = 35, + armor = 20, + visual_size = {x = 0.6, y = 0.6}, + collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.8, 0.3}, + visual = "mesh", + mesh = "zmobs_lava_flan.x", + textures = { + {"mobs_obsidian_flan.png"}, + }, + blood_texture = "default_obsidian.png", + makes_footstep_sound = true, + sounds = { + random = "mobs_lavaflan", +-- war_cry = "mobs_lavaflan", + }, + walk_velocity = 0.1, + run_velocity = 0.5, + jump = false, + view_range = 10, + floats = 0, + drops = { + {name = "default:obsidian_shard", chance = 1, min = 1, max = 5}, + }, + water_damage = 0, + lava_damage = 0, + light_damage = 0, + animation = { + speed_normal = 15, + speed_run = 15, + stand_start = 0, + stand_end = 8, + walk_start = 10, + walk_end = 18, + run_start = 20, + run_end = 28, + punch_start = 20, + punch_end = 28, + } +}) + +mobs:register_egg("mobs_monster:obsidian_flan", S("Obsidian Flan"), + "default_obsidian.png", 1) + + +local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false + +-- mese arrow (weapon) +mobs:register_arrow("mobs_monster:obsidian_arrow", { + visual = "sprite", +-- visual = "wielditem", + visual_size = {x = 0.5, y = 0.5}, + textures = {"default_obsidian_shard.png"}, + velocity = 6, +-- rotate = 180, + + hit_player = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 8}, + }, nil) + end, + + hit_mob = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 8}, + }, nil) + end, + + hit_node = function(self, pos, node) + + if mobs_griefing == false or minetest.is_protected(pos, "") then + return + end + + local texture = "default_dirt.png" --fallback texture + + local radius = 1 + local def = minetest.registered_nodes[node] + if def then + node = { name = node } + end + if def and def.tiles and def.tiles[1] then + texture = def.tiles[1] + end + + if def.groups and def.groups.level == 2 then + return + end + + minetest.add_particlespawner({ + amount = 32, + time = 0.1, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -3, y = 0, z = -3}, + maxvel = {x = 3, y = 5, z = 3}, + minacc = {x = 0, y = -10, z = 0}, + maxacc = {x = 0, y = -10, z = 0}, + minexptime = 0.8, + maxexptime = 2.0, + minsize = radius * 0.33, + maxsize = radius, + texture = texture, + -- ^ only as fallback for clients without support for `node` parameter + node = node, + collisiondetection = true, + }) + + minetest.set_node(pos, {name = "air"}) + end +}) diff --git a/readme.md b/readme.md index 8a02c17..800079c 100644 --- a/readme.md +++ b/readme.md @@ -11,7 +11,7 @@ Dungeon Master Lava Flan -- Cute as they may look lava flan wallow in their namesake (no, not flans) and get curious about players who wander by, forgetting that they can burn you and cause damage. They have a 1 in 5 chance of dropping lava orb when killed. +- Cute as they may look lava flan wallow in their namesake (no, not flans) and get curious about players who wander by, forgetting that they can burn you and cause damage. They have a 1 in 5 chance of dropping lava orb when killed, but if they die in water then pray they dont solidify into an obsidian flan that shoots shards and destroys all around them. Mese Monster diff --git a/textures/mobs_obsidian_flan.png b/textures/mobs_obsidian_flan.png new file mode 100644 index 0000000000000000000000000000000000000000..e2f3b437126d5ad48f4f246735e3a57a4fbb7e18 GIT binary patch literal 275 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvi2$DvS0F7QARr_pBqgIHqogCR zW~gJ~_n(2mK2quiP;Q&2i(`n!`P>P&c@G)zxW4E5XYhXmv-AN5HzR44yA3}-Dx3AT zEd91+x#yd>3%#4f7S=33KKbgY6in({3cb+gmiOJzTI%dXm1~{IwsJOI>$;V3eb^X}=`X?+KH;&Z@dB*Rx6QIJI!q zr;I?}2`t+)ZZdmZQl22WQ%mvv4FO#rf%XNv#; literal 0 HcmV?d00001 From 4477466120356a2059491ae08449ff878f708eae Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 19 Jun 2020 20:44:52 +0100 Subject: [PATCH 4/4] tidy on_die function, add sounds --- lava_flan.lua | 56 +++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/lava_flan.lua b/lava_flan.lua index 7d1921f..5bf23fa 100644 --- a/lava_flan.lua +++ b/lava_flan.lua @@ -53,31 +53,6 @@ mobs:register_mob("mobs_monster:lava_flan", { punch_start = 20, punch_end = 28, }, - on_die = function(self, pos) - - if minetest.get_node(pos).name == "air" then - minetest.set_node(pos, {name = "fire:basic_flame"}) - end - - self.object:remove() - - minetest.add_particlespawner({ - amount = 20, - time = 0.25, - minpos = pos, - maxpos = pos, - minvel = {x = -2, y = -2, z = -2}, - maxvel = {x = 2, y = 2, z = 2}, - minacc = {x = 0, y = -10, z = 0}, - maxacc = {x = 0, y = -10, z = 0}, - minexptime = 0.1, - maxexptime = 1, - minsize = 1.0, - maxsize = 2.0, - texture = "fire_basic_flame.png", - }) - end, - glow = 10, on_die = function(self, pos) local cod = self.cause_of_death or {} @@ -106,11 +81,36 @@ mobs:register_mob("mobs_monster:lava_flan", { minetest.sound_play("fire_extinguish_flame", {pos = pos, max_hear_distance = 12, gain = 1.5}, true) + self.object:remove() + if math.random(4) == 1 then minetest.add_entity(pos, "mobs_monster:obsidian_flan") end + else + if minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name = "fire:basic_flame"}) + end + + minetest.add_particlespawner({ + amount = 20, + time = 0.25, + minpos = pos, + maxpos = pos, + minvel = {x = -2, y = -2, z = -2}, + maxvel = {x = 2, y = 2, z = 2}, + minacc = {x = 0, y = -10, z = 0}, + maxacc = {x = 0, y = -10, z = 0}, + minexptime = 0.1, + maxexptime = 1, + minsize = 1.0, + maxsize = 2.0, + texture = "fire_basic_flame.png", + }) + + self.object:remove() end end, + glow = 10, }) @@ -236,7 +236,7 @@ mobs:register_mob("mobs_monster:obsidian_flan", { damage = 3, hp_min = 10, hp_max = 35, - armor = 20, + armor = 30, visual_size = {x = 0.6, y = 0.6}, collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.8, 0.3}, visual = "mesh", @@ -345,5 +345,9 @@ mobs:register_arrow("mobs_monster:obsidian_arrow", { }) minetest.set_node(pos, {name = "air"}) + + local snd = def.sounds and def.sounds.dug or "default_dig_crumbly" + + minetest.sound_play(snd, {pos = pos, max_hear_distance = 12, gain = 1.0}, true) end })