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.
This commit is contained in:
Thinking 2022-01-21 17:21:58 -05:00
parent 67faaeb79d
commit 4c85f85422
4 changed files with 110 additions and 3 deletions

View File

@ -43,6 +43,7 @@
* Laurent Rocher
* Li0n
* Marcin Serwin
* Mental-Inferno
* Midgard
* MysticTempest
* Nicholas Niro

View File

@ -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

View File

@ -1 +1,2 @@
mcl_mobs
mcl_potions

View File

@ -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(