Fix monster_attack and some other settings issues
parent
f4374d9efd
commit
148b30694f
|
@ -3,13 +3,7 @@ local mob_class_meta = {__index = mcl_mobs.mob_class}
|
||||||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||||
-- API for Mobs Redo: MineClone 2 Edition (MRM)
|
-- API for Mobs Redo: MineClone 2 Edition (MRM)
|
||||||
local MAX_MOB_NAME_LENGTH = 30
|
local MAX_MOB_NAME_LENGTH = 30
|
||||||
local HORNY_TIME = 30
|
|
||||||
local HORNY_AGAIN_TIME = 300
|
|
||||||
local CHILD_GROW_TIME = 60*20
|
|
||||||
local DEATH_DELAY = 0.5
|
|
||||||
local DEFAULT_FALL_SPEED = -9.81*1.5
|
local DEFAULT_FALL_SPEED = -9.81*1.5
|
||||||
local FLOP_HEIGHT = 6
|
|
||||||
local FLOP_HOR_SPEED = 1.5
|
|
||||||
|
|
||||||
local PATHFINDING = "gowp"
|
local PATHFINDING = "gowp"
|
||||||
|
|
||||||
|
@ -41,12 +35,9 @@ local function atan(x)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Load settings
|
-- Load settings
|
||||||
local damage_enabled = minetest.settings:get_bool("enable_damage")
|
|
||||||
local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
|
|
||||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
||||||
local remove_far = true
|
local remove_far = true
|
||||||
local show_health = false
|
|
||||||
-- Shows helpful debug info above each mob
|
-- Shows helpful debug info above each mob
|
||||||
local mobs_debug = minetest.settings:get_bool("mobs_debug", false)
|
local mobs_debug = minetest.settings:get_bool("mobs_debug", false)
|
||||||
local spawn_logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
|
local spawn_logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
|
||||||
|
@ -69,7 +60,6 @@ end
|
||||||
local node_ice = "mcl_core:ice"
|
local node_ice = "mcl_core:ice"
|
||||||
local node_snowblock = "mcl_core:snowblock"
|
local node_snowblock = "mcl_core:snowblock"
|
||||||
local node_snow = "mcl_core:snow"
|
local node_snow = "mcl_core:snow"
|
||||||
mcl_mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
|
|
||||||
|
|
||||||
minetest.register_chatcommand("clearmobs",{
|
minetest.register_chatcommand("clearmobs",{
|
||||||
privs={maphack=true},
|
privs={maphack=true},
|
||||||
|
@ -137,15 +127,11 @@ end
|
||||||
|
|
||||||
-- get node but use fallback for nil or unknown
|
-- get node but use fallback for nil or unknown
|
||||||
local node_ok = function(pos, fallback)
|
local node_ok = function(pos, fallback)
|
||||||
|
|
||||||
fallback = fallback or mcl_mobs.fallback_node
|
fallback = fallback or mcl_mobs.fallback_node
|
||||||
|
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
|
|
||||||
if node and minetest.registered_nodes[node.name] then
|
if node and minetest.registered_nodes[node.name] then
|
||||||
return node
|
return node
|
||||||
end
|
end
|
||||||
|
|
||||||
return minetest.registered_nodes[fallback]
|
return minetest.registered_nodes[fallback]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||||
local mob_class = mcl_mobs.mob_class
|
local mob_class = mcl_mobs.mob_class
|
||||||
|
|
||||||
|
local damage_enabled = minetest.settings:get_bool("enable_damage")
|
||||||
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
|
local show_health = false
|
||||||
-- pathfinding settings
|
-- pathfinding settings
|
||||||
local enable_pathfinding = true
|
local enable_pathfinding = true
|
||||||
local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching
|
local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||||
local mob_class = mcl_mobs.mob_class
|
local mob_class = mcl_mobs.mob_class
|
||||||
local active_particlespawners = {}
|
local active_particlespawners = {}
|
||||||
|
local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
|
||||||
local DEFAULT_FALL_SPEED = -9.81*1.5
|
local DEFAULT_FALL_SPEED = -9.81*1.5
|
||||||
|
|
||||||
local player_transfer_distance = tonumber(minetest.settings:get("player_transfer_distance")) or 128
|
local player_transfer_distance = tonumber(minetest.settings:get("player_transfer_distance")) or 128
|
||||||
|
|
|
@ -4,6 +4,7 @@ mcl_mobs.mob_class_meta = {__index = mcl_mobs.mob_class}
|
||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
local path = minetest.get_modpath(modname)
|
local path = minetest.get_modpath(modname)
|
||||||
local S = minetest.get_translator(modname)
|
local S = minetest.get_translator(modname)
|
||||||
|
mcl_mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
|
||||||
--api and helpers
|
--api and helpers
|
||||||
-- effects: sounds and particles mostly
|
-- effects: sounds and particles mostly
|
||||||
dofile(path .. "/effects.lua")
|
dofile(path .. "/effects.lua")
|
||||||
|
@ -28,9 +29,22 @@ dofile(path .. "/mount.lua")
|
||||||
dofile(path .. "/crafts.lua")
|
dofile(path .. "/crafts.lua")
|
||||||
dofile(path .. "/compat.lua")
|
dofile(path .. "/compat.lua")
|
||||||
|
|
||||||
|
local DEFAULT_FALL_SPEED = -9.81*1.5
|
||||||
|
local MAX_MOB_NAME_LENGTH = 30
|
||||||
|
|
||||||
local old_spawn_icons = minetest.settings:get_bool("mcl_old_spawn_icons",false)
|
local old_spawn_icons = minetest.settings:get_bool("mcl_old_spawn_icons",false)
|
||||||
local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0
|
local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0
|
||||||
|
|
||||||
|
-- get node but use fallback for nil or unknown
|
||||||
|
local node_ok = function(pos, fallback)
|
||||||
|
fallback = fallback or mcl_mobs.fallback_node
|
||||||
|
local node = minetest.get_node_or_nil(pos)
|
||||||
|
if node and minetest.registered_nodes[node.name] then
|
||||||
|
return node
|
||||||
|
end
|
||||||
|
return minetest.registered_nodes[fallback]
|
||||||
|
end
|
||||||
|
|
||||||
--#### REGISTER FUNCS
|
--#### REGISTER FUNCS
|
||||||
|
|
||||||
-- Code to execute before custom on_rightclick handling
|
-- Code to execute before custom on_rightclick handling
|
||||||
|
@ -301,7 +315,7 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
|
|
||||||
if not name or not def then return end -- errorcheck
|
if not name or not def then return end -- errorcheck
|
||||||
|
|
||||||
minetest.register_entity(name, setmetatable({
|
minetest.register_entity(name, {
|
||||||
|
|
||||||
physical = false,
|
physical = false,
|
||||||
visual = def.visual,
|
visual = def.visual,
|
||||||
|
@ -421,7 +435,7 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
|
|
||||||
self.lastpos = pos
|
self.lastpos = pos
|
||||||
end
|
end
|
||||||
},mob_class))
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Register spawn eggs
|
-- Register spawn eggs
|
||||||
|
|
|
@ -4,6 +4,17 @@ local DEFAULT_FALL_SPEED = -9.81*1.5
|
||||||
local FLOP_HEIGHT = 6
|
local FLOP_HEIGHT = 6
|
||||||
local FLOP_HOR_SPEED = 1.5
|
local FLOP_HOR_SPEED = 1.5
|
||||||
|
|
||||||
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
|
local atann = math.atan
|
||||||
|
local function atan(x)
|
||||||
|
if not x or x ~= x then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return atann(x)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- get node but use fallback for nil or unknown
|
-- get node but use fallback for nil or unknown
|
||||||
local node_ok = function(pos, fallback)
|
local node_ok = function(pos, fallback)
|
||||||
fallback = fallback or mcl_mobs.fallback_node
|
fallback = fallback or mcl_mobs.fallback_node
|
||||||
|
|
|
@ -2,6 +2,7 @@ local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||||
local mob_class = mcl_mobs.mob_class
|
local mob_class = mcl_mobs.mob_class
|
||||||
|
|
||||||
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_mobs_villager",false)
|
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_mobs_villager",false)
|
||||||
|
local PATHFINDING = "gowp"
|
||||||
|
|
||||||
local LOG_MODULE = "[Mobs]"
|
local LOG_MODULE = "[Mobs]"
|
||||||
local function mcl_log (message)
|
local function mcl_log (message)
|
||||||
|
|
Loading…
Reference in New Issue