Update mobs_mc

This commit is contained in:
Wuzzy 2018-03-25 22:27:06 +02:00
parent bb6f2f7770
commit 318415307c
7 changed files with 40 additions and 23 deletions

View file

@ -2,10 +2,10 @@
All mobs in this mod must use variables in this table, instead
of hardcoding the itemstring.
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
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". ]]
@ -147,7 +147,7 @@ mobs_mc.items = {
-- Light blue intentionally missing
-- 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

View file

@ -19,8 +19,8 @@ This mod adds mobs which closely resemble the mobs from the game Minecraft, vers
## Useful information for developers
### Subgame integration
Want to include this mod in your subgame? Read `gameconfig.md`.
### Game integration
Want to include this mod in your game? Read `gameconfig.md`.
### Links

View file

@ -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", {
visual = "sprite",
@ -131,13 +132,15 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
end
end
minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then
local dx = math.random(-1,1)
local dy = math.random(-1,1)
local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"})
if mobs_griefing then
minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then
local dx = math.random(-1,1)
local dy = math.random(-1,1)
local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"})
end
end
end
})

View file

@ -161,6 +161,8 @@ local select_enderman_animation = function(animation_type)
end
end
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_mob("mobs_mc:enderman", {
-- TODO: Make endermen attack when looked at
type = "animal",
@ -194,6 +196,9 @@ mobs:register_mob("mobs_mc:enderman", {
animation = select_enderman_animation("normal"),
_taken_node = "",
do_custom = function(self, dtime)
if not mobs_griefing then
return
end
-- Take and put nodes
if not self._take_place_timer or not self._next_take_place_time then
self._take_place_timer = 0

View file

@ -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 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
* `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!
* After finishing this, throughly test this
* Without `mobs_mc_gameconfig`, the mod assumes Minetest Game items

View file

@ -8,6 +8,8 @@ local MP = minetest.get_modpath(minetest.get_current_modname())
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 mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_mob("mobs_mc:snowman", {
type = "npc",
passive = true,
@ -51,6 +53,9 @@ mobs:register_mob("mobs_mc:snowman", {
},
blood_amount = 0,
do_custom = function(self, dtime)
if not mobs_griefing then
return
end
-- Leave a trail of top snow behind.
-- 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.

View file

@ -73,6 +73,8 @@ mobs:register_mob("mobs_mc:wither", {
blood_amount = 0,
})
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
visual = "sprite",
visual_size = {x = 1, y = 1},
@ -106,13 +108,15 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
end
end
minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then
dx = math.random(-1,1)
dy = math.random(-1,1)
dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"})
if mobs_griefing then
minetest.set_node(pos, {name="air"})
if math.random(1,2)==1 then
local dx = math.random(-1,1)
local dy = math.random(-1,1)
local dz = math.random(-1,1)
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
minetest.set_node(p, {name="air"})
end
end
end
})