mirror of
https://codeberg.org/tenplus1/mobs_monster.git
synced 2024-11-14 14:50:21 +01:00
update spider types, have jungle tarantula spit webs
This commit is contained in:
parent
9835105cf9
commit
b1a94c5abc
150
spider.lua
150
spider.lua
|
@ -11,6 +11,46 @@ local get_velocity = function(self)
|
|||
return (v.x * v.x + v.z * v.z) ^ 0.5
|
||||
end
|
||||
|
||||
|
||||
local spider_types = {
|
||||
|
||||
{ nodes = {"default:snow", "default:snowblock", "default:dirt_with_snow"},
|
||||
skins = {"mobs_spider_snowy.png"},
|
||||
docile = true,
|
||||
drops = nil
|
||||
},
|
||||
|
||||
{ nodes = {"default:dirt_with_rainforest_litter", "default:jungletree"},
|
||||
skins = {"mobs_spider_orange.png"},
|
||||
docile = true,
|
||||
drops = nil,
|
||||
shoot = true
|
||||
},
|
||||
|
||||
{ nodes = {"default:stone", "default:gravel"},
|
||||
skins = {"mobs_spider_grey.png"},
|
||||
docile = nil,
|
||||
drops = nil
|
||||
},
|
||||
|
||||
{ nodes = {"default:mese", "default:stone_with_mese"},
|
||||
skins = {"mobs_spider_mese.png"},
|
||||
docile = nil,
|
||||
drops = {
|
||||
{name = "farming:string", chance = 1, min = 0, max = 2},
|
||||
{name = "default:mese_crystal_fragment", chance = 2, min = 1, max = 4}}
|
||||
},
|
||||
|
||||
{ nodes = {"ethereal:crystal_dirt", "ethereal:crystal_spike"},
|
||||
skins = {"mobs_spider_crystal.png"},
|
||||
docile = true,
|
||||
drops = {
|
||||
{name = "farming:string", chance = 1, min = 0, max = 2},
|
||||
{name = "ethereal:crystal_spike", chance = 15, min = 1, max = 2}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- Spider by AspireMint (CC-BY-SA 3.0 license)
|
||||
|
||||
mobs:register_mob("mobs_monster:spider", {
|
||||
|
@ -53,7 +93,7 @@ mobs:register_mob("mobs_monster:spider", {
|
|||
light_damage = 0,
|
||||
animation = {
|
||||
speed_normal = 15,
|
||||
speed_run = 20,--15,
|
||||
speed_run = 20,
|
||||
stand_start = 0,
|
||||
stand_end = 0,
|
||||
walk_start = 1,
|
||||
|
@ -63,42 +103,39 @@ mobs:register_mob("mobs_monster:spider", {
|
|||
punch_start = 25,
|
||||
punch_end = 45,
|
||||
},
|
||||
-- what kind of spider are we spawning?
|
||||
|
||||
-- check surrounding nodes and spawn a specific spider
|
||||
on_spawn = function(self)
|
||||
|
||||
local pos = self.object:get_pos() ; pos.y = pos.y - 1
|
||||
local tmp
|
||||
|
||||
-- snowy spider
|
||||
if minetest.find_node_near(pos, 1,
|
||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||
self.base_texture = {"mobs_spider_snowy.png"}
|
||||
self.object:set_properties({textures = self.base_texture})
|
||||
self.docile_by_day = true
|
||||
-- tarantula
|
||||
elseif minetest.find_node_near(pos, 1,
|
||||
{"default:dirt_with_rainforest_litter", "default:jungletree"}) then
|
||||
self.base_texture = {"mobs_spider_orange.png"}
|
||||
self.object:set_properties({textures = self.base_texture})
|
||||
self.docile_by_day = true
|
||||
-- grey spider
|
||||
elseif minetest.find_node_near(pos, 1,
|
||||
{"default:stone", "default:gravel"}) then
|
||||
self.base_texture = {"mobs_spider_grey.png"}
|
||||
self.object:set_properties({textures = self.base_texture})
|
||||
-- mese spider
|
||||
elseif minetest.find_node_near(pos, 1,
|
||||
{"default:mese", "default:stone_with_mese"}) then
|
||||
self.base_texture = {"mobs_spider_mese.png"}
|
||||
self.object:set_properties({textures = self.base_texture})
|
||||
elseif minetest.find_node_near(pos, 1,
|
||||
{"ethereal:crystal_dirt", "ethereal:crystal_spike"}) then
|
||||
self.base_texture = {"mobs_spider_crystal.png"}
|
||||
self.object:set_properties({textures = self.base_texture})
|
||||
self.docile_by_day = true
|
||||
self.drops = {
|
||||
{name = "farming:string", chance = 1, min = 0, max = 2},
|
||||
{name = "ethereal:crystal_spike", chance = 15, min = 1, max = 2},
|
||||
}
|
||||
for n = 1, #spider_types do
|
||||
|
||||
tmp = spider_types[n]
|
||||
|
||||
if minetest.find_node_near(pos, 1, tmp.nodes) then
|
||||
|
||||
self.base_texture = tmp.skins
|
||||
self.object:set_properties({textures = tmp.skins})
|
||||
self.docile_by_day = tmp.docile
|
||||
|
||||
if tmp.drops then
|
||||
self.drops = tmp.drops
|
||||
end
|
||||
|
||||
if tmp.shoot then
|
||||
self.attack_type = "dogshoot"
|
||||
self.arrow = "mobs_monster:cobweb"
|
||||
self.dogshoot_switch = 1
|
||||
self.dogshoot_count_max = 60
|
||||
self.dogshoot_count2_max = 20
|
||||
self.shoot_interval = 2
|
||||
self.shoot_offset = 2
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return true -- run only once, false/nil runs every activation
|
||||
|
@ -233,7 +270,7 @@ minetest.register_node(":mobs:cobweb", {
|
|||
walkable = false,
|
||||
groups = {snappy = 1, disable_jump = 1},
|
||||
drop = "farming:string",
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -244,3 +281,48 @@ minetest.register_craft({
|
|||
{"farming:string", "", "farming:string"},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
local web_place = function(pos)
|
||||
|
||||
local pos2 = minetest.find_node_near(pos, 1, {"air", "group:leaves"}, true)
|
||||
|
||||
if pos2 then
|
||||
minetest.swap_node(pos2, {name = "mobs:cobweb"})
|
||||
end
|
||||
end
|
||||
|
||||
mobs:register_arrow("mobs_monster:cobweb", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 1, y = 1},
|
||||
textures = {"mobs_cobweb.png"},
|
||||
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
|
||||
velocity = 15,
|
||||
tail = 1,
|
||||
tail_texture = "mobs_cobweb.png",
|
||||
tail_size = 5,
|
||||
glow = 2,
|
||||
expire = 0.1,
|
||||
|
||||
hit_player = function(self, player)
|
||||
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 2.0,
|
||||
damage_groups = {fleshy = 3},
|
||||
}, nil)
|
||||
|
||||
web_place(self.object:get_pos())
|
||||
end,
|
||||
|
||||
hit_node = function(self, pos, node)
|
||||
web_place(pos)
|
||||
end,
|
||||
|
||||
hit_mob = function(self, player)
|
||||
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 2.0,
|
||||
damage_groups = {fleshy = 3},
|
||||
}, nil)
|
||||
end
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user