mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-04-16 19:00:21 +02:00
add mob repellent
This commit is contained in:
parent
9f472fb690
commit
0a62f05132
11
api.lua
11
api.lua
@ -18,7 +18,7 @@ end
|
|||||||
-- Global table
|
-- Global table
|
||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo", version = "20250204",
|
mod = "redo", version = "20250209",
|
||||||
spawning_mobs = {}, translate = S,
|
spawning_mobs = {}, translate = S,
|
||||||
node_snow = has(minetest.registered_aliases["mapgen_snow"])
|
node_snow = has(minetest.registered_aliases["mapgen_snow"])
|
||||||
or has("mcl_core:snow") or has("default:snow") or "air",
|
or has("mcl_core:snow") or has("default:snow") or "air",
|
||||||
@ -3717,6 +3717,15 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- is mob repellent nearby
|
||||||
|
if #minetest.find_nodes_in_area(
|
||||||
|
{x = pos.x - 16, y = pos.y - 16, z = pos.z - 16},
|
||||||
|
{x = pos.x + 16, y = pos.y + 16, z = pos.z + 16},
|
||||||
|
{"mobs:mob_repellent"}) > 0 then
|
||||||
|
--print("--- mob repellent nearby")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- change position to node above
|
-- change position to node above
|
||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
|
|
||||||
|
10
crafts.lua
10
crafts.lua
@ -25,6 +25,16 @@ sound_helper("node_sound_water_defaults")
|
|||||||
sound_helper("node_sound_snow_defaults")
|
sound_helper("node_sound_snow_defaults")
|
||||||
sound_helper("node_sound_glass_defaults")
|
sound_helper("node_sound_glass_defaults")
|
||||||
|
|
||||||
|
-- mob repellent node
|
||||||
|
|
||||||
|
minetest.register_node("mobs:mob_repellent", {
|
||||||
|
description = S("Mob Repellent"),
|
||||||
|
tiles = {"mobs_repellent.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {handy = 1, cracky = 3},
|
||||||
|
sounds = mobs.node_sound_stone_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
-- helper function to add {eatable} group to food items
|
-- helper function to add {eatable} group to food items
|
||||||
|
|
||||||
function mobs.add_eatable(item, hp)
|
function mobs.add_eatable(item, hp)
|
||||||
|
5
init.lua
5
init.lua
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
local S = minetest.get_translator("mobs")
|
||||||
|
|
||||||
-- peaceful player privilege
|
-- peaceful player privilege
|
||||||
|
|
||||||
minetest.register_privilege("peaceful_player", {
|
minetest.register_privilege("peaceful_player", {
|
||||||
@ -9,13 +11,14 @@ minetest.register_privilege("peaceful_player", {
|
|||||||
-- fallback node
|
-- fallback node
|
||||||
|
|
||||||
minetest.register_node("mobs:fallback_node", {
|
minetest.register_node("mobs:fallback_node", {
|
||||||
description = "Fallback Node",
|
description = S("Fallback Node"),
|
||||||
tiles = {"mobs_fallback.png"},
|
tiles = {"mobs_fallback.png"},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {handy = 1, crumbly = 3, not_in_creative_inventory = 1},
|
groups = {handy = 1, crumbly = 3, not_in_creative_inventory = 1},
|
||||||
drop = ""
|
drop = ""
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
local path = minetest.get_modpath("mobs")
|
local path = minetest.get_modpath("mobs")
|
||||||
|
|
||||||
dofile(path .. "/api.lua") -- mob API
|
dofile(path .. "/api.lua") -- mob API
|
||||||
|
@ -15,7 +15,8 @@ lucky_block:add_blocks({
|
|||||||
{"dro", {"mobs:protector"}, 1},
|
{"dro", {"mobs:protector"}, 1},
|
||||||
{"dro", {"mobs:fence_wood"}, 10},
|
{"dro", {"mobs:fence_wood"}, 10},
|
||||||
{"dro", {"mobs:fence_top"}, 12},
|
{"dro", {"mobs:fence_top"}, 12},
|
||||||
{"lig"}
|
{"lig"},
|
||||||
|
{"dro", {"mobs:mob_repellent"}, 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- pint sized rune, use on tamed mob to shrink to half-size
|
-- pint sized rune, use on tamed mob to shrink to half-size
|
||||||
|
@ -19,8 +19,9 @@ https://forum.minetest.net/viewtopic.php?f=11&t=9917
|
|||||||
- **Shears**. Used to right-click sheep and return 1-3 wool.
|
- **Shears**. Used to right-click sheep and return 1-3 wool.
|
||||||
- **Protection Rune**. Protects tamed mobs from being harmed by other players.
|
- **Protection Rune**. Protects tamed mobs from being harmed by other players.
|
||||||
- **Mob Fence and Fence Top**. Stops mobs escaping or glitching throughfences.
|
- **Mob Fence and Fence Top**. Stops mobs escaping or glitching throughfences.
|
||||||
|
- Add mobs:mob_repellent block to stop mobs spawning within 16 node radius.
|
||||||
|
|
||||||
**Lucky Blocks**: 12
|
**Lucky Blocks**: 13
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
BIN
textures/mobs_repellent.png
Normal file
BIN
textures/mobs_repellent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 415 B |
Loading…
x
Reference in New Issue
Block a user