From 69c689bfb79a9e8dd0154bd6a05f112882622a26 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 19 Jul 2022 00:11:40 +0200 Subject: [PATCH] make llamas retaliate by spitting. it's a bit picky when and how it will spit still but works. --- mods/ENTITIES/mobs_mc/llama.lua | 32 ++++++++++++++++-- .../mobs_mc/textures/mobs_mc_llama_spit.png | Bin 0 -> 307 bytes 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_spit.png diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index e11566e3ee..5d3ed77181 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -28,13 +28,17 @@ mcl_mobs:register_mob("mobs_mc:llama", { description = S("Llama"), type = "animal", spawn_class = "passive", + passive = false, + attack_type = "shoot", + shoot_interval = 5.5, + arrow = "mobs_mc:llamaspit", + shoot_offset = 1, --3.5 *would* be a good value visually but it somehow messes with the projectiles trajectory spawn_in_group_min = 4, spawn_in_group = 6, hp_min = 15, hp_max = 30, xp_min = 1, xp_max = 3, - passive = false, collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.86, 0.45}, visual = "mesh", mesh = "mobs_mc_llama.b3d", @@ -47,7 +51,7 @@ mcl_mobs:register_mob("mobs_mc:llama", { }, visual_size = {x=3, y=3}, makes_footstep_sound = true, - runaway = true, + runaway = false, walk_velocity = 1, run_velocity = 4.4, follow_velocity = 4.4, @@ -213,6 +217,30 @@ mcl_mobs:register_mob("mobs_mc:llama", { }) +-- spit arrow (weapon) +mcl_mobs:register_arrow("mobs_mc:llamaspit", { + visual = "sprite", + visual_size = {x = 0.10, y = 0.10}, + textures = {"mobs_mc_llama_spit.png"}, + velocity = 5, + hit_player = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 1}, + }, nil) + end, + + hit_mob = function(self, mob) + mob:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 1}, + }, nil) + end, + + hit_node = function(self, pos, node) + end +}) + --spawn mcl_mobs:spawn_specific( "mobs_mc:llama", diff --git a/mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_spit.png b/mods/ENTITIES/mobs_mc/textures/mobs_mc_llama_spit.png new file mode 100644 index 0000000000000000000000000000000000000000..9433d2f86c309825dc4a15081338e596ef1e73c8 GIT binary patch literal 307 zcmV-30nGl1P)x7@k0%Qr115nUXAzX3@C}_C=E#f59&~X4dx-?t>M2Db*AW)=WIWaU7 z;S+ literal 0 HcmV?d00001