Compare commits
5 Commits
bcc6a8d52f
...
6c11f142e1
Author | SHA1 | Date |
---|---|---|
LNJ | 6c11f142e1 | |
LNJ | ba0499461b | |
LNJ | caec6ad402 | |
LNJ | 3b64e12bdf | |
LNJ | b0a0a4ad00 |
|
@ -1,6 +1,6 @@
|
|||
The NeXt Game for the MGE [minetest_tng]
|
||||
========================================
|
||||
Version 16.07
|
||||
Version 16.09
|
||||
|
||||
To use this game with Minetest, insert this repository as
|
||||
/games/minetest_tng
|
||||
|
|
14
game_api.txt
14
game_api.txt
|
@ -38,6 +38,7 @@ Overview:
|
|||
- Hunger
|
||||
- Trees
|
||||
- Default Functions
|
||||
- Legacy
|
||||
|
||||
|
||||
Bucket API
|
||||
|
@ -821,3 +822,16 @@ default.dig_up(pos, node, digger)
|
|||
-> pos: the position under the node that should be digged
|
||||
-> node: for comparing the node above 'pos' with
|
||||
-> digger: the identity for digging the node above 'pos'
|
||||
|
||||
Legacy
|
||||
------
|
||||
|
||||
legacy.register_entity_remove(entityname)
|
||||
^ Registers an entity that will directly removed when loaded.
|
||||
^ Useful for removed or renamed entitys.
|
||||
-> `entityname`: the name of the entity
|
||||
|
||||
legacy.register_replace(oldname, newname)
|
||||
^ Registers a lbm that will replace `oldname`-nodes with `newname`-nodes.
|
||||
-> `oldname`: the old node name (these nodes will be replaced with `newname`)
|
||||
-> `newname`: the new name for all oldname-nodes
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
--= Creatures MOB-Engine (cme) =--
|
||||
-- Copyright (c) 2015-2016 BlockMen <blockmen2015@gmail.com>
|
||||
--= Creatures MOB-Engine (cme) TNG-Version =--
|
||||
-- Copyright (C) 2015-2016 BlockMen <blockmen2015@gmail.com>
|
||||
-- Copyright (C) 2016 LNJ <git@lnj.li>
|
||||
--
|
||||
-- register.lua
|
||||
--
|
||||
|
@ -186,6 +187,11 @@ local function translate_def(def)
|
|||
-- immortal is needed to disable clientside smokepuff shit
|
||||
self.object:set_armor_groups({fleshy = 100, immortal = 1})
|
||||
|
||||
-- if in peaceful mode and the mob is hostile remove it!
|
||||
if self.hostile and not allow_hostile then
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
-- call custom on_activate if defined
|
||||
if def.on_activate then
|
||||
def.on_activate(self, staticdata)
|
||||
|
@ -230,18 +236,22 @@ function creatures.register_mob(def) -- returns true if sucessfull
|
|||
core.register_entity(":" .. def.name, mob_def)
|
||||
|
||||
-- register spawn
|
||||
if def.spawning and not (def.stats.hostile and not allow_hostile) then
|
||||
--if def.spawning and not (def.stats.hostile and not allow_hostile) then
|
||||
if def.spawning then
|
||||
local spawn_def = def.spawning
|
||||
spawn_def.mob_name = def.name
|
||||
spawn_def.mob_size = def.model.collisionbox
|
||||
if creatures.register_spawn(spawn_def) ~= true then
|
||||
throw_error("Couldn't register spawning for '" .. def.name .. "'")
|
||||
if not (def.stats.hostile and not allow_hostile) then
|
||||
if creatures.register_spawn(spawn_def) ~= true then
|
||||
throw_error("Couldn't register spawning for '" .. def.name .. "'")
|
||||
end
|
||||
end
|
||||
|
||||
if spawn_def.spawn_egg then
|
||||
local egg_def = def.spawning.spawn_egg
|
||||
egg_def.mob_name = def.name
|
||||
egg_def.box = def.model.collisionbox
|
||||
egg_def.hostile = mob_def.hostile or false
|
||||
creatures.register_egg(egg_def)
|
||||
end
|
||||
|
||||
|
@ -426,13 +436,21 @@ function creatures.register_egg(egg_def)
|
|||
return false
|
||||
end
|
||||
|
||||
local function on_rightclick() return end
|
||||
|
||||
-- check if mob is hostile and if these are allowed
|
||||
-- if the mob is not hostile or hostile mobs are allowed, add the spawn function
|
||||
if not (egg_def.hostile and not allow_hostile) then
|
||||
on_rightclick = function(itemstack, placer, pointed_thing)
|
||||
return eggSpawn(itemstack, placer, pointed_thing, egg_def)
|
||||
end
|
||||
end
|
||||
|
||||
core.register_craftitem(":" .. egg_def.mob_name .. "_spawn_egg", {
|
||||
description = egg_def.description or egg_def.mob_name .. " Spawn Egg",
|
||||
inventory_image = egg_def.texture or "creatures_spawn_egg.png",
|
||||
liquids_pointable = false,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return eggSpawn(itemstack, placer, pointed_thing, egg_def)
|
||||
end,
|
||||
on_place = on_rightclick
|
||||
})
|
||||
return true
|
||||
end
|
||||
|
@ -544,7 +562,8 @@ function creatures.register_spawner(spawner_def)
|
|||
local height = (box[5] or 2) - (box[2] or 0)
|
||||
spawner_def.height = height
|
||||
|
||||
if spawner_def.player_range and type(spawner_def.player_range) == "number" then
|
||||
if spawner_def.player_range and type(spawner_def.player_range) == "number" and
|
||||
allow_hostile then
|
||||
core.register_abm({
|
||||
nodenames = {spawner_def.mob_name .. "_spawner"},
|
||||
interval = 2,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--= Sheep for Creatures MOB-Engine (cme) =--
|
||||
--= Sheep for Creatures MOB-Engine (cme) - TNG-Version =--
|
||||
-- Copyright (C) 2015-2016 BlockMen <blockmen2015@gmail.com>
|
||||
-- Copyright (C) 2016 LNJ <lnj.git@gmail.com>
|
||||
-- Copyright (C) 2016 LNJ <git@lnj.li>
|
||||
--
|
||||
-- init.lua
|
||||
--
|
||||
|
@ -128,12 +128,14 @@ local def = {
|
|||
texture = "creatures_egg_sheep.png",
|
||||
},
|
||||
|
||||
--[[
|
||||
spawner = {
|
||||
description = "Sheep Spawner",
|
||||
range = 8,
|
||||
player_range = 20,
|
||||
number = 6,
|
||||
}
|
||||
]]
|
||||
},
|
||||
|
||||
on_punch = function(self, puncher)
|
||||
|
@ -181,7 +183,7 @@ local def = {
|
|||
core.sound_play("hunger_eat", {pos = pos, gain = 1, max_hear_distance = 10})
|
||||
|
||||
item:take_item()
|
||||
|
||||
|
||||
core.log("action", clicker:get_player_name() .. " fed a sheep at " .. core.pos_to_string(pos))
|
||||
elseif name == "default:shears" and self.has_wool then
|
||||
shear(self, math.random(2, 3), true)
|
||||
|
|
|
@ -258,13 +258,13 @@ function hunger.eat_item(hp_change, replace_with_item, itemstack, user, pointed_
|
|||
end
|
||||
|
||||
-- eating sound
|
||||
local sound
|
||||
local soundspec
|
||||
if not itemdef.sounds or not itemdef.sounds.eat then
|
||||
sound = {name = "default_eat", gain = 0.7}
|
||||
soundspec = {name = "default_eat", gain = 0.7}
|
||||
else
|
||||
sound = itemdef.sounds.eat
|
||||
soundspec = itemdef.sounds.eat
|
||||
end
|
||||
core.sound_play(sound.name, sound)
|
||||
core.sound_play(soundspec, {pos = user:getpos(), max_hear_distance = 8})
|
||||
|
||||
-- remove the item
|
||||
itemstack:take_item()
|
||||
|
|
|
@ -134,3 +134,11 @@ core.register_alias("wool:gold", "default:wool_yellow")
|
|||
core.register_alias("creatures:fried_egg", "food:fried_egg")
|
||||
core.register_alias("farming:bread", "food:roll")
|
||||
core.register_alias("farming:flour", "food:flour")
|
||||
|
||||
|
||||
--
|
||||
-- CME - removed sheep spawner
|
||||
--
|
||||
|
||||
core.register_alias("creatures:sheep_spawner", "default:stone")
|
||||
legacy.register_entity_remove("creatures:sheep_spawner_dummy")
|
||||
|
|
|
@ -29,3 +29,11 @@ function legacy.register_stair_replace(oldname, newname)
|
|||
end
|
||||
})
|
||||
end
|
||||
|
||||
function legacy.register_entity_remove(entityname)
|
||||
core.register_entity(":"..entityname, {
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:remove()
|
||||
end
|
||||
})
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue