From 4c85f85422d04f3fe7e1fdde57801c8220d3c363 Mon Sep 17 00:00:00 2001 From: Thinking <59522230+Mental-Inferno@users.noreply.github.com> Date: Fri, 21 Jan 2022 17:21:58 -0500 Subject: [PATCH 1/2] Added poison to cave spider attack Converted melee cave spider punch to custom, ultra low range, poison spit. The attack serves as a functional stop gap until punch augmentation is implemented in the mcl_mobs API (if that is decided to be done). The attack does 2 initial damage + 4 poison damage over 8 seconds (better fraction that Minecraft's weird 4 damage over 7 seconds) Credits have been added where necessary. --- CREDITS.md | 1 + mods/ENTITIES/mobs_mc/README.md | 1 + mods/ENTITIES/mobs_mc/depends.txt | 3 +- mods/ENTITIES/mobs_mc/spider.lua | 108 +++++++++++++++++++++++++++++- 4 files changed, 110 insertions(+), 3 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 04e52d5b1..22d78fe98 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -43,6 +43,7 @@ * Laurent Rocher * Li0n * Marcin Serwin +* Mental-Inferno * Midgard * MysticTempest * Nicholas Niro diff --git a/mods/ENTITIES/mobs_mc/README.md b/mods/ENTITIES/mobs_mc/README.md index d3ac29a16..4718c6b1f 100644 --- a/mods/ENTITIES/mobs_mc/README.md +++ b/mods/ENTITIES/mobs_mc/README.md @@ -10,6 +10,7 @@ This mod adds mobs which closely resemble the mobs from the game Minecraft, vers * [22i](https://github.com/22i): Models (done in Blender) and mob icons for spawn eggs * [XSSheep](https://www.planetminecraft.com/member/xssheep/): Mob and item textures (from [Pixel Perfection](https://www.planetminecraft.com/texture_pack/131pixel-perfection/)) * MysticTempest: More mob textures +* [Mental-Inferno](https://github.com/Mental-Inferno): Code * See `LICENSE_media.md` for detailed credits about each file ## Licensing diff --git a/mods/ENTITIES/mobs_mc/depends.txt b/mods/ENTITIES/mobs_mc/depends.txt index 674eb8094..96c9f5131 100644 --- a/mods/ENTITIES/mobs_mc/depends.txt +++ b/mods/ENTITIES/mobs_mc/depends.txt @@ -1 +1,2 @@ -mcl_mobs \ No newline at end of file +mcl_mobs +mcl_potions \ No newline at end of file diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index e1be9c3ed..2fed6dedf 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -76,7 +76,111 @@ local spider = { } mobs:register_mob("mobs_mc:spider", spider) --- Cave spider + +--Cave Spider + +local cave_spider = { + description = S("Cave Spider"), + type = "monster", + spawn_class = "hostile", + passive = false, + hostile = true, + always_climb = true, + docile_by_day = true, + rotate = 270, + + --work-around for poison until punch augmentations are added to mob API + --works functionally but the jump while punching animation in gone + reach = 0.5, --makes it look like it's biting + attack_type = "projectile", + arrow = "spider_venom", --ultra short range projectile to inflict poison effect + projectile_cooldown_min = 1, --if kept at 0.5, this mob can annhiliate you + projectile_cooldown_max = 1, + shoot_arrow = function(self, pos, dir) + local dmg = 2 + mobs.shoot_projectile_handling("mobs_mc:spider_venom", pos, dir, self.object:get_yaw(), self.object, 1, dmg,nil,nil,nil,-0.6) + end, + + hp_min = 1, + hp_max = 12, + ignores_cobwebs = true, + xp_min = 5, + xp_max = 5, + eye_height = 0.475, + armor = {fleshy = 100, arthropod = 100}, + collisionbox = {-0.35, -0.01, -0.35, 0.35, 0.49, 0.35}, + visual = "mesh", + mesh = "mobs_mc_spider.b3d", + textures = { + {"mobs_mc_cave_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"}, + }, + visual_size = {x=1.66666, y=1.5}, + makes_footstep_sound = false, + sounds = { + random = "mobs_mc_spider_random", + attack = "mobs_mc_spider_attack", + damage = "mobs_mc_spider_hurt", + death = "mobs_mc_spider_death", + -- TODO: sounds: walk + distance = 16, + }, + base_pitch = 1.25, + walk_velocity = 1.3, + run_velocity = 3.2, + jump = true, + jump_height = 4, + view_range = 16, + floats = 1, + drops = { + {name = mobs_mc.items.string, chance = 1, min = 0, max = 2, looting = "common"}, + {name = mobs_mc.items.spider_eye, chance = 3, min = 1, max = 1, looting = "common", looting_chance_function = function(lvl) + return 1 - 2 / (lvl + 3) + end}, + }, + specific_attack = { "player", "mobs_mc:iron_golem" }, + fear_height = 4, + animation = { + stand_speed = 10, + walk_speed = 25, + run_speed = 50, + stand_start = 20, + stand_end = 40, + walk_start = 0, + walk_end = 20, + run_start = 0, + run_end = 20, + }, +} +mobs:register_mob("mobs_mc:cave_spider", cave_spider) + + +-- spider_venom (projectile) +mobs:register_arrow("mobs_mc:spider_venom", { + visual = "sprite", + visual_size = {x = 0.1, y = 0.1}, + textures = {"hbhunger_icon_health_poison.png"}, + velocity = 1, + collisionbox = {-.5, -.5, -.5, .5, .5, .5}, + tail = 0, + + hit_player = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = self._damage}, + }, nil) + mcl_potions.poison_func(player, 0.5, 8) --modified cuz MC rate is an unessesarily bad fraction + end, + + hit_mob = function(self, mob) + mob:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = self._damage}, + }, nil) + mcl_potions.poison_func(mob, 0.5, 8) --modified cuz MC rate is an unessesarily bad fraction + end, +}) + +--[[ Cave spider (Previous code) local cave_spider = table.copy(spider) cave_spider.description = S("Cave Spider") cave_spider.textures = { {"mobs_mc_cave_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"} } @@ -91,7 +195,7 @@ cave_spider.walk_velocity = 1.3 cave_spider.run_velocity = 3.2 cave_spider.sounds = table.copy(spider.sounds) cave_spider.sounds.base_pitch = 1.25 -mobs:register_mob("mobs_mc:cave_spider", cave_spider) +mobs:register_mob("mobs_mc:cave_spider", cave_spider)--]] mobs:spawn_specific( From d3711b69a5181eefc1055e7b6e693039a34a0b31 Mon Sep 17 00:00:00 2001 From: Mental-Inferno Date: Sat, 22 Jan 2022 15:15:09 -0500 Subject: [PATCH 2/2] Fixed bug where cave spider poison effect would continue after respawn Also added knockback effect to cave spider attack and set default cave spider health to current Minecraft default. --- mods/ENTITIES/mobs_mc/spider.lua | 33 ++++++++++++++++-------- mods/PLAYER/mcl_refresh_status/README.md | 28 ++++++++++++++++++++ mods/PLAYER/mcl_refresh_status/init.lua | 3 +++ mods/PLAYER/mcl_refresh_status/mod.conf | 4 +++ 4 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 mods/PLAYER/mcl_refresh_status/README.md create mode 100644 mods/PLAYER/mcl_refresh_status/init.lua create mode 100644 mods/PLAYER/mcl_refresh_status/mod.conf diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 2fed6dedf..49eff8ca1 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -77,6 +77,7 @@ local spider = { mobs:register_mob("mobs_mc:spider", spider) + --Cave Spider local cave_spider = { @@ -89,19 +90,19 @@ local cave_spider = { docile_by_day = true, rotate = 270, - --work-around for poison until punch augmentations are added to mob API - --works functionally but the jump while punching animation in gone + --[[work-around for poison until punch augmentations are added to mob API + works functionally but the jump while punching animation in gone--]] reach = 0.5, --makes it look like it's biting attack_type = "projectile", - arrow = "spider_venom", --ultra short range projectile to inflict poison effect - projectile_cooldown_min = 1, --if kept at 0.5, this mob can annhiliate you + arrow = "spider_venom", --ultra short range projectile to inflict poison effect + punch damage + projectile_cooldown_min = 1, projectile_cooldown_max = 1, shoot_arrow = function(self, pos, dir) local dmg = 2 mobs.shoot_projectile_handling("mobs_mc:spider_venom", pos, dir, self.object:get_yaw(), self.object, 1, dmg,nil,nil,nil,-0.6) end, - hp_min = 1, + hp_min = 12, --reflect Minecraft health hp_max = 12, ignores_cobwebs = true, xp_min = 5, @@ -126,7 +127,7 @@ local cave_spider = { }, base_pitch = 1.25, walk_velocity = 1.3, - run_velocity = 3.2, + run_velocity = 3.5, --Compenstaing for the loss of aility to leap while attacking jump = true, jump_height = 4, view_range = 16, @@ -168,15 +169,25 @@ mobs:register_arrow("mobs_mc:spider_venom", { full_punch_interval = 1.0, damage_groups = {fleshy = self._damage}, }, nil) + mcl_potions.poison_func(player, 0.5, 8) --modified cuz MC rate is an unessesarily bad fraction + local vel = player:get_velocity() + player:add_velocity({x=(vel.x * -1.5), y=6, z=(vel.z * -1.5)}) --"chaos knockback" effect (Temporary until I understand how to implement knockback for a projectile) end, hit_mob = function(self, mob) - mob:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = self._damage}, - }, nil) - mcl_potions.poison_func(mob, 0.5, 8) --modified cuz MC rate is an unessesarily bad fraction + if mob ~= self then --due to low power of attack, spider can shoot itself while chasing a target + mob:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = self._damage}, + }, nil) + + if ((mob ~= "mobs_mc:cave_spider") and (mob ~= "mobs_mc:spider")) then --spider's don't have automatic immunity to poison yet so this is a stop gap solution + mcl_potions.poison_func(mob, 0.5, 8) --modified cuz MC rate is an unessesarily bad fraction + end + local vel = mob:get_velocity() + mob:add_velocity({x=(-1 * vel.z), y=6, z=(-1 * vel.x)}) --"chaos knockback" effect (Temporary until I understand how to implement knockback for a projectile) + end end, }) diff --git a/mods/PLAYER/mcl_refresh_status/README.md b/mods/PLAYER/mcl_refresh_status/README.md new file mode 100644 index 000000000..b214ffb75 --- /dev/null +++ b/mods/PLAYER/mcl_refresh_status/README.md @@ -0,0 +1,28 @@ +# Status Effect Refresh for Mineclone 5 + +This allows the use of status effect function from mcl_potions and prevents them +from continuing their effect after player respawn + +## Licensing +MIT License + +Copyright (c) 2022 Mental-Inferno + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +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. + diff --git a/mods/PLAYER/mcl_refresh_status/init.lua b/mods/PLAYER/mcl_refresh_status/init.lua new file mode 100644 index 000000000..7b9bc4bd9 --- /dev/null +++ b/mods/PLAYER/mcl_refresh_status/init.lua @@ -0,0 +1,3 @@ +minetest.register_on_respawnplayer(function(player) + mcl_potions._reset_player_effects(player, true) +end) \ No newline at end of file diff --git a/mods/PLAYER/mcl_refresh_status/mod.conf b/mods/PLAYER/mcl_refresh_status/mod.conf new file mode 100644 index 000000000..f72f49ff2 --- /dev/null +++ b/mods/PLAYER/mcl_refresh_status/mod.conf @@ -0,0 +1,4 @@ +name = mcl_refresh_status +author = Mental-Inferno +description = Resets status-effects inflicted on player when player respawns +depends = mcl_potions