From d6420071ab209bae8c689ca20b790049796e3e5d Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 29 Nov 2018 12:15:56 +0000 Subject: [PATCH 1/5] add do_custom function so that spiders can climb walls --- spider.lua | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/spider.lua b/spider.lua index 062969e..3b44c28 100644 --- a/spider.lua +++ b/spider.lua @@ -1,6 +1,12 @@ local S = mobs.intllib +local get_velocity = function(self) + + local v = self.object:get_velocity() + + return (v.x * v.x + v.z * v.z) ^ 0.5 +end -- Spider by AspireMint (CC-BY-SA 3.0 license) @@ -94,6 +100,57 @@ 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) + + -- quarter second timer + self.spider_timer = (self.spider_timer or 0) + dtime + if self.spider_timer < 0.25 then + return + end + self.spider_timer = 0 + + -- need to be stopped to go onwards + if get_velocity(self) > 0.2 then + self.disable_falling = false + return + end + + local pos = self.object:get_pos() + local yaw = self.object:get_yaw() + + pos.y = pos.y + self.collisionbox[2] - 0.2 + + local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5) + local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5) + local nod = minetest.get_node_or_nil({ + x = pos.x + dir_x, + y = pos.y + 0.5, + z = pos.z + dir_z + }) + + -- get current velocity + local v = self.object:get_velocity() + + -- can only climb solid facings + if not nod or not minetest.registered_nodes[nod.name] + or not minetest.registered_nodes[nod.name].walkable then + self.disable_falling = nil + v.y = 0 + self.object:set_velocity(v) + return + end + +--print ("----", nod.name, self.disable_falling, dtime) + + -- turn off falling if attached to facing + self.disable_falling = true + + -- move up facing + v.y = self.jump_height + mobs:set_animation(self, "jump") + self.object:set_velocity(v) + end }) From eeb6a8e138f1327e819c470059ca03132ce7c145 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 20 Dec 2018 11:14:52 +0000 Subject: [PATCH 2/5] added mobs:force_capture() example to sand monster --- sand_monster.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sand_monster.lua b/sand_monster.lua index ca27fb6..5194c17 100644 --- a/sand_monster.lua +++ b/sand_monster.lua @@ -90,6 +90,21 @@ mobs:register_mob("mobs_monster:sand_monster", { pos.y = pos.y + 0.25 effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5) end, +--[[ + on_rightclick = function(self, clicker) + + local tool = clicker:get_wielded_item() + local name = clicker:get_player_name() + + if tool:get_name() == "default:sand" then + + self.owner = name + self.type = "npc" + + mobs:force_capture(self, clicker) + end + end, +]] }) From 86e5f4ed09f2bb28ee4b9bb76d0dc1097f845fe4 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Mon, 11 Feb 2019 09:27:22 +0000 Subject: [PATCH 3/5] tweaked tool damage for sand, stone and tree monsters --- sand_monster.lua | 8 ++++++++ stone_monster.lua | 8 ++++++++ tree_monster.lua | 16 +++++++++++----- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/sand_monster.lua b/sand_monster.lua index 5194c17..e3ae0f2 100644 --- a/sand_monster.lua +++ b/sand_monster.lua @@ -78,6 +78,14 @@ mobs:register_mob("mobs_monster:sand_monster", { punch_start = 74, punch_end = 105, }, + immune_to = { + {"default:shovel_wood", 3}, -- shovels deal more damage to sand monster + {"default:shovel_stone", 3}, + {"default:shovel_bronze", 4}, + {"default:shovel_steel", 4}, + {"default:shovel_mese", 5}, + {"default:shovel_diamond", 7}, + }, --[[ custom_attack = function(self, p) local pos = self.object:get_pos() diff --git a/stone_monster.lua b/stone_monster.lua index 43fb97f..876b6f7 100644 --- a/stone_monster.lua +++ b/stone_monster.lua @@ -51,6 +51,14 @@ mobs:register_mob("mobs_monster:stone_monster", { punch_start = 40, punch_end = 63, }, + immune_to = { + {"default:pick_wood", 0}, -- wooden pick doesnt hurt stone monster + {"default:pick_stone", 4}, -- picks deal more damage to stone monster + {"default:pick_bronze", 5}, + {"default:pick_steel", 5}, + {"default:pick_mese", 6}, + {"default:pick_diamond", 7}, + }, }) diff --git a/tree_monster.lua b/tree_monster.lua index 92690f6..039bb72 100644 --- a/tree_monster.lua +++ b/tree_monster.lua @@ -41,11 +41,17 @@ mobs:register_mob("mobs_monster:tree_monster", { lava_damage = 0, light_damage = 2, fall_damage = 0, --- immune_to = { --- {"default:axe_diamond", 5}, --- {"default:sapling", -5}, -- saplings heal --- {"all", 0}, --- }, + immune_to = { + {"default:axe_wood", 0}, -- wooden axe doesnt hurt wooden monster + {"default:axe_stone", 4}, -- axes deal more damage to tree monster + {"default:axe_bronze", 5}, + {"default:axe_steel", 5}, + {"default:axe_mese", 7}, + {"default:axe_diamond", 9}, + {"default:sapling", -5}, -- default and jungle saplings heal + {"default:junglesapling", -5}, +-- {"all", 0}, -- only weapons on list deal damage + }, animation = { speed_normal = 15, speed_run = 15, From 6cf5b95fc99107725cafd80cd08d3c92ad838fdc Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sat, 23 Feb 2019 10:36:37 +0000 Subject: [PATCH 4/5] lava pick heals lava flan when hit, increased water damage --- lava_flan.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lava_flan.lua b/lava_flan.lua index 6a38744..a69d6ec 100644 --- a/lava_flan.lua +++ b/lava_flan.lua @@ -35,9 +35,12 @@ mobs:register_mob("mobs_monster:lava_flan", { drops = { {name = "mobs:lava_orb", chance = 15, min = 1, max = 1}, }, - water_damage = 5, + water_damage = 8, lava_damage = 0, light_damage = 0, + immune_to = { + {"mobs:pick_lava", -2}, -- lava pick heals 2 health + }, animation = { speed_normal = 15, speed_run = 15, From 947adeeb79137d29ca712cd851514b99d06ec425 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 18 Apr 2019 14:31:46 +0100 Subject: [PATCH 5/5] update license.txt --- license.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/license.txt b/license.txt index fec6f6a..cb50163 100644 --- a/license.txt +++ b/license.txt @@ -19,3 +19,14 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +mobs.fireball.png was originally made by Sapier and edited by Benrob: + +-- Animals Mod by Sapier +-- +-- You may copy, use, modify or do nearly anything except removing this +-- copyright notice. +-- And of course you are NOT allow to pretend you have written it. +-- +-- (c) Sapier +-- Contact sapier a t gmx net