Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Illuna-Minetest
mobs_monster
Commits
b1a94c5a
Commit
b1a94c5a
authored
Mar 01, 2021
by
tenplus1
Browse files
update spider types, have jungle tarantula spit webs
parent
9835105c
Changes
1
Hide whitespace changes
Inline
Side-by-side
spider.lua
View file @
b1a94c5a
...
...
@@ -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
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
-- 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
},
}
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
})
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment