mirror of
https://codeberg.org/tenplus1/mobs_monster.git
synced 2024-12-22 17:00:26 +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
|
return (v.x * v.x + v.z * v.z) ^ 0.5
|
||||||
end
|
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)
|
-- Spider by AspireMint (CC-BY-SA 3.0 license)
|
||||||
|
|
||||||
mobs:register_mob("mobs_monster:spider", {
|
mobs:register_mob("mobs_monster:spider", {
|
||||||
@ -53,7 +93,7 @@ mobs:register_mob("mobs_monster:spider", {
|
|||||||
light_damage = 0,
|
light_damage = 0,
|
||||||
animation = {
|
animation = {
|
||||||
speed_normal = 15,
|
speed_normal = 15,
|
||||||
speed_run = 20,--15,
|
speed_run = 20,
|
||||||
stand_start = 0,
|
stand_start = 0,
|
||||||
stand_end = 0,
|
stand_end = 0,
|
||||||
walk_start = 1,
|
walk_start = 1,
|
||||||
@ -63,42 +103,39 @@ mobs:register_mob("mobs_monster:spider", {
|
|||||||
punch_start = 25,
|
punch_start = 25,
|
||||||
punch_end = 45,
|
punch_end = 45,
|
||||||
},
|
},
|
||||||
-- what kind of spider are we spawning?
|
|
||||||
|
-- check surrounding nodes and spawn a specific spider
|
||||||
on_spawn = function(self)
|
on_spawn = function(self)
|
||||||
|
|
||||||
local pos = self.object:get_pos() ; pos.y = pos.y - 1
|
local pos = self.object:get_pos() ; pos.y = pos.y - 1
|
||||||
|
local tmp
|
||||||
|
|
||||||
-- snowy spider
|
for n = 1, #spider_types do
|
||||||
if minetest.find_node_near(pos, 1,
|
|
||||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
tmp = spider_types[n]
|
||||||
self.base_texture = {"mobs_spider_snowy.png"}
|
|
||||||
self.object:set_properties({textures = self.base_texture})
|
if minetest.find_node_near(pos, 1, tmp.nodes) then
|
||||||
self.docile_by_day = true
|
|
||||||
-- tarantula
|
self.base_texture = tmp.skins
|
||||||
elseif minetest.find_node_near(pos, 1,
|
self.object:set_properties({textures = tmp.skins})
|
||||||
{"default:dirt_with_rainforest_litter", "default:jungletree"}) then
|
self.docile_by_day = tmp.docile
|
||||||
self.base_texture = {"mobs_spider_orange.png"}
|
|
||||||
self.object:set_properties({textures = self.base_texture})
|
if tmp.drops then
|
||||||
self.docile_by_day = true
|
self.drops = tmp.drops
|
||||||
-- grey spider
|
end
|
||||||
elseif minetest.find_node_near(pos, 1,
|
|
||||||
{"default:stone", "default:gravel"}) then
|
if tmp.shoot then
|
||||||
self.base_texture = {"mobs_spider_grey.png"}
|
self.attack_type = "dogshoot"
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.arrow = "mobs_monster:cobweb"
|
||||||
-- mese spider
|
self.dogshoot_switch = 1
|
||||||
elseif minetest.find_node_near(pos, 1,
|
self.dogshoot_count_max = 60
|
||||||
{"default:mese", "default:stone_with_mese"}) then
|
self.dogshoot_count2_max = 20
|
||||||
self.base_texture = {"mobs_spider_mese.png"}
|
self.shoot_interval = 2
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.shoot_offset = 2
|
||||||
elseif minetest.find_node_near(pos, 1,
|
end
|
||||||
{"ethereal:crystal_dirt", "ethereal:crystal_spike"}) then
|
|
||||||
self.base_texture = {"mobs_spider_crystal.png"}
|
return true
|
||||||
self.object:set_properties({textures = self.base_texture})
|
end
|
||||||
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},
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return true -- run only once, false/nil runs every activation
|
return true -- run only once, false/nil runs every activation
|
||||||
@ -233,7 +270,7 @@ minetest.register_node(":mobs:cobweb", {
|
|||||||
walkable = false,
|
walkable = false,
|
||||||
groups = {snappy = 1, disable_jump = 1},
|
groups = {snappy = 1, disable_jump = 1},
|
||||||
drop = "farming:string",
|
drop = "farming:string",
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -244,3 +281,48 @@ minetest.register_craft({
|
|||||||
{"farming:string", "", "farming:string"},
|
{"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