forked from VoxeLibre/VoxeLibre
Update mobs_mc
This commit is contained in:
parent
bb6f2f7770
commit
318415307c
|
@ -2,10 +2,10 @@
|
||||||
All mobs in this mod must use variables in this table, instead
|
All mobs in this mod must use variables in this table, instead
|
||||||
of hardcoding the itemstring.
|
of hardcoding the itemstring.
|
||||||
This way, external mods are enabled to replace the itemstrings to provide
|
This way, external mods are enabled to replace the itemstrings to provide
|
||||||
their own items and subgame integration is made much simpler.
|
their own items and game integration is made much simpler.
|
||||||
|
|
||||||
An item IDs is supposed to be overwritten by adding
|
An item IDs is supposed to be overwritten by adding
|
||||||
mobs_mc.override.items["example:item"] in a subgame mod
|
mobs_mc.override.items["example:item"] in a game mod
|
||||||
with name "mobs_mc_gameconfig". ]]
|
with name "mobs_mc_gameconfig". ]]
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ mobs_mc.items = {
|
||||||
-- Light blue intentionally missing
|
-- Light blue intentionally missing
|
||||||
|
|
||||||
-- Special items
|
-- Special items
|
||||||
music_discs = {}, -- No music discs by default; used by creeper. Override this if your subgame has music discs.
|
music_discs = {}, -- No music discs by default; used by creeper. Override this if your game has music discs.
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Tables for attracting, feeding and breeding mobs
|
-- Tables for attracting, feeding and breeding mobs
|
||||||
|
|
|
@ -19,8 +19,8 @@ This mod adds mobs which closely resemble the mobs from the game Minecraft, vers
|
||||||
|
|
||||||
## Useful information for developers
|
## Useful information for developers
|
||||||
|
|
||||||
### Subgame integration
|
### Game integration
|
||||||
Want to include this mod in your subgame? Read `gameconfig.md`.
|
Want to include this mod in your game? Read `gameconfig.md`.
|
||||||
|
|
||||||
### Links
|
### Links
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,7 @@ mobs:register_mob("mobs_mc:enderdragon", {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
|
mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
|
@ -131,13 +132,15 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.set_node(pos, {name="air"})
|
if mobs_griefing then
|
||||||
if math.random(1,2)==1 then
|
minetest.set_node(pos, {name="air"})
|
||||||
local dx = math.random(-1,1)
|
if math.random(1,2)==1 then
|
||||||
local dy = math.random(-1,1)
|
local dx = math.random(-1,1)
|
||||||
local dz = math.random(-1,1)
|
local dy = math.random(-1,1)
|
||||||
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
local dz = math.random(-1,1)
|
||||||
minetest.set_node(p, {name="air"})
|
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||||
|
minetest.set_node(p, {name="air"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
@ -161,6 +161,8 @@ local select_enderman_animation = function(animation_type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:enderman", {
|
mobs:register_mob("mobs_mc:enderman", {
|
||||||
-- TODO: Make endermen attack when looked at
|
-- TODO: Make endermen attack when looked at
|
||||||
type = "animal",
|
type = "animal",
|
||||||
|
@ -194,6 +196,9 @@ mobs:register_mob("mobs_mc:enderman", {
|
||||||
animation = select_enderman_animation("normal"),
|
animation = select_enderman_animation("normal"),
|
||||||
_taken_node = "",
|
_taken_node = "",
|
||||||
do_custom = function(self, dtime)
|
do_custom = function(self, dtime)
|
||||||
|
if not mobs_griefing then
|
||||||
|
return
|
||||||
|
end
|
||||||
-- Take and put nodes
|
-- Take and put nodes
|
||||||
if not self._take_place_timer or not self._next_take_place_time then
|
if not self._take_place_timer or not self._next_take_place_time then
|
||||||
self._take_place_timer = 0
|
self._take_place_timer = 0
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Subgame integration help
|
# Game integration help
|
||||||
|
|
||||||
This mod has been designed to make subgame integration rather easy. Ideally, it should be possible to include this mod verbatim in your subgame, with modifications only done by an external mod.
|
This mod has been designed to make game integration rather easy. Ideally, it should be possible to include this mod verbatim in your game, with modifications only done by an external mod.
|
||||||
|
|
||||||
To integrate this mod in a subgame, you have to do 2 things: Adding the mod, and adding another mod which tells `mobs_mc` which items to use. The idea is that `mobs_mc` should work with any items. Specifically, these are the steps you need to follow:
|
To integrate this mod in a game, you have to do 2 things: Adding the mod, and adding another mod which tells `mobs_mc` which items to use. The idea is that `mobs_mc` should work with any items. Specifically, these are the steps you need to follow:
|
||||||
|
|
||||||
* Add the `mobs_mc` mod and its dependencies
|
* Add the `mobs_mc` mod and its dependencies
|
||||||
* Add a mod with name “`mobs_mc_gameconfig`”
|
* Add a mod with name “`mobs_mc_gameconfig`”
|
||||||
|
@ -21,7 +21,7 @@ Some things to note:
|
||||||
|
|
||||||
* Every override is optional, but explicitly setting all the item overrides is strongly recommended
|
* Every override is optional, but explicitly setting all the item overrides is strongly recommended
|
||||||
* `mobs_mc` ships many (but not all) items on its own. If not item name override is set, the `mobs_mc` item is used
|
* `mobs_mc` ships many (but not all) items on its own. If not item name override is set, the `mobs_mc` item is used
|
||||||
* You decide whether your subgame defines its own items, outside of `mobs_mc` or if you let `mobs_mc` do the work.
|
* You decide whether your game defines its own items, outside of `mobs_mc` or if you let `mobs_mc` do the work.
|
||||||
* Make sure to avoid duplicate items!
|
* Make sure to avoid duplicate items!
|
||||||
* After finishing this, throughly test this
|
* After finishing this, throughly test this
|
||||||
* Without `mobs_mc_gameconfig`, the mod assumes Minetest Game items
|
* Without `mobs_mc_gameconfig`, the mod assumes Minetest Game items
|
||||||
|
|
|
@ -8,6 +8,8 @@ local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
local snow_trail_frequency = 0.5 -- Time in seconds for checking to add a new snow trail
|
local snow_trail_frequency = 0.5 -- Time in seconds for checking to add a new snow trail
|
||||||
|
|
||||||
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:snowman", {
|
mobs:register_mob("mobs_mc:snowman", {
|
||||||
type = "npc",
|
type = "npc",
|
||||||
passive = true,
|
passive = true,
|
||||||
|
@ -51,6 +53,9 @@ mobs:register_mob("mobs_mc:snowman", {
|
||||||
},
|
},
|
||||||
blood_amount = 0,
|
blood_amount = 0,
|
||||||
do_custom = function(self, dtime)
|
do_custom = function(self, dtime)
|
||||||
|
if not mobs_griefing then
|
||||||
|
return
|
||||||
|
end
|
||||||
-- Leave a trail of top snow behind.
|
-- Leave a trail of top snow behind.
|
||||||
-- This is done in do_custom instead of just using replace_what because with replace_what,
|
-- This is done in do_custom instead of just using replace_what because with replace_what,
|
||||||
-- the top snop may end up floating in the air.
|
-- the top snop may end up floating in the air.
|
||||||
|
|
|
@ -73,6 +73,8 @@ mobs:register_mob("mobs_mc:wither", {
|
||||||
blood_amount = 0,
|
blood_amount = 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
|
mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 1, y = 1},
|
visual_size = {x = 1, y = 1},
|
||||||
|
@ -106,13 +108,15 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.set_node(pos, {name="air"})
|
if mobs_griefing then
|
||||||
if math.random(1,2)==1 then
|
minetest.set_node(pos, {name="air"})
|
||||||
dx = math.random(-1,1)
|
if math.random(1,2)==1 then
|
||||||
dy = math.random(-1,1)
|
local dx = math.random(-1,1)
|
||||||
dz = math.random(-1,1)
|
local dy = math.random(-1,1)
|
||||||
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
local dz = math.random(-1,1)
|
||||||
minetest.set_node(p, {name="air"})
|
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||||
|
minetest.set_node(p, {name="air"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue