mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 12:31:05 +01:00
Merge pull request 'Mobs Redo Part 1' (#2245) from mobs-redo-basic-cleanup into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2245
This commit is contained in:
commit
8210fba65b
67 changed files with 381 additions and 515 deletions
|
@ -78,7 +78,7 @@ function mcl_damage.from_punch(mcl_reason, object)
|
||||||
mcl_reason.type = "arrow"
|
mcl_reason.type = "arrow"
|
||||||
elseif luaentity._is_fireball then
|
elseif luaentity._is_fireball then
|
||||||
mcl_reason.type = "fireball"
|
mcl_reason.type = "fireball"
|
||||||
elseif luaentity._cmi_is_mob then
|
elseif luaentity.is_mob then
|
||||||
mcl_reason.type = "mob"
|
mcl_reason.type = "mob"
|
||||||
end
|
end
|
||||||
mcl_reason.source = mcl_reason.source or luaentity._source_object
|
mcl_reason.source = mcl_reason.source or luaentity._source_object
|
||||||
|
|
|
@ -524,7 +524,7 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
|
||||||
if luaentity.deal_damage then
|
if luaentity.deal_damage then
|
||||||
luaentity:deal_damage(damage, mcl_reason or {type = "generic"})
|
luaentity:deal_damage(damage, mcl_reason or {type = "generic"})
|
||||||
return
|
return
|
||||||
elseif luaentity._cmi_is_mob then
|
elseif luaentity.is_mob then
|
||||||
-- local puncher = mcl_reason and mcl_reason.direct or target
|
-- local puncher = mcl_reason and mcl_reason.direct or target
|
||||||
-- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage)
|
-- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage)
|
||||||
if luaentity.health > 0 then
|
if luaentity.health > 0 then
|
||||||
|
@ -544,7 +544,7 @@ end
|
||||||
function mcl_util.get_hp(obj)
|
function mcl_util.get_hp(obj)
|
||||||
local luaentity = obj:get_luaentity()
|
local luaentity = obj:get_luaentity()
|
||||||
|
|
||||||
if luaentity and luaentity._cmi_is_mob then
|
if luaentity and luaentity.is_mob then
|
||||||
return luaentity.health
|
return luaentity.health
|
||||||
else
|
else
|
||||||
return obj:get_hp()
|
return obj:get_hp()
|
||||||
|
|
|
@ -314,7 +314,7 @@ function boat.on_step(self, dtime, moveresult)
|
||||||
|
|
||||||
for _, obj in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1.3)) do
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if entity and entity._cmi_is_mob then
|
if entity and entity.is_mob then
|
||||||
attach_object(self, obj)
|
attach_object(self, obj)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
|
|
||||||
-- API for Mobs Redo: MineClone 2 Edition (MRM)
|
-- API for Mobs Redo: MineClone 2 Edition (MRM)
|
||||||
|
|
||||||
mobs = {}
|
mcl_mobs = {}
|
||||||
mobs.mod = "mrm"
|
|
||||||
mobs.version = "20210106" -- don't rely too much on this, rarely updated, if ever
|
|
||||||
|
|
||||||
local MAX_MOB_NAME_LENGTH = 30
|
local MAX_MOB_NAME_LENGTH = 30
|
||||||
local HORNY_TIME = 30
|
local HORNY_TIME = 30
|
||||||
|
@ -23,22 +21,8 @@ MOB_CAP.water = 15
|
||||||
-- Localize
|
-- Localize
|
||||||
local S = minetest.get_translator("mcl_mobs")
|
local S = minetest.get_translator("mcl_mobs")
|
||||||
|
|
||||||
-- CMI support check
|
|
||||||
local use_cmi = minetest.global_exists("cmi")
|
|
||||||
|
|
||||||
|
|
||||||
-- Invisibility mod check
|
-- Invisibility mod check
|
||||||
mobs.invis = {}
|
mcl_mobs.invis = {}
|
||||||
if minetest.global_exists("invisibility") then
|
|
||||||
mobs.invis = invisibility
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- creative check
|
|
||||||
function mobs.is_creative(name)
|
|
||||||
return minetest.is_creative_enabled(name)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- localize math functions
|
-- localize math functions
|
||||||
local pi = math.pi
|
local pi = math.pi
|
||||||
|
@ -50,6 +34,7 @@ local max = math.max
|
||||||
local atann = math.atan
|
local atann = math.atan
|
||||||
local random = math.random
|
local random = math.random
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
|
|
||||||
local atan = function(x)
|
local atan = function(x)
|
||||||
if not x or x ~= x then
|
if not x or x ~= x then
|
||||||
return 0
|
return 0
|
||||||
|
@ -91,20 +76,8 @@ local stuck_path_timeout = 10 -- how long will mob follow path before giving up
|
||||||
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"
|
||||||
mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
|
mcl_mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt"
|
||||||
|
|
||||||
local mod_weather = minetest.get_modpath("mcl_weather") ~= nil
|
|
||||||
local mod_explosions = minetest.get_modpath("mcl_explosions") ~= nil
|
|
||||||
local mod_mobspawners = minetest.get_modpath("mcl_mobspawners") ~= nil
|
|
||||||
local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil
|
|
||||||
local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil
|
|
||||||
local mod_armor = minetest.get_modpath("mcl_armor") ~= nil
|
|
||||||
local mod_experience = minetest.get_modpath("mcl_experience") ~= nil
|
|
||||||
|
|
||||||
--Helper function to clear all mobs because /clearobjects removes too much
|
|
||||||
local function is_mob(o)
|
|
||||||
return o.type == "ambient" or o.type == "animal" or o.type == "monster" or o.type == "npc"
|
|
||||||
end
|
|
||||||
minetest.register_chatcommand("clearmobs",{
|
minetest.register_chatcommand("clearmobs",{
|
||||||
privs={maphack=true},
|
privs={maphack=true},
|
||||||
params = "<all>|<nametagged>|<range>",
|
params = "<all>|<nametagged>|<range>",
|
||||||
|
@ -113,7 +86,7 @@ minetest.register_chatcommand("clearmobs",{
|
||||||
local p = minetest.get_player_by_name(n)
|
local p = minetest.get_player_by_name(n)
|
||||||
local num=tonumber(param)
|
local num=tonumber(param)
|
||||||
for _,o in pairs(minetest.luaentities) do
|
for _,o in pairs(minetest.luaentities) do
|
||||||
if is_mob(o) then
|
if o.is_mob then
|
||||||
if param == "all" or
|
if param == "all" or
|
||||||
( param == "nametagged" and o.nametag ) or
|
( param == "nametagged" and o.nametag ) or
|
||||||
( param == "" and not o.nametag and not o.tamed ) or
|
( param == "" and not o.nametag and not o.tamed ) or
|
||||||
|
@ -199,7 +172,7 @@ local function object_in_range(self, object)
|
||||||
end
|
end
|
||||||
local factor
|
local factor
|
||||||
-- Apply view range reduction for special player armor
|
-- Apply view range reduction for special player armor
|
||||||
if object:is_player() and mod_armor then
|
if object:is_player() then
|
||||||
local factors = mcl_armor.player_view_range_factors[object]
|
local factors = mcl_armor.player_view_range_factors[object]
|
||||||
factor = factors and factors[self.name]
|
factor = factors and factors[self.name]
|
||||||
end
|
end
|
||||||
|
@ -246,7 +219,7 @@ local collision = function(self)
|
||||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||||
|
|
||||||
local ent = object:get_luaentity()
|
local ent = object:get_luaentity()
|
||||||
if object:is_player() or (ent and ent._cmi_is_mob and object ~= self.object) then
|
if object:is_player() or (ent and ent.is_mob and object ~= self.object) then
|
||||||
|
|
||||||
local pos2 = object:get_pos()
|
local pos2 = object:get_pos()
|
||||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||||
|
@ -353,7 +326,7 @@ local set_yaw = function(self, yaw, delay, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- global function to set mob yaw
|
-- global function to set mob yaw
|
||||||
function mobs:yaw(self, yaw, delay, dtime)
|
function mcl_mobs:yaw(self, yaw, delay, dtime)
|
||||||
set_yaw(self, yaw, delay, dtime)
|
set_yaw(self, yaw, delay, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -424,7 +397,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- above function exported for mount.lua
|
-- above function exported for mount.lua
|
||||||
function mobs:set_animation(self, anim)
|
function mcl_mobs:set_animation(self, anim)
|
||||||
set_animation(self, anim)
|
set_animation(self, anim)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -628,7 +601,7 @@ local damage_effect = function(self, damage)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mobs.death_effect = function(pos, yaw, collisionbox, rotate)
|
mcl_mobs.death_effect = function(pos, yaw, collisionbox, rotate)
|
||||||
local min, max
|
local min, max
|
||||||
if collisionbox then
|
if collisionbox then
|
||||||
min = {x=collisionbox[1], y=collisionbox[2], z=collisionbox[3]}
|
min = {x=collisionbox[1], y=collisionbox[2], z=collisionbox[3]}
|
||||||
|
@ -842,7 +815,7 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
local looting = mcl_enchanting.get_enchantment(wielditem, "looting")
|
local looting = mcl_enchanting.get_enchantment(wielditem, "looting")
|
||||||
item_drop(self, cooked, looting)
|
item_drop(self, cooked, looting)
|
||||||
|
|
||||||
if mod_experience and ((not self.child) or self.type ~= "animal") and (minetest.get_us_time() - self.xp_timestamp <= 5000000) then
|
if ((not self.child) or self.type ~= "animal") and (minetest.get_us_time() - self.xp_timestamp <= 5000000) then
|
||||||
mcl_experience.throw_xp(self.object:get_pos(), math.random(self.xp_min, self.xp_max))
|
mcl_experience.throw_xp(self.object:get_pos(), math.random(self.xp_min, self.xp_max))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -857,10 +830,6 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
death_handle(self)
|
death_handle(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
if use_cmi then
|
|
||||||
cmi.notify_die(self.object, cmi_cause)
|
|
||||||
end
|
|
||||||
|
|
||||||
if on_die_exit == true then
|
if on_die_exit == true then
|
||||||
self.state = "die"
|
self.state = "die"
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
|
@ -920,9 +889,6 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
if not self.object:get_luaentity() then
|
if not self.object:get_luaentity() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if use_cmi then
|
|
||||||
cmi.notify_die(self.object, cmi_cause)
|
|
||||||
end
|
|
||||||
|
|
||||||
death_handle(self)
|
death_handle(self)
|
||||||
local dpos = self.object:get_pos()
|
local dpos = self.object:get_pos()
|
||||||
|
@ -930,7 +896,7 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
local yaw = self.object:get_rotation().y
|
local yaw = self.object:get_rotation().y
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
mobs.death_effect(dpos, yaw, cbox, not self.instant_death)
|
mcl_mobs.death_effect(dpos, yaw, cbox, not self.instant_death)
|
||||||
end
|
end
|
||||||
if length <= 0 then
|
if length <= 0 then
|
||||||
kill(self)
|
kill(self)
|
||||||
|
@ -1042,7 +1008,7 @@ 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 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)
|
||||||
|
|
||||||
|
@ -1093,7 +1059,7 @@ local do_env_damage = function(self)
|
||||||
|
|
||||||
-- Deal light damage to mob, returns true if mob died
|
-- Deal light damage to mob, returns true if mob died
|
||||||
local deal_light_damage = function(self, pos, damage)
|
local deal_light_damage = function(self, pos, damage)
|
||||||
if not (mod_weather and (mcl_weather.rain.raining or mcl_weather.state == "snow") and mcl_weather.is_outdoor(pos)) then
|
if not ((mcl_weather.rain.raining or mcl_weather.state == "snow") and mcl_weather.is_outdoor(pos)) then
|
||||||
self.health = self.health - damage
|
self.health = self.health - damage
|
||||||
|
|
||||||
effect(pos, 5, "mcl_particles_smoke.png")
|
effect(pos, 5, "mcl_particles_smoke.png")
|
||||||
|
@ -1114,10 +1080,7 @@ local do_env_damage = function(self)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local _, dim = nil, "overworld"
|
local _, dim = mcl_worlds.y_to_layer(pos.y)
|
||||||
if mod_worlds then
|
|
||||||
_, dim = mcl_worlds.y_to_layer(pos.y)
|
|
||||||
end
|
|
||||||
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (sunlight or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (sunlight or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
||||||
if self.ignited_by_sunlight then
|
if self.ignited_by_sunlight then
|
||||||
mcl_burning.set_on_fire(self.object, 10)
|
mcl_burning.set_on_fire(self.object, 10)
|
||||||
|
@ -1147,7 +1110,7 @@ local do_env_damage = function(self)
|
||||||
local nodef = minetest.registered_nodes[self.standing_in]
|
local nodef = minetest.registered_nodes[self.standing_in]
|
||||||
|
|
||||||
-- rain
|
-- rain
|
||||||
if self.rain_damage > 0 and mod_weather then
|
if self.rain_damage > 0 then
|
||||||
if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then
|
if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then
|
||||||
|
|
||||||
self.health = self.health - self.rain_damage
|
self.health = self.health - self.rain_damage
|
||||||
|
@ -1440,7 +1403,7 @@ end
|
||||||
local follow_holding = function(self, clicker)
|
local follow_holding = function(self, clicker)
|
||||||
if self.nofollow then return false end
|
if self.nofollow then return false end
|
||||||
|
|
||||||
if mobs.invis[clicker:get_player_name()] then
|
if mcl_mobs.invis[clicker:get_player_name()] then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1578,10 +1541,7 @@ local breed = function(self)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Give XP
|
mcl_experience.throw_xp(pos, math.random(1, 7))
|
||||||
if mod_experience then
|
|
||||||
mcl_experience.throw_xp(pos, math.random(1, 7))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- custom breed function
|
-- custom breed function
|
||||||
if parent1.on_breed then
|
if parent1.on_breed then
|
||||||
|
@ -1591,7 +1551,7 @@ local breed = function(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local child = mobs:spawn_child(pos, parent1.name)
|
local child = mcl_mobs:spawn_child(pos, parent1.name)
|
||||||
|
|
||||||
local ent_c = child:get_luaentity()
|
local ent_c = child:get_luaentity()
|
||||||
|
|
||||||
|
@ -1827,7 +1787,7 @@ local smart_mobs = function(self, s, p, dist, dtime)
|
||||||
|
|
||||||
if ndef1 and (ndef1.buildable_to or ndef1.groups.liquid) then
|
if ndef1 and (ndef1.buildable_to or ndef1.groups.liquid) then
|
||||||
|
|
||||||
minetest.set_node(s, {name = mobs.fallback_node})
|
minetest.set_node(s, {name = mcl_mobs.fallback_node})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1962,7 +1922,7 @@ local monster_attack = function(self)
|
||||||
|
|
||||||
if objs[n]:is_player() then
|
if objs[n]:is_player() then
|
||||||
|
|
||||||
if mobs.invis[ objs[n]:get_player_name() ] or (not object_in_range(self, objs[n])) then
|
if mcl_mobs.invis[ objs[n]:get_player_name() ] or (not object_in_range(self, objs[n])) then
|
||||||
type = ""
|
type = ""
|
||||||
else
|
else
|
||||||
player = objs[n]
|
player = objs[n]
|
||||||
|
@ -2091,7 +2051,7 @@ local runaway_from = function(self)
|
||||||
|
|
||||||
if objs[n]:is_player() then
|
if objs[n]:is_player() then
|
||||||
|
|
||||||
if mobs.invis[ objs[n]:get_player_name() ]
|
if mcl_mobs.invis[ objs[n]:get_player_name() ]
|
||||||
or self.owner == objs[n]:get_player_name()
|
or self.owner == objs[n]:get_player_name()
|
||||||
or (not object_in_range(self, objs[n])) then
|
or (not object_in_range(self, objs[n])) then
|
||||||
type = ""
|
type = ""
|
||||||
|
@ -2173,7 +2133,7 @@ local follow_flop = function(self)
|
||||||
for n = 1, #players do
|
for n = 1, #players do
|
||||||
|
|
||||||
if (object_in_range(self, players[n]))
|
if (object_in_range(self, players[n]))
|
||||||
and not mobs.invis[ players[n]:get_player_name() ] then
|
and not mcl_mobs.invis[ players[n]:get_player_name() ] then
|
||||||
|
|
||||||
self.following = players[n]
|
self.following = players[n]
|
||||||
|
|
||||||
|
@ -2330,7 +2290,7 @@ local function go_to_pos(entity,b)
|
||||||
if b.x > s.x then yaw = yaw + math.pi end
|
if b.x > s.x then yaw = yaw + math.pi end
|
||||||
entity.object:set_yaw(yaw)
|
entity.object:set_yaw(yaw)
|
||||||
set_velocity(entity,entity.follow_velocity)
|
set_velocity(entity,entity.follow_velocity)
|
||||||
mobs:set_animation(entity, "walk")
|
mcl_mobs:set_animation(entity, "walk")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_doors(self)
|
local function check_doors(self)
|
||||||
|
@ -2576,7 +2536,7 @@ local do_states = function(self, dtime)
|
||||||
or not self.attack:get_pos()
|
or not self.attack:get_pos()
|
||||||
or not object_in_range(self, self.attack)
|
or not object_in_range(self, self.attack)
|
||||||
or self.attack:get_hp() <= 0
|
or self.attack:get_hp() <= 0
|
||||||
or (self.attack:is_player() and mobs.invis[ self.attack:get_player_name() ]) then
|
or (self.attack:is_player() and mcl_mobs.invis[ self.attack:get_player_name() ]) then
|
||||||
|
|
||||||
self.state = "stand"
|
self.state = "stand"
|
||||||
set_velocity(self, 0)
|
set_velocity(self, 0)
|
||||||
|
@ -2667,7 +2627,6 @@ local do_states = function(self, dtime)
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
if mod_explosions then
|
|
||||||
if mobs_griefing and not minetest.is_protected(pos, "") then
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
mcl_explosions.explode(mcl_util.get_object_center(self.object), self.explosion_strength, { drop_chance = 1.0 }, self.object)
|
mcl_explosions.explode(mcl_util.get_object_center(self.object), self.explosion_strength, { drop_chance = 1.0 }, self.object)
|
||||||
else
|
else
|
||||||
|
@ -2680,7 +2639,6 @@ local do_states = function(self, dtime)
|
||||||
entity_physics(pos, entity_damage_radius)
|
entity_physics(pos, entity_damage_radius)
|
||||||
effect(pos, 32, "mcl_particles_smoke.png", nil, nil, node_break_radius, 1, 0)
|
effect(pos, 32, "mcl_particles_smoke.png", nil, nil, node_break_radius, 1, 0)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
|
@ -2948,7 +2906,7 @@ local plane_adjacents = {
|
||||||
vector.new(0,0,-1),
|
vector.new(0,0,-1),
|
||||||
}
|
}
|
||||||
|
|
||||||
function mobs:gopath(self,target,callback_arrived)
|
function mcl_mobs:gopath(self,target,callback_arrived)
|
||||||
local p = self.object:get_pos()
|
local p = self.object:get_pos()
|
||||||
local t = vector.offset(target,0,1,0)
|
local t = vector.offset(target,0,1,0)
|
||||||
local wp = minetest.find_path(p,t,150,1,4)
|
local wp = minetest.find_path(p,t,150,1,4)
|
||||||
|
@ -3137,7 +3095,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
local punch_interval = 1.4
|
local punch_interval = 1.4
|
||||||
|
|
||||||
-- exhaust attacker
|
-- exhaust attacker
|
||||||
if mod_hunger and is_player then
|
if is_player then
|
||||||
mcl_hunger.exhaust(hitter:get_player_name(), mcl_hunger.EXHAUST_ATTACK)
|
mcl_hunger.exhaust(hitter:get_player_name(), mcl_hunger.EXHAUST_ATTACK)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3151,23 +3109,19 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
tflp = 0.2
|
tflp = 0.2
|
||||||
end
|
end
|
||||||
|
|
||||||
if use_cmi then
|
|
||||||
damage = cmi.calculate_damage(self.object, hitter, tflp, tool_capabilities, dir)
|
|
||||||
else
|
|
||||||
|
|
||||||
for group,_ in pairs( (tool_capabilities.damage_groups or {}) ) do
|
for group,_ in pairs( (tool_capabilities.damage_groups or {}) ) do
|
||||||
|
|
||||||
tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
|
tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
|
||||||
|
|
||||||
if tmp < 0 then
|
if tmp < 0 then
|
||||||
tmp = 0.0
|
tmp = 0.0
|
||||||
elseif tmp > 1 then
|
elseif tmp > 1 then
|
||||||
tmp = 1.0
|
tmp = 1.0
|
||||||
end
|
|
||||||
|
|
||||||
damage = damage + (tool_capabilities.damage_groups[group] or 0)
|
|
||||||
* tmp * ((armor[group] or 0) / 100.0)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
damage = damage + (tool_capabilities.damage_groups[group] or 0)
|
||||||
|
* tmp * ((armor[group] or 0) / 100.0)
|
||||||
end
|
end
|
||||||
|
|
||||||
if weapon then
|
if weapon then
|
||||||
|
@ -3193,13 +3147,6 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if use_cmi then
|
|
||||||
|
|
||||||
local cancel = cmi.notify_punch(self.object, hitter, tflp, tool_capabilities, dir, damage)
|
|
||||||
|
|
||||||
if cancel then return end
|
|
||||||
end
|
|
||||||
|
|
||||||
if tool_capabilities then
|
if tool_capabilities then
|
||||||
punch_interval = tool_capabilities.full_punch_interval or 1.4
|
punch_interval = tool_capabilities.full_punch_interval or 1.4
|
||||||
end
|
end
|
||||||
|
@ -3333,7 +3280,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
and self.state ~= "flop"
|
and self.state ~= "flop"
|
||||||
and (self.child == false or self.type == "monster")
|
and (self.child == false or self.type == "monster")
|
||||||
and hitter:get_player_name() ~= self.owner
|
and hitter:get_player_name() ~= self.owner
|
||||||
and not mobs.invis[ name ] then
|
and not mcl_mobs.invis[ name ] then
|
||||||
|
|
||||||
if not die then
|
if not die then
|
||||||
-- attack whoever punched mob
|
-- attack whoever punched mob
|
||||||
|
@ -3407,10 +3354,6 @@ local mob_staticdata = function(self)
|
||||||
self.following = nil
|
self.following = nil
|
||||||
self.state = "stand"
|
self.state = "stand"
|
||||||
|
|
||||||
if use_cmi then
|
|
||||||
self.serialized_cmi_components = cmi.serialize_components(self._cmi_components)
|
|
||||||
end
|
|
||||||
|
|
||||||
local tmp = {}
|
local tmp = {}
|
||||||
|
|
||||||
for _,stat in pairs(self) do
|
for _,stat in pairs(self) do
|
||||||
|
@ -3588,11 +3531,6 @@ local mob_activate = function(self, staticdata, def, dtime)
|
||||||
if def.after_activate then
|
if def.after_activate then
|
||||||
def.after_activate(self, staticdata, def, dtime)
|
def.after_activate(self, staticdata, def, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
if use_cmi then
|
|
||||||
self._cmi_components = cmi.activate_components(self.serialized_cmi_components)
|
|
||||||
cmi.notify_activate(self.object, dtime)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -3603,10 +3541,6 @@ local mob_step = function(self, dtime)
|
||||||
mcl_burning.tick(self.object, dtime, self)
|
mcl_burning.tick(self.object, dtime, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
if use_cmi then
|
|
||||||
cmi.notify_step(self.object, dtime)
|
|
||||||
end
|
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local yaw = 0
|
local yaw = 0
|
||||||
|
|
||||||
|
@ -3841,7 +3775,7 @@ local do_tnt = function(obj, damage)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
mobs.spawning_mobs = {}
|
mcl_mobs.spawning_mobs = {}
|
||||||
|
|
||||||
-- Code to execute before custom on_rightclick handling
|
-- Code to execute before custom on_rightclick handling
|
||||||
local on_rightclick_prefix = function(self, clicker)
|
local on_rightclick_prefix = function(self, clicker)
|
||||||
|
@ -3859,7 +3793,7 @@ local on_rightclick_prefix = function(self, clicker)
|
||||||
|
|
||||||
update_tag(self)
|
update_tag(self)
|
||||||
|
|
||||||
if not mobs.is_creative(clicker:get_player_name()) then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
clicker:set_wielded_item(item)
|
clicker:set_wielded_item(item)
|
||||||
end
|
end
|
||||||
|
@ -3880,9 +3814,9 @@ local create_mob_on_rightclick = function(on_rightclick)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- register mob entity
|
-- register mob entity
|
||||||
function mobs:register_mob(name, def)
|
function mcl_mobs:register_mob(name, def)
|
||||||
|
|
||||||
mobs.spawning_mobs[name] = true
|
mcl_mobs.spawning_mobs[name] = true
|
||||||
|
|
||||||
local can_despawn
|
local can_despawn
|
||||||
if def.can_despawn ~= nil then
|
if def.can_despawn ~= nil then
|
||||||
|
@ -4013,7 +3947,7 @@ minetest.register_entity(name, {
|
||||||
runaway_from = def.runaway_from,
|
runaway_from = def.runaway_from,
|
||||||
owner_loyal = def.owner_loyal,
|
owner_loyal = def.owner_loyal,
|
||||||
facing_fence = false,
|
facing_fence = false,
|
||||||
_cmi_is_mob = true,
|
is_mob = true,
|
||||||
pushable = def.pushable or true,
|
pushable = def.pushable or true,
|
||||||
|
|
||||||
|
|
||||||
|
@ -4061,6 +3995,7 @@ minetest.register_entity(name, {
|
||||||
--this is a temporary hack so mobs stop
|
--this is a temporary hack so mobs stop
|
||||||
--glitching and acting really weird with the
|
--glitching and acting really weird with the
|
||||||
--default built in engine collision detection
|
--default built in engine collision detection
|
||||||
|
self.is_mob = true
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
collide_with_objects = false,
|
collide_with_objects = false,
|
||||||
})
|
})
|
||||||
|
@ -4079,11 +4014,11 @@ if minetest.get_modpath("doc_identifier") ~= nil then
|
||||||
doc.sub.identifier.register_object(name, "basics", "mobs")
|
doc.sub.identifier.register_object(name, "basics", "mobs")
|
||||||
end
|
end
|
||||||
|
|
||||||
end -- END mobs:register_mob function
|
end -- END mcl_mobs:register_mob function
|
||||||
|
|
||||||
|
|
||||||
-- register arrow for shoot attack
|
-- register arrow for shoot attack
|
||||||
function mobs:register_arrow(name, def)
|
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
|
||||||
|
|
||||||
|
@ -4185,7 +4120,7 @@ function mobs:register_arrow(name, def)
|
||||||
|
|
||||||
if entity
|
if entity
|
||||||
and self.hit_mob
|
and self.hit_mob
|
||||||
and entity._cmi_is_mob == true
|
and entity.is_mob == true
|
||||||
and tostring(player) ~= self.owner_id
|
and tostring(player) ~= self.owner_id
|
||||||
and entity.name ~= self.object:get_luaentity().name then
|
and entity.name ~= self.object:get_luaentity().name then
|
||||||
self.hit_mob(self, player)
|
self.hit_mob(self, player)
|
||||||
|
@ -4195,7 +4130,7 @@ function mobs:register_arrow(name, def)
|
||||||
|
|
||||||
if entity
|
if entity
|
||||||
and self.hit_object
|
and self.hit_object
|
||||||
and (not entity._cmi_is_mob)
|
and (not entity.is_mob)
|
||||||
and tostring(player) ~= self.owner_id
|
and tostring(player) ~= self.owner_id
|
||||||
and entity.name ~= self.object:get_luaentity().name then
|
and entity.name ~= self.object:get_luaentity().name then
|
||||||
self.hit_object(self, player)
|
self.hit_object(self, player)
|
||||||
|
@ -4212,7 +4147,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- no damage to nodes explosion
|
-- no damage to nodes explosion
|
||||||
function mobs:safe_boom(self, pos, strength)
|
function mcl_mobs:safe_boom(self, pos, strength)
|
||||||
minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", {
|
minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
gain = 1.0,
|
gain = 1.0,
|
||||||
|
@ -4225,15 +4160,11 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- make explosion with protection and tnt mod check
|
-- make explosion with protection and tnt mod check
|
||||||
function mobs:boom(self, pos, strength, fire)
|
function mcl_mobs:boom(self, pos, strength, fire)
|
||||||
if mod_explosions then
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
if mobs_griefing and not minetest.is_protected(pos, "") then
|
mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object)
|
||||||
mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object)
|
|
||||||
else
|
|
||||||
mobs:safe_boom(self, pos, strength)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
mobs:safe_boom(self, pos, strength)
|
mcl_mobs:safe_boom(self, pos, strength)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- delete the object after it punched the player to avoid nil entities in e.g. mcl_shields!!
|
-- delete the object after it punched the player to avoid nil entities in e.g. mcl_shields!!
|
||||||
|
@ -4246,7 +4177,7 @@ end
|
||||||
-- Note: This also introduces the “spawn_egg” group:
|
-- Note: This also introduces the “spawn_egg” group:
|
||||||
-- * spawn_egg=1: Spawn egg (generic mob, no metadata)
|
-- * spawn_egg=1: Spawn egg (generic mob, no metadata)
|
||||||
-- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata)
|
-- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata)
|
||||||
function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
function mcl_mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
|
|
||||||
local grp = {spawn_egg = 1}
|
local grp = {spawn_egg = 1}
|
||||||
|
|
||||||
|
@ -4289,7 +4220,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
|
|
||||||
local name = placer:get_player_name()
|
local name = placer:get_player_name()
|
||||||
local privs = minetest.get_player_privs(name)
|
local privs = minetest.get_player_privs(name)
|
||||||
if mod_mobspawners and under.name == "mcl_mobspawners:spawner" then
|
if under.name == "mcl_mobspawners:spawner" then
|
||||||
if minetest.is_protected(pointed_thing.under, name) then
|
if minetest.is_protected(pointed_thing.under, name) then
|
||||||
minetest.record_protection_violation(pointed_thing.under, name)
|
minetest.record_protection_violation(pointed_thing.under, name)
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -4299,7 +4230,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name())
|
mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name())
|
||||||
if not mobs.is_creative(name) then
|
if not minetest.is_creative_enabled(name) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -4339,7 +4270,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if not in creative then take item
|
-- if not in creative then take item
|
||||||
if not mobs.is_creative(placer:get_player_name()) then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4353,19 +4284,19 @@ end
|
||||||
|
|
||||||
-- No-op in MCL2 (capturing mobs is not possible).
|
-- No-op in MCL2 (capturing mobs is not possible).
|
||||||
-- Provided for compability with Mobs Redo
|
-- Provided for compability with Mobs Redo
|
||||||
function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith)
|
function mcl_mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- No-op in MCL2 (protecting mobs is not possible).
|
-- No-op in MCL2 (protecting mobs is not possible).
|
||||||
function mobs:protect(self, clicker)
|
function mcl_mobs:protect(self, clicker)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- feeding, taming and breeding (thanks blert2112)
|
-- feeding, taming and breeding (thanks blert2112)
|
||||||
function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
||||||
if not self.follow then
|
if not self.follow then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -4374,7 +4305,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
||||||
if self.nofollow or follow_holding(self, clicker) then
|
if self.nofollow or follow_holding(self, clicker) then
|
||||||
|
|
||||||
-- if not in creative then take item
|
-- if not in creative then take item
|
||||||
if not mobs.is_creative(clicker:get_player_name()) then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
|
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
|
|
||||||
|
@ -4440,7 +4371,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spawn a child
|
-- Spawn a child
|
||||||
function mobs:spawn_child(pos, mob_type)
|
function mcl_mobs:spawn_child(pos, mob_type)
|
||||||
local child = minetest.add_entity(pos, mob_type)
|
local child = minetest.add_entity(pos, mob_type)
|
||||||
if not child then
|
if not child then
|
||||||
return
|
return
|
||||||
|
@ -4487,7 +4418,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- compatibility function for old entities to new modpack entities
|
-- compatibility function for old entities to new modpack entities
|
||||||
function mobs:alias_mob(old_name, new_name)
|
function mcl_mobs:alias_mob(old_name, new_name)
|
||||||
|
|
||||||
-- spawn egg
|
-- spawn egg
|
||||||
minetest.register_alias(old_name, new_name)
|
minetest.register_alias(old_name, new_name)
|
||||||
|
@ -4518,7 +4449,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 47)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 47)) do
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if lua and lua._cmi_is_mob then
|
if lua and lua.is_mob then
|
||||||
lua.lifetimer = math.max(20, lua.lifetimer)
|
lua.lifetimer = math.max(20, lua.lifetimer)
|
||||||
lua.despawn_immediately = false
|
lua.despawn_immediately = false
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ local crash_threshold = 6.5 -- ignored if enable_crash=false
|
||||||
|
|
||||||
local node_ok = function(pos, fallback)
|
local node_ok = function(pos, fallback)
|
||||||
|
|
||||||
fallback = fallback or 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)
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ end)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
function mobs.attach(entity, player)
|
function mcl_mobs.attach(entity, player)
|
||||||
|
|
||||||
local attach_at, eye_offset
|
local attach_at, eye_offset
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ function mobs.attach(entity, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function mobs.detach(player, offset)
|
function mcl_mobs.detach(player, offset)
|
||||||
|
|
||||||
force_detach(player)
|
force_detach(player)
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ function mobs.detach(player, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
function mcl_mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
||||||
|
|
||||||
local rot_view = 0
|
local rot_view = 0
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
||||||
if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||||
|
|
||||||
if stand_anim then
|
if stand_anim then
|
||||||
mobs:set_animation(entity, stand_anim)
|
mcl_mobs:set_animation(entity, stand_anim)
|
||||||
end
|
end
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -269,7 +269,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
||||||
|
|
||||||
-- set moving animation
|
-- set moving animation
|
||||||
if moving_anim then
|
if moving_anim then
|
||||||
mobs:set_animation(entity, moving_anim)
|
mcl_mobs:set_animation(entity, moving_anim)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Stop!
|
-- Stop!
|
||||||
|
@ -388,7 +388,7 @@ end
|
||||||
|
|
||||||
-- directional flying routine by D00Med (edited by TenPlus1)
|
-- directional flying routine by D00Med (edited by TenPlus1)
|
||||||
|
|
||||||
function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
|
function mcl_mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
|
||||||
|
|
||||||
local ctrl = entity.driver:get_player_control()
|
local ctrl = entity.driver:get_player_control()
|
||||||
local velo = entity.object:get_velocity()
|
local velo = entity.object:get_velocity()
|
||||||
|
@ -440,9 +440,9 @@ function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
|
||||||
-- change animation if stopped
|
-- change animation if stopped
|
||||||
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||||
|
|
||||||
mobs:set_animation(entity, stand_anim)
|
mcl_mobs:set_animation(entity, stand_anim)
|
||||||
else
|
else
|
||||||
-- moving animation
|
-- moving animation
|
||||||
mobs:set_animation(entity, moving_anim)
|
mcl_mobs:set_animation(entity, moving_anim)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -195,7 +195,7 @@ local list_of_all_biomes = {
|
||||||
local function count_mobs(pos)
|
local function count_mobs(pos)
|
||||||
local num = 0
|
local num = 0
|
||||||
for _,object in pairs(get_objects_inside_radius(pos, aoc_range)) do
|
for _,object in pairs(get_objects_inside_radius(pos, aoc_range)) do
|
||||||
if object and object:get_luaentity() and object:get_luaentity()._cmi_is_mob then
|
if object and object:get_luaentity() and object:get_luaentity().is_mob then
|
||||||
num = num + 1
|
num = num + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -205,7 +205,7 @@ end
|
||||||
|
|
||||||
-- global functions
|
-- global functions
|
||||||
|
|
||||||
function mobs:spawn_abm_check(pos, node, name)
|
function mcl_mobs:spawn_abm_check(pos, node, name)
|
||||||
-- global function to add additional spawn checks
|
-- global function to add additional spawn checks
|
||||||
-- return true to stop spawning mob
|
-- return true to stop spawning mob
|
||||||
end
|
end
|
||||||
|
@ -241,7 +241,7 @@ WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua??
|
||||||
local spawn_dictionary = {}
|
local spawn_dictionary = {}
|
||||||
local summary_chance = 0
|
local summary_chance = 0
|
||||||
|
|
||||||
function mobs:spawn_setup(def)
|
function mcl_mobs:spawn_setup(def)
|
||||||
if not mobs_spawn then return end
|
if not mobs_spawn then return end
|
||||||
|
|
||||||
if not def then
|
if not def then
|
||||||
|
@ -275,10 +275,10 @@ function mobs:spawn_setup(def)
|
||||||
chance = tonumber(numbers[1]) or chance
|
chance = tonumber(numbers[1]) or chance
|
||||||
aoc = tonumber(numbers[2]) or aoc
|
aoc = tonumber(numbers[2]) or aoc
|
||||||
if chance == 0 then
|
if chance == 0 then
|
||||||
minetest.log("warning", string.format("[mobs] %s has spawning disabled", name))
|
minetest.log("warning", string.format("[mcl_mobs] %s has spawning disabled", name))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.log("action", string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc))
|
minetest.log("action", string.format("[mcl_mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc))
|
||||||
end
|
end
|
||||||
|
|
||||||
if chance < 1 then
|
if chance < 1 then
|
||||||
|
@ -304,7 +304,7 @@ function mobs:spawn_setup(def)
|
||||||
summary_chance = summary_chance + chance
|
summary_chance = summary_chance + chance
|
||||||
end
|
end
|
||||||
|
|
||||||
function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn)
|
function mcl_mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn)
|
||||||
|
|
||||||
-- Do mobs spawn at all?
|
-- Do mobs spawn at all?
|
||||||
if not mobs_spawn then
|
if not mobs_spawn then
|
||||||
|
@ -320,11 +320,11 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh
|
||||||
aoc = tonumber(numbers[2]) or aoc
|
aoc = tonumber(numbers[2]) or aoc
|
||||||
|
|
||||||
if chance == 0 then
|
if chance == 0 then
|
||||||
minetest.log("warning", string.format("[mobs] %s has spawning disabled", name))
|
minetest.log("warning", string.format("[mcl_mobs] %s has spawning disabled", name))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.log("action", string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc))
|
minetest.log("action", string.format("[mcl_mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc))
|
||||||
end
|
end
|
||||||
|
|
||||||
--load information into the spawn dictionary
|
--load information into the spawn dictionary
|
||||||
|
|
|
@ -215,55 +215,6 @@ mobs_mc.replace = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- List of nodes which endermen can take
|
|
||||||
mobs_mc.enderman_takable = {
|
|
||||||
-- Generic handling, useful for entensions
|
|
||||||
"group:enderman_takable",
|
|
||||||
|
|
||||||
-- Generic nodes
|
|
||||||
"group:sand",
|
|
||||||
"group:flower",
|
|
||||||
|
|
||||||
-- Minetest Game
|
|
||||||
"default:dirt",
|
|
||||||
"default:dirt_with_grass",
|
|
||||||
"default:dirt_with_dry_grass",
|
|
||||||
"default:dirt_with_snow",
|
|
||||||
"default:dirt_with_rainforest_litter",
|
|
||||||
"default:dirt_with_grass_footsteps",
|
|
||||||
-- FIXME: For some reason, Minetest has a Lua error when an enderman tries to place a Minetest Game cactus.
|
|
||||||
-- Maybe this is because default:cactus has rotate_and_place?
|
|
||||||
-- "default:cactus", -- TODO: Re-enable cactus when it works again
|
|
||||||
"default:gravel",
|
|
||||||
"default:clay",
|
|
||||||
"flowers:mushroom_red",
|
|
||||||
"flowers:mushroom_brown",
|
|
||||||
"tnt:tnt",
|
|
||||||
|
|
||||||
-- Nether mod
|
|
||||||
"nether:rack",
|
|
||||||
}
|
|
||||||
|
|
||||||
--[[ Table of nodes to replace when an enderman takes it.
|
|
||||||
If the enderman takes an indexed node, it the enderman will get the item in the value.
|
|
||||||
Table indexes: Original node, taken by enderman.
|
|
||||||
Table values: The item which the enderman *actually* gets
|
|
||||||
Example:
|
|
||||||
mobs_mc.enderman_node_replace = {
|
|
||||||
["default:dirt_with_dry_grass"] = "default_dirt_with_grass",
|
|
||||||
}
|
|
||||||
-- This means, if the enderman takes a dirt with dry grass, he will get a dirt with grass
|
|
||||||
-- on his hand instead.
|
|
||||||
]]
|
|
||||||
mobs_mc.enderman_replace_on_take = {} -- no replacements by default
|
|
||||||
|
|
||||||
-- A table which can be used to override block textures of blocks carried by endermen.
|
|
||||||
-- Only works for cube-shaped nodes and nodeboxes.
|
|
||||||
-- Key: itemstrings of the blocks to replace
|
|
||||||
-- Value: A table with the texture overrides (6 textures)
|
|
||||||
mobs_mc.enderman_block_texture_overrides = {
|
|
||||||
}
|
|
||||||
|
|
||||||
-- List of nodes on which mobs can spawn
|
-- List of nodes on which mobs can spawn
|
||||||
mobs_mc.spawn = {
|
mobs_mc.spawn = {
|
||||||
solid = { "group:cracky", "group:crumbly", "group:shovely", "group:pickaxey" }, -- spawn on "solid" nodes (this is mostly just guessing)
|
solid = { "group:cracky", "group:crumbly", "group:shovely", "group:pickaxey" }, -- spawn on "solid" nodes (this is mostly just guessing)
|
||||||
|
@ -312,6 +263,7 @@ mobs_mc.misc = {
|
||||||
-- Item name overrides from mobs_mc_gameconfig (if present)
|
-- Item name overrides from mobs_mc_gameconfig (if present)
|
||||||
if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then
|
if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then
|
||||||
local tables = {"items", "follow", "replace", "spawn", "spawn_height", "misc"}
|
local tables = {"items", "follow", "replace", "spawn", "spawn_height", "misc"}
|
||||||
|
|
||||||
for t=1, #tables do
|
for t=1, #tables do
|
||||||
local tbl = tables[t]
|
local tbl = tables[t]
|
||||||
if mobs_mc.override[tbl] then
|
if mobs_mc.override[tbl] then
|
||||||
|
@ -320,15 +272,5 @@ if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if mobs_mc.override.enderman_takable then
|
|
||||||
mobs_mc.enderman_takable = mobs_mc.override.enderman_takable
|
|
||||||
end
|
|
||||||
if mobs_mc.override.enderman_replace_on_take then
|
|
||||||
mobs_mc.enderman_replace_on_take = mobs_mc.override.enderman_replace_on_take
|
|
||||||
end
|
|
||||||
if mobs_mc.enderman_block_texture_overrides then
|
|
||||||
mobs_mc.enderman_block_texture_overrides = mobs_mc.override.enderman_block_texture_overrides
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ if c("egg") then
|
||||||
local egg_GRAVITY = 9
|
local egg_GRAVITY = 9
|
||||||
local egg_VELOCITY = 19
|
local egg_VELOCITY = 19
|
||||||
|
|
||||||
mobs:register_arrow("mobs_mc:egg_entity", {
|
mcl_mobs:register_arrow("mobs_mc:egg_entity", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x=.5, y=.5},
|
visual_size = {x=.5, y=.5},
|
||||||
textures = {"mobs_chicken_egg.png"},
|
textures = {"mobs_chicken_egg.png"},
|
||||||
|
@ -318,7 +318,7 @@ end
|
||||||
local snowball_GRAVITY = 9
|
local snowball_GRAVITY = 9
|
||||||
local snowball_VELOCITY = 19
|
local snowball_VELOCITY = 19
|
||||||
|
|
||||||
mobs:register_arrow("mobs_mc:snowball_entity", {
|
mcl_mobs:register_arrow("mobs_mc:snowball_entity", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x=.5, y=.5},
|
visual_size = {x=.5, y=.5},
|
||||||
textures = {"mcl_throwing_snowball.png"},
|
textures = {"mcl_throwing_snowball.png"},
|
||||||
|
|
|
@ -3,7 +3,7 @@ local function is_forbidden_node(pos, node)
|
||||||
return minetest.get_item_group(node.name, "stair") > 0 or minetest.get_item_group(node.name, "slab") > 0 or minetest.get_item_group(node.name, "carpet") > 0
|
return minetest.get_item_group(node.name, "stair") > 0 or minetest.get_item_group(node.name, "slab") > 0 or minetest.get_item_group(node.name, "carpet") > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function mobs:spawn_abm_check(pos, node, name)
|
function mcl_mobs:spawn_abm_check(pos, node, name)
|
||||||
-- Don't spawn monsters on mycelium
|
-- Don't spawn monsters on mycelium
|
||||||
if (node.name == "mcl_core:mycelium" or node.name == "mcl_core:mycelium_snow") and minetest.registered_entities[name].type == "monster" then
|
if (node.name == "mcl_core:mycelium" or node.name == "mcl_core:mycelium_snow") and minetest.registered_entities[name].type == "monster" then
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:agent", {
|
mcl_mobs:register_mob("mobs_mc:agent", {
|
||||||
type = "npc",
|
type = "npc",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
passive = true,
|
passive = true,
|
||||||
|
@ -36,4 +36,4 @@ mobs:register_mob("mobs_mc:agent", {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_egg("mobs_mc:agent", S("Agent"), "mobs_mc_spawn_icon_agent.png", 0)
|
mcl_mobs:register_egg("mobs_mc:agent", S("Agent"), "mobs_mc_spawn_icon_agent.png", 0)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:bat", {
|
mcl_mobs:register_mob("mobs_mc:bat", {
|
||||||
description = S("Bat"),
|
description = S("Bat"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "ambient",
|
spawn_class = "ambient",
|
||||||
|
@ -65,7 +65,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spawn on solid blocks at or below Sea level and the selected light level
|
-- Spawn on solid blocks at or below Sea level and the selected light level
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:bat",
|
"mobs_mc:bat",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -143,4 +143,4 @@ mobs_mc.spawn_height.water-1)
|
||||||
|
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:bat", S("Bat"), "mobs_mc_spawn_icon_bat.png", 0)
|
mcl_mobs:register_egg("mobs_mc:bat", S("Bat"), "mobs_mc_spawn_icon_bat.png", 0)
|
||||||
|
|
|
@ -12,7 +12,7 @@ local mod_target = minetest.get_modpath("mcl_target")
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:blaze", {
|
mcl_mobs:register_mob("mobs_mc:blaze", {
|
||||||
description = S("Blaze"),
|
description = S("Blaze"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -131,7 +131,7 @@ mobs:register_mob("mobs_mc:blaze", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:blaze",
|
"mobs_mc:blaze",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -145,7 +145,7 @@ mobs_mc.spawn_height.nether_min,
|
||||||
mobs_mc.spawn_height.nether_max)
|
mobs_mc.spawn_height.nether_max)
|
||||||
|
|
||||||
-- Blaze fireball
|
-- Blaze fireball
|
||||||
mobs:register_arrow("mobs_mc:blaze_fireball", {
|
mcl_mobs:register_arrow("mobs_mc:blaze_fireball", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 0.3, y = 0.3},
|
visual_size = {x = 0.3, y = 0.3},
|
||||||
textures = {"mcl_fire_fire_charge.png"},
|
textures = {"mcl_fire_fire_charge.png"},
|
||||||
|
@ -200,4 +200,4 @@ mobs:register_arrow("mobs_mc:blaze_fireball", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:blaze", S("Blaze"), "mobs_mc_spawn_icon_blaze.png", 0)
|
mcl_mobs:register_egg("mobs_mc:blaze", S("Blaze"), "mobs_mc_spawn_icon_blaze.png", 0)
|
||||||
|
|
|
@ -8,7 +8,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:chicken", {
|
mcl_mobs:register_mob("mobs_mc:chicken", {
|
||||||
description = S("Chicken"),
|
description = S("Chicken"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -69,9 +69,9 @@ mobs:register_mob("mobs_mc:chicken", {
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
|
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
if mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
|
if mcl_mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self, dtime)
|
do_custom = function(self, dtime)
|
||||||
|
@ -101,7 +101,7 @@ mobs:register_mob("mobs_mc:chicken", {
|
||||||
})
|
})
|
||||||
|
|
||||||
--spawn
|
--spawn
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:chicken",
|
"mobs_mc:chicken",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -151,4 +151,4 @@ mobs_mc.spawn_height.water,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:chicken", S("Chicken"), "mobs_mc_spawn_icon_chicken.png", 0)
|
mcl_mobs:register_egg("mobs_mc:chicken", S("Chicken"), "mobs_mc_spawn_icon_chicken.png", 0)
|
||||||
|
|
|
@ -49,8 +49,8 @@ local cow_def = {
|
||||||
},
|
},
|
||||||
follow = mobs_mc.follow.cow,
|
follow = mobs_mc.follow.cow,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
return
|
return
|
||||||
|
@ -71,14 +71,14 @@ local cow_def = {
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
||||||
end,
|
end,
|
||||||
follow = mobs_mc.items.wheat,
|
follow = mobs_mc.items.wheat,
|
||||||
view_range = 10,
|
view_range = 10,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:cow", cow_def)
|
mcl_mobs:register_mob("mobs_mc:cow", cow_def)
|
||||||
|
|
||||||
-- Mooshroom
|
-- Mooshroom
|
||||||
local mooshroom_def = table.copy(cow_def)
|
local mooshroom_def = table.copy(cow_def)
|
||||||
|
@ -86,8 +86,8 @@ mooshroom_def.description = S("Mooshroom")
|
||||||
mooshroom_def.mesh = "mobs_mc_cow.b3d"
|
mooshroom_def.mesh = "mobs_mc_cow.b3d"
|
||||||
mooshroom_def.textures = { {"mobs_mc_mooshroom.png", "mobs_mc_mushroom_red.png"}, {"mobs_mc_mooshroom_brown.png", "mobs_mc_mushroom_brown.png" } }
|
mooshroom_def.textures = { {"mobs_mc_mooshroom.png", "mobs_mc_mushroom_red.png"}, {"mobs_mc_mooshroom_brown.png", "mobs_mc_mushroom_brown.png" } }
|
||||||
mooshroom_def.on_rightclick = function(self, clicker)
|
mooshroom_def.on_rightclick = function(self, clicker)
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
return
|
return
|
||||||
|
@ -140,13 +140,13 @@ mooshroom_def.on_rightclick = function(self, clicker)
|
||||||
minetest.add_item(pos, {name = mobs_mc.items.mushroom_stew})
|
minetest.add_item(pos, {name = mobs_mc.items.mushroom_stew})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
||||||
end
|
end
|
||||||
mobs:register_mob("mobs_mc:mooshroom", mooshroom_def)
|
mcl_mobs:register_mob("mobs_mc:mooshroom", mooshroom_def)
|
||||||
|
|
||||||
|
|
||||||
-- Spawning
|
-- Spawning
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:cow",
|
"mobs_mc:cow",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -198,7 +198,7 @@ mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:mooshroom",
|
"mobs_mc:mooshroom",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -215,5 +215,5 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn egg
|
-- spawn egg
|
||||||
mobs:register_egg("mobs_mc:cow", S("Cow"), "mobs_mc_spawn_icon_cow.png", 0)
|
mcl_mobs:register_egg("mobs_mc:cow", S("Cow"), "mobs_mc_spawn_icon_cow.png", 0)
|
||||||
mobs:register_egg("mobs_mc:mooshroom", S("Mooshroom"), "mobs_mc_spawn_icon_mooshroom.png", 0)
|
mcl_mobs:register_egg("mobs_mc:mooshroom", S("Mooshroom"), "mobs_mc_spawn_icon_mooshroom.png", 0)
|
||||||
|
|
|
@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:creeper", {
|
mcl_mobs:register_mob("mobs_mc:creeper", {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
|
@ -77,7 +77,7 @@ mobs:register_mob("mobs_mc:creeper", {
|
||||||
if self._forced_explosion_countdown_timer ~= nil then
|
if self._forced_explosion_countdown_timer ~= nil then
|
||||||
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
||||||
if self._forced_explosion_countdown_timer <= 0 then
|
if self._forced_explosion_countdown_timer <= 0 then
|
||||||
mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
|
mcl_mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -129,7 +129,7 @@ mobs:register_mob("mobs_mc:creeper", {
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:creeper_charged", {
|
mcl_mobs:register_mob("mobs_mc:creeper_charged", {
|
||||||
description = S("Creeper"),
|
description = S("Creeper"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -199,7 +199,7 @@ mobs:register_mob("mobs_mc:creeper_charged", {
|
||||||
if self._forced_explosion_countdown_timer ~= nil then
|
if self._forced_explosion_countdown_timer ~= nil then
|
||||||
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
|
||||||
if self._forced_explosion_countdown_timer <= 0 then
|
if self._forced_explosion_countdown_timer <= 0 then
|
||||||
mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
|
mcl_mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -254,7 +254,7 @@ mobs:register_mob("mobs_mc:creeper_charged", {
|
||||||
glow = 3,
|
glow = 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:creeper",
|
"mobs_mc:creeper",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -408,4 +408,4 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:creeper", S("Creeper"), "mobs_mc_spawn_icon_creeper.png", 0)
|
mcl_mobs:register_egg("mobs_mc:creeper", S("Creeper"), "mobs_mc_spawn_icon_creeper.png", 0)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:enderdragon", {
|
mcl_mobs:register_mob("mobs_mc:enderdragon", {
|
||||||
description = S("Ender Dragon"),
|
description = S("Ender Dragon"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -109,7 +109,7 @@ mobs:register_mob("mobs_mc:enderdragon", {
|
||||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
-- dragon fireball (projectile)
|
-- dragon fireball (projectile)
|
||||||
mobs:register_arrow("mobs_mc:dragon_fireball", {
|
mcl_mobs:register_arrow("mobs_mc:dragon_fireball", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 1.25, y = 1.25},
|
visual_size = {x = 1.25, y = 1.25},
|
||||||
textures = {"mobs_mc_dragon_fireball.png"},
|
textures = {"mobs_mc_dragon_fireball.png"},
|
||||||
|
@ -133,10 +133,10 @@ mobs:register_arrow("mobs_mc:dragon_fireball", {
|
||||||
|
|
||||||
-- node hit, explode
|
-- node hit, explode
|
||||||
hit_node = function(self, pos, node)
|
hit_node = function(self, pos, node)
|
||||||
mobs:boom(self, pos, 2)
|
mcl_mobs:boom(self, pos, 2)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_egg("mobs_mc:enderdragon", S("Ender Dragon"), "mobs_mc_spawn_icon_dragon.png", 0, true)
|
mcl_mobs:register_egg("mobs_mc:enderdragon", S("Ender Dragon"), "mobs_mc_spawn_icon_dragon.png", 0, true)
|
||||||
|
|
||||||
mcl_wip.register_wip_item("mobs_mc:enderdragon")
|
mcl_wip.register_wip_item("mobs_mc:enderdragon")
|
||||||
|
|
|
@ -48,6 +48,37 @@ local take_frequency_max = 245
|
||||||
local place_frequency_min = 235
|
local place_frequency_min = 235
|
||||||
local place_frequency_max = 245
|
local place_frequency_max = 245
|
||||||
|
|
||||||
|
|
||||||
|
-- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox
|
||||||
|
-- and the textures have tranparent pixels.
|
||||||
|
local block_texture_overrides
|
||||||
|
do
|
||||||
|
local cbackground = "mobs_mc_enderman_cactus_background.png"
|
||||||
|
local ctiles = minetest.registered_nodes["mcl_core:cactus"].tiles
|
||||||
|
|
||||||
|
local ctable = {}
|
||||||
|
local last
|
||||||
|
for i=1, 6 do
|
||||||
|
if ctiles[i] then
|
||||||
|
last = ctiles[i]
|
||||||
|
end
|
||||||
|
table.insert(ctable, cbackground .. "^" .. last)
|
||||||
|
end
|
||||||
|
|
||||||
|
block_texture_overrides = {
|
||||||
|
["mcl_core:cactus"] = ctable,
|
||||||
|
-- FIXME: replace colorize colors with colors from palette
|
||||||
|
["mcl_core:dirt_with_grass"] =
|
||||||
|
{
|
||||||
|
"mcl_core_grass_block_top.png^[colorize:green:90",
|
||||||
|
"default_dirt.png",
|
||||||
|
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
|
||||||
|
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
|
||||||
|
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
|
||||||
|
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)"}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
-- Create the textures table for the enderman, depending on which kind of block
|
-- Create the textures table for the enderman, depending on which kind of block
|
||||||
-- the enderman holds (if any).
|
-- the enderman holds (if any).
|
||||||
local create_enderman_textures = function(block_type, itemstring)
|
local create_enderman_textures = function(block_type, itemstring)
|
||||||
|
@ -69,9 +100,9 @@ local create_enderman_textures = function(block_type, itemstring)
|
||||||
local tiles = minetest.registered_nodes[itemstring].tiles
|
local tiles = minetest.registered_nodes[itemstring].tiles
|
||||||
local textures = {}
|
local textures = {}
|
||||||
local last
|
local last
|
||||||
if mobs_mc.enderman_block_texture_overrides[itemstring] then
|
if block_texture_overrides[itemstring] then
|
||||||
-- Texture override available? Use these instead!
|
-- Texture override available? Use these instead!
|
||||||
textures = mobs_mc.enderman_block_texture_overrides[itemstring]
|
textures = block_texture_overrides[itemstring]
|
||||||
else
|
else
|
||||||
-- Extract the texture names
|
-- Extract the texture names
|
||||||
for i = 1, 6 do
|
for i = 1, 6 do
|
||||||
|
@ -189,7 +220,7 @@ end
|
||||||
|
|
||||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:enderman", {
|
mcl_mobs:register_mob("mobs_mc:enderman", {
|
||||||
description = S("Enderman"),
|
description = S("Enderman"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -388,7 +419,7 @@ mobs:register_mob("mobs_mc:enderman", {
|
||||||
self._take_place_timer = 0
|
self._take_place_timer = 0
|
||||||
self._next_take_place_time = math.random(place_frequency_min, place_frequency_max)
|
self._next_take_place_time = math.random(place_frequency_min, place_frequency_max)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local takable_nodes = minetest.find_nodes_in_area_under_air({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, mobs_mc.enderman_takable)
|
local takable_nodes = minetest.find_nodes_in_area_under_air({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, "group:enderman_takable")
|
||||||
if #takable_nodes >= 1 then
|
if #takable_nodes >= 1 then
|
||||||
local r = pr:next(1, #takable_nodes)
|
local r = pr:next(1, #takable_nodes)
|
||||||
local take_pos = takable_nodes[r]
|
local take_pos = takable_nodes[r]
|
||||||
|
@ -398,11 +429,7 @@ mobs:register_mob("mobs_mc:enderman", {
|
||||||
minetest.remove_node(take_pos)
|
minetest.remove_node(take_pos)
|
||||||
local dug = minetest.get_node_or_nil(take_pos)
|
local dug = minetest.get_node_or_nil(take_pos)
|
||||||
if dug and dug.name == "air" then
|
if dug and dug.name == "air" then
|
||||||
if mobs_mc.enderman_replace_on_take[node.name] then
|
self._taken_node = node.name
|
||||||
self._taken_node = mobs_mc.enderman_replace_on_take[node.name]
|
|
||||||
else
|
|
||||||
self._taken_node = node.name
|
|
||||||
end
|
|
||||||
local def = minetest.registered_nodes[self._taken_node]
|
local def = minetest.registered_nodes[self._taken_node]
|
||||||
-- Update animation and texture accordingly (adds visibly carried block)
|
-- Update animation and texture accordingly (adds visibly carried block)
|
||||||
local block_type
|
local block_type
|
||||||
|
@ -431,7 +458,7 @@ mobs:register_mob("mobs_mc:enderman", {
|
||||||
self.base_texture = create_enderman_textures(block_type, self._taken_node)
|
self.base_texture = create_enderman_textures(block_type, self._taken_node)
|
||||||
self.object:set_properties({ textures = self.base_texture })
|
self.object:set_properties({ textures = self.base_texture })
|
||||||
self.animation = select_enderman_animation("block")
|
self.animation = select_enderman_animation("block")
|
||||||
mobs:set_animation(self, self.animation.current)
|
mcl_mobs:set_animation(self, self.animation.current)
|
||||||
if def.sounds and def.sounds.dug then
|
if def.sounds and def.sounds.dug then
|
||||||
minetest.sound_play(def.sounds.dug, {pos = take_pos, max_hear_distance = 16}, true)
|
minetest.sound_play(def.sounds.dug, {pos = take_pos, max_hear_distance = 16}, true)
|
||||||
end
|
end
|
||||||
|
@ -454,7 +481,7 @@ mobs:register_mob("mobs_mc:enderman", {
|
||||||
local def = minetest.registered_nodes[self._taken_node]
|
local def = minetest.registered_nodes[self._taken_node]
|
||||||
-- Update animation accordingly (removes visible block)
|
-- Update animation accordingly (removes visible block)
|
||||||
self.animation = select_enderman_animation("normal")
|
self.animation = select_enderman_animation("normal")
|
||||||
mobs:set_animation(self, self.animation.current)
|
mcl_mobs:set_animation(self, self.animation.current)
|
||||||
if def.sounds and def.sounds.place then
|
if def.sounds and def.sounds.place then
|
||||||
minetest.sound_play(def.sounds.place, {pos = place_pos, max_hear_distance = 16}, true)
|
minetest.sound_play(def.sounds.place, {pos = place_pos, max_hear_distance = 16}, true)
|
||||||
end
|
end
|
||||||
|
@ -565,7 +592,7 @@ mobs:register_mob("mobs_mc:enderman", {
|
||||||
|
|
||||||
|
|
||||||
-- End spawn
|
-- End spawn
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:enderman",
|
"mobs_mc:enderman",
|
||||||
"end",
|
"end",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -580,7 +607,7 @@ minetest.LIGHT_MAX+1,
|
||||||
mobs_mc.spawn_height.end_min,
|
mobs_mc.spawn_height.end_min,
|
||||||
mobs_mc.spawn_height.end_max)
|
mobs_mc.spawn_height.end_max)
|
||||||
-- Overworld spawn
|
-- Overworld spawn
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:enderman",
|
"mobs_mc:enderman",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -734,7 +761,7 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- Nether spawn (rare)
|
-- Nether spawn (rare)
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:enderman",
|
"mobs_mc:enderman",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -750,4 +777,4 @@ mobs_mc.spawn_height.nether_min,
|
||||||
mobs_mc.spawn_height.nether_max)
|
mobs_mc.spawn_height.nether_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:enderman", S("Enderman"), "mobs_mc_spawn_icon_enderman.png", 0)
|
mcl_mobs:register_egg("mobs_mc:enderman", S("Enderman"), "mobs_mc_spawn_icon_enderman.png", 0)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:endermite", {
|
mcl_mobs:register_mob("mobs_mc:endermite", {
|
||||||
description = S("Endermite"),
|
description = S("Endermite"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -38,4 +38,4 @@ mobs:register_mob("mobs_mc:endermite", {
|
||||||
reach = 1,
|
reach = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_egg("mobs_mc:endermite", S("Endermite"), "mobs_mc_spawn_icon_endermite.png", 0)
|
mcl_mobs:register_egg("mobs_mc:endermite", S("Endermite"), "mobs_mc_spawn_icon_endermite.png", 0)
|
||||||
|
|
|
@ -10,7 +10,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:ghast", {
|
mcl_mobs:register_mob("mobs_mc:ghast", {
|
||||||
description = S("Ghast"),
|
description = S("Ghast"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -76,7 +76,7 @@ mobs:register_mob("mobs_mc:ghast", {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:ghast",
|
"mobs_mc:ghast",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -92,7 +92,7 @@ mobs_mc.spawn_height.nether_min,
|
||||||
mobs_mc.spawn_height.nether_max)
|
mobs_mc.spawn_height.nether_max)
|
||||||
|
|
||||||
-- fireball (projectile)
|
-- fireball (projectile)
|
||||||
mobs:register_arrow("mobs_mc:fireball", {
|
mcl_mobs:register_arrow("mobs_mc:fireball", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 1, y = 1},
|
visual_size = {x = 1, y = 1},
|
||||||
textures = {"mcl_fire_fire_charge.png"},
|
textures = {"mcl_fire_fire_charge.png"},
|
||||||
|
@ -105,7 +105,7 @@ mobs:register_arrow("mobs_mc:fireball", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = 6},
|
damage_groups = {fleshy = 6},
|
||||||
}, nil)
|
}, nil)
|
||||||
mobs:boom(self, self.object:get_pos(), 1, true)
|
mcl_mobs:boom(self, self.object:get_pos(), 1, true)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_mob = function(self, mob)
|
hit_mob = function(self, mob)
|
||||||
|
@ -113,11 +113,11 @@ mobs:register_arrow("mobs_mc:fireball", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = 6},
|
damage_groups = {fleshy = 6},
|
||||||
}, nil)
|
}, nil)
|
||||||
mobs:boom(self, self.object:get_pos(), 1, true)
|
mcl_mobs:boom(self, self.object:get_pos(), 1, true)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_node = function(self, pos, node)
|
hit_node = function(self, pos, node)
|
||||||
mobs:boom(self, pos, 1, true)
|
mcl_mobs:boom(self, pos, 1, true)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -125,4 +125,4 @@ mobs:register_arrow("mobs_mc:fireball", {
|
||||||
|
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:ghast", S("Ghast"), "mobs_mc_spawn_icon_ghast.png", 0)
|
mcl_mobs:register_egg("mobs_mc:ghast", S("Ghast"), "mobs_mc_spawn_icon_ghast.png", 0)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:guardian", {
|
mcl_mobs:register_mob("mobs_mc:guardian", {
|
||||||
description = S("Guardian"),
|
description = S("Guardian"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -99,7 +99,7 @@ mobs:register_mob("mobs_mc:guardian", {
|
||||||
|
|
||||||
-- Spawning disabled due to size issues
|
-- Spawning disabled due to size issues
|
||||||
-- TODO: Re-enable spawning
|
-- TODO: Re-enable spawning
|
||||||
--mobs:spawn_specific("mobs_mc:guardian", mobs_mc.spawn.water, mobs_mc.spawn_water, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water - 10)
|
--mcl_mobs:spawn_specific("mobs_mc:guardian", mobs_mc.spawn.water, mobs_mc.spawn_water, 0, minetest.LIGHT_MAX+1, 30, 25000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water - 10)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:guardian", S("Guardian"), "mobs_mc_spawn_icon_guardian.png", 0)
|
mcl_mobs:register_egg("mobs_mc:guardian", S("Guardian"), "mobs_mc_spawn_icon_guardian.png", 0)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:guardian_elder", {
|
mcl_mobs:register_mob("mobs_mc:guardian_elder", {
|
||||||
description = S("Elder Guardian"),
|
description = S("Elder Guardian"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -109,8 +109,8 @@ mobs:register_mob("mobs_mc:guardian_elder", {
|
||||||
|
|
||||||
-- Spawning disabled due to size issues <- what do you mean? -j4i
|
-- Spawning disabled due to size issues <- what do you mean? -j4i
|
||||||
-- TODO: Re-enable spawning
|
-- TODO: Re-enable spawning
|
||||||
-- mobs:spawn_specific("mobs_mc:guardian_elder", mobs_mc.spawn.water, mobs_mc.spawn_water, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-18)
|
-- mcl_mobs:spawn_specific("mobs_mc:guardian_elder", mobs_mc.spawn.water, mobs_mc.spawn_water, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-18)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:guardian_elder", S("Elder Guardian"), "mobs_mc_spawn_icon_guardian_elder.png", 0)
|
mcl_mobs:register_egg("mobs_mc:guardian_elder", S("Elder Guardian"), "mobs_mc_spawn_icon_guardian_elder.png", 0)
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ local horse = {
|
||||||
-- Some weird human is riding. Buck them off?
|
-- Some weird human is riding. Buck them off?
|
||||||
if self.driver and not self.tamed and self.buck_off_time <= 0 then
|
if self.driver and not self.tamed and self.buck_off_time <= 0 then
|
||||||
if math.random() < 0.2 then
|
if math.random() < 0.2 then
|
||||||
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
||||||
-- TODO bucking animation
|
-- TODO bucking animation
|
||||||
else
|
else
|
||||||
-- Nah, can't be bothered. Think about it again in one second
|
-- Nah, can't be bothered. Think about it again in one second
|
||||||
|
@ -182,7 +182,7 @@ local horse = {
|
||||||
-- if driver present and horse has a saddle allow control of horse
|
-- if driver present and horse has a saddle allow control of horse
|
||||||
if self.driver and self._saddle then
|
if self.driver and self._saddle then
|
||||||
|
|
||||||
mobs.drive(self, "walk", "stand", false, dtime)
|
mcl_mobs.drive(self, "walk", "stand", false, dtime)
|
||||||
|
|
||||||
return false -- skip rest of mob functions
|
return false -- skip rest of mob functions
|
||||||
end
|
end
|
||||||
|
@ -198,7 +198,7 @@ local horse = {
|
||||||
end
|
end
|
||||||
-- also detach from horse properly
|
-- also detach from horse properly
|
||||||
if self.driver then
|
if self.driver then
|
||||||
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
||||||
end
|
end
|
||||||
|
|
||||||
end,
|
end,
|
||||||
|
@ -235,7 +235,7 @@ local horse = {
|
||||||
-- Trying to ride
|
-- Trying to ride
|
||||||
elseif not self.driver then
|
elseif not self.driver then
|
||||||
self.object:set_properties({stepheight = 1.1})
|
self.object:set_properties({stepheight = 1.1})
|
||||||
mobs.attach(self, clicker)
|
mcl_mobs.attach(self, clicker)
|
||||||
self.buck_off_time = 40 -- TODO how long does it take in minecraft?
|
self.buck_off_time = 40 -- TODO how long does it take in minecraft?
|
||||||
if self.temper > 100 then
|
if self.temper > 100 then
|
||||||
self.tamed = true -- NOTE taming can only be finished by riding the horse
|
self.tamed = true -- NOTE taming can only be finished by riding the horse
|
||||||
|
@ -247,7 +247,7 @@ local horse = {
|
||||||
|
|
||||||
-- Clicking on the horse while riding ==> unmount
|
-- Clicking on the horse while riding ==> unmount
|
||||||
elseif self.driver and self.driver == clicker then
|
elseif self.driver and self.driver == clicker then
|
||||||
mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If nothing happened temper_increase = 0 and addition does nothing
|
-- If nothing happened temper_increase = 0 and addition does nothing
|
||||||
|
@ -263,7 +263,7 @@ local horse = {
|
||||||
elseif (iname == mobs_mc.items.golden_carrot) then
|
elseif (iname == mobs_mc.items.golden_carrot) then
|
||||||
heal = 4
|
heal = 4
|
||||||
end
|
end
|
||||||
if heal > 0 and mobs:feed_tame(self, clicker, heal, true, false) then
|
if heal > 0 and mcl_mobs:feed_tame(self, clicker, heal, true, false) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -278,11 +278,11 @@ local horse = {
|
||||||
elseif (iname == mobs_mc.items.hay_bale) then
|
elseif (iname == mobs_mc.items.hay_bale) then
|
||||||
heal = 20
|
heal = 20
|
||||||
end
|
end
|
||||||
if heal > 0 and mobs:feed_tame(self, clicker, heal, false, false) then
|
if heal > 0 and mcl_mobs:feed_tame(self, clicker, heal, false, false) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if mobs:protect(self, clicker) then
|
if mcl_mobs:protect(self, clicker) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ local horse = {
|
||||||
-- detatch player already riding horse
|
-- detatch player already riding horse
|
||||||
if self.driver and clicker == self.driver then
|
if self.driver and clicker == self.driver then
|
||||||
|
|
||||||
mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
||||||
|
|
||||||
-- Put on saddle if tamed
|
-- Put on saddle if tamed
|
||||||
elseif not self.driver and not self._saddle
|
elseif not self.driver and not self._saddle
|
||||||
|
@ -355,18 +355,18 @@ local horse = {
|
||||||
elseif not self.driver and self._saddle then
|
elseif not self.driver and self._saddle then
|
||||||
|
|
||||||
self.object:set_properties({stepheight = 1.1})
|
self.object:set_properties({stepheight = 1.1})
|
||||||
mobs.attach(self, clicker)
|
mcl_mobs.attach(self, clicker)
|
||||||
|
|
||||||
-- Used to capture horse
|
-- Used to capture horse
|
||||||
elseif not self.driver and iname ~= "" then
|
elseif not self.driver and iname ~= "" then
|
||||||
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_breed = function(parent1, parent2)
|
on_breed = function(parent1, parent2)
|
||||||
local pos = parent1.object:get_pos()
|
local pos = parent1.object:get_pos()
|
||||||
local child = mobs:spawn_child(pos, parent1.name)
|
local child = mcl_mobs:spawn_child(pos, parent1.name)
|
||||||
if child then
|
if child then
|
||||||
local ent_c = child:get_luaentity()
|
local ent_c = child:get_luaentity()
|
||||||
local p = math.random(1, 2)
|
local p = math.random(1, 2)
|
||||||
|
@ -415,7 +415,7 @@ local horse = {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:horse", horse)
|
mcl_mobs:register_mob("mobs_mc:horse", horse)
|
||||||
|
|
||||||
-- Skeleton horse
|
-- Skeleton horse
|
||||||
local skeleton_horse = table.copy(horse)
|
local skeleton_horse = table.copy(horse)
|
||||||
|
@ -438,7 +438,7 @@ skeleton_horse.sounds = {
|
||||||
distance = 16,
|
distance = 16,
|
||||||
}
|
}
|
||||||
skeleton_horse.harmed_by_heal = true
|
skeleton_horse.harmed_by_heal = true
|
||||||
mobs:register_mob("mobs_mc:skeleton_horse", skeleton_horse)
|
mcl_mobs:register_mob("mobs_mc:skeleton_horse", skeleton_horse)
|
||||||
|
|
||||||
-- Zombie horse
|
-- Zombie horse
|
||||||
local zombie_horse = table.copy(horse)
|
local zombie_horse = table.copy(horse)
|
||||||
|
@ -462,7 +462,7 @@ zombie_horse.sounds = {
|
||||||
distance = 16,
|
distance = 16,
|
||||||
}
|
}
|
||||||
zombie_horse.harmed_by_heal = true
|
zombie_horse.harmed_by_heal = true
|
||||||
mobs:register_mob("mobs_mc:zombie_horse", zombie_horse)
|
mcl_mobs:register_mob("mobs_mc:zombie_horse", zombie_horse)
|
||||||
|
|
||||||
-- Donkey
|
-- Donkey
|
||||||
local d = 0.86 -- donkey scale
|
local d = 0.86 -- donkey scale
|
||||||
|
@ -493,7 +493,7 @@ donkey.collisionbox = {
|
||||||
donkey.jump = true
|
donkey.jump = true
|
||||||
donkey.jump_height = 3.75 -- can clear 1 block height
|
donkey.jump_height = 3.75 -- can clear 1 block height
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:donkey", donkey)
|
mcl_mobs:register_mob("mobs_mc:donkey", donkey)
|
||||||
|
|
||||||
-- Mule
|
-- Mule
|
||||||
local m = 0.94
|
local m = 0.94
|
||||||
|
@ -511,11 +511,11 @@ mule.collisionbox = {
|
||||||
horse.collisionbox[5] * m,
|
horse.collisionbox[5] * m,
|
||||||
horse.collisionbox[6] * m,
|
horse.collisionbox[6] * m,
|
||||||
}
|
}
|
||||||
mobs:register_mob("mobs_mc:mule", mule)
|
mcl_mobs:register_mob("mobs_mc:mule", mule)
|
||||||
|
|
||||||
--===========================
|
--===========================
|
||||||
--Spawn Function
|
--Spawn Function
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:horse",
|
"mobs_mc:horse",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -566,7 +566,7 @@ mobs_mc.spawn_height.water+3,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:donkey",
|
"mobs_mc:donkey",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -587,8 +587,8 @@ mobs_mc.spawn_height.water+3,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:horse", S("Horse"), "mobs_mc_spawn_icon_horse.png", 0)
|
mcl_mobs:register_egg("mobs_mc:horse", S("Horse"), "mobs_mc_spawn_icon_horse.png", 0)
|
||||||
mobs:register_egg("mobs_mc:skeleton_horse", S("Skeleton Horse"), "mobs_mc_spawn_icon_horse_skeleton.png", 0)
|
mcl_mobs:register_egg("mobs_mc:skeleton_horse", S("Skeleton Horse"), "mobs_mc_spawn_icon_horse_skeleton.png", 0)
|
||||||
--mobs:register_egg("mobs_mc:zombie_horse", S("Zombie Horse"), "mobs_mc_spawn_icon_horse_zombie.png", 0)
|
--mobs:register_egg("mobs_mc:zombie_horse", S("Zombie Horse"), "mobs_mc_spawn_icon_horse_zombie.png", 0)
|
||||||
mobs:register_egg("mobs_mc:donkey", S("Donkey"), "mobs_mc_spawn_icon_donkey.png", 0)
|
mcl_mobs:register_egg("mobs_mc:donkey", S("Donkey"), "mobs_mc_spawn_icon_donkey.png", 0)
|
||||||
mobs:register_egg("mobs_mc:mule", S("Mule"), "mobs_mc_spawn_icon_mule.png", 0)
|
mcl_mobs:register_egg("mobs_mc:mule", S("Mule"), "mobs_mc_spawn_icon_mule.png", 0)
|
||||||
|
|
|
@ -11,7 +11,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
local etime = 0
|
local etime = 0
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:iron_golem", {
|
mcl_mobs:register_mob("mobs_mc:iron_golem", {
|
||||||
description = S("Iron Golem"),
|
description = S("Iron Golem"),
|
||||||
type = "npc",
|
type = "npc",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -84,7 +84,7 @@ mobs:register_mob("mobs_mc:iron_golem", {
|
||||||
etime = etime + dtime
|
etime = etime + dtime
|
||||||
if etime > 10 then
|
if etime > 10 then
|
||||||
if self._home and vector.distance(self._home,self.object:get_pos()) > 50 then
|
if self._home and vector.distance(self._home,self.object:get_pos()) > 50 then
|
||||||
mobs:gopath(self,self._home)
|
mcl_mobs:gopath(self,self._home)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -92,7 +92,7 @@ mobs:register_mob("mobs_mc:iron_golem", {
|
||||||
|
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:iron_golem", S("Iron Golem"), "mobs_mc_spawn_icon_iron_golem.png", 0)
|
mcl_mobs:register_egg("mobs_mc:iron_golem", S("Iron Golem"), "mobs_mc_spawn_icon_iron_golem.png", 0)
|
||||||
|
|
||||||
|
|
||||||
--[[ This is to be called when a pumpkin or jack'o lantern has been placed. Recommended: In the on_construct function of the node.
|
--[[ This is to be called when a pumpkin or jack'o lantern has been placed. Recommended: In the on_construct function of the node.
|
||||||
|
|
|
@ -24,7 +24,7 @@ local carpets = {
|
||||||
unicolor_light_blue = { "mcl_wool:light_blue_carpet", "light_blue" },
|
unicolor_light_blue = { "mcl_wool:light_blue_carpet", "light_blue" },
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:llama", {
|
mcl_mobs:register_mob("mobs_mc:llama", {
|
||||||
description = S("Llama"),
|
description = S("Llama"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -101,7 +101,7 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
-- if driver present allow control of llama
|
-- if driver present allow control of llama
|
||||||
if self.driver then
|
if self.driver then
|
||||||
|
|
||||||
mobs.drive(self, "walk", "stand", false, dtime)
|
mcl_mobs.drive(self, "walk", "stand", false, dtime)
|
||||||
|
|
||||||
return false -- skip rest of mob functions
|
return false -- skip rest of mob functions
|
||||||
end
|
end
|
||||||
|
@ -113,7 +113,7 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
|
|
||||||
-- detach from llama properly
|
-- detach from llama properly
|
||||||
if self.driver then
|
if self.driver then
|
||||||
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
||||||
end
|
end
|
||||||
|
|
||||||
end,
|
end,
|
||||||
|
@ -128,12 +128,12 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
if item:get_name() == mobs_mc.items.hay_bale then
|
if item:get_name() == mobs_mc.items.hay_bale then
|
||||||
-- Breed with hay bale
|
-- Breed with hay bale
|
||||||
if mobs:feed_tame(self, clicker, 1, true, false) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end
|
||||||
else
|
else
|
||||||
-- Feed with anything else
|
-- Feed with anything else
|
||||||
if mobs:feed_tame(self, clicker, 1, false, true) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, false, true) then return end
|
||||||
end
|
end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
|
|
||||||
-- Make sure tamed llama is mature and being clicked by owner only
|
-- Make sure tamed llama is mature and being clicked by owner only
|
||||||
if self.tamed and not self.child and self.owner == clicker:get_player_name() then
|
if self.tamed and not self.child and self.owner == clicker:get_player_name() then
|
||||||
|
@ -172,18 +172,18 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
-- detatch player already riding llama
|
-- detatch player already riding llama
|
||||||
if self.driver and clicker == self.driver then
|
if self.driver and clicker == self.driver then
|
||||||
|
|
||||||
mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
||||||
|
|
||||||
-- attach player to llama
|
-- attach player to llama
|
||||||
elseif not self.driver then
|
elseif not self.driver then
|
||||||
|
|
||||||
self.object:set_properties({stepheight = 1.1})
|
self.object:set_properties({stepheight = 1.1})
|
||||||
mobs.attach(self, clicker)
|
mcl_mobs.attach(self, clicker)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Used to capture llama
|
-- Used to capture llama
|
||||||
elseif not self.driver and clicker:get_wielded_item():get_name() ~= "" then
|
elseif not self.driver and clicker:get_wielded_item():get_name() ~= "" then
|
||||||
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
else
|
else
|
||||||
parent = parent2
|
parent = parent2
|
||||||
end
|
end
|
||||||
child = mobs:spawn_child(pos, parent.name)
|
child = mcl_mobs:spawn_child(pos, parent.name)
|
||||||
if child then
|
if child then
|
||||||
local ent_c = child:get_luaentity()
|
local ent_c = child:get_luaentity()
|
||||||
ent_c.base_texture = table.copy(ent_c.base_texture)
|
ent_c.base_texture = table.copy(ent_c.base_texture)
|
||||||
|
@ -212,7 +212,7 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
})
|
})
|
||||||
|
|
||||||
--spawn
|
--spawn
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:llama",
|
"mobs_mc:llama",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -239,4 +239,4 @@ mobs_mc.spawn_height.water+15,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:llama", S("Llama"), "mobs_mc_spawn_icon_llama.png", 0)
|
mcl_mobs:register_egg("mobs_mc:llama", S("Llama"), "mobs_mc_spawn_icon_llama.png", 0)
|
||||||
|
|
|
@ -99,7 +99,7 @@ local ocelot = {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:ocelot", ocelot)
|
mcl_mobs:register_mob("mobs_mc:ocelot", ocelot)
|
||||||
|
|
||||||
-- Cat
|
-- Cat
|
||||||
local cat = table.copy(ocelot)
|
local cat = table.copy(ocelot)
|
||||||
|
@ -122,9 +122,9 @@ cat.sounds = {
|
||||||
distance = 16,
|
distance = 16,
|
||||||
}
|
}
|
||||||
cat.on_rightclick = function(self, clicker)
|
cat.on_rightclick = function(self, clicker)
|
||||||
if mobs:feed_tame(self, clicker, 1, true, false) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end
|
||||||
if mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
|
if mcl_mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
|
|
||||||
if self.child then return end
|
if self.child then return end
|
||||||
|
|
||||||
|
@ -149,13 +149,13 @@ cat.on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:cat", cat)
|
mcl_mobs:register_mob("mobs_mc:cat", cat)
|
||||||
|
|
||||||
local base_spawn_chance = 5000
|
local base_spawn_chance = 5000
|
||||||
|
|
||||||
-- Spawn ocelot
|
-- Spawn ocelot
|
||||||
--they get the same as the llama because I'm trying to rework so much of this code right now -j4i
|
--they get the same as the llama because I'm trying to rework so much of this code right now -j4i
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:ocelot",
|
"mobs_mc:ocelot",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -232,4 +232,4 @@ mobs:spawn({
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
-- FIXME: The spawn icon shows a cat texture, not an ocelot texture
|
-- FIXME: The spawn icon shows a cat texture, not an ocelot texture
|
||||||
mobs:register_egg("mobs_mc:ocelot", S("Ocelot"), "mobs_mc_spawn_icon_cat.png", 0)
|
mcl_mobs:register_egg("mobs_mc:ocelot", S("Ocelot"), "mobs_mc_spawn_icon_cat.png", 0)
|
||||||
|
|
|
@ -11,7 +11,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:parrot", {
|
mcl_mobs:register_mob("mobs_mc:parrot", {
|
||||||
description = S("Parrot"),
|
description = S("Parrot"),
|
||||||
type = "npc",
|
type = "npc",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -84,15 +84,15 @@ mobs:register_mob("mobs_mc:parrot", {
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Feed to tame, but not breed
|
-- Feed to tame, but not breed
|
||||||
if mobs:feed_tame(self, clicker, 1, false, true) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, false, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
|
if mcl_mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* <- I'll get to this eventually -j4i
|
-- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* <- I'll get to this eventually -j4i
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:parrot",
|
"mobs_mc:parrot",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -111,4 +111,4 @@ mobs_mc.spawn_height.water+7,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0)
|
mcl_mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:pig", {
|
mcl_mobs:register_mob("mobs_mc:pig", {
|
||||||
description = S("Pig"),
|
description = S("Pig"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -69,7 +69,7 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
-- if driver present allow control of horse
|
-- if driver present allow control of horse
|
||||||
if self.driver then
|
if self.driver then
|
||||||
|
|
||||||
mobs.drive(self, "walk", "stand", false, dtime)
|
mcl_mobs.drive(self, "walk", "stand", false, dtime)
|
||||||
|
|
||||||
return false -- skip rest of mob functions
|
return false -- skip rest of mob functions
|
||||||
end
|
end
|
||||||
|
@ -82,7 +82,7 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
-- drop saddle when horse is killed while riding
|
-- drop saddle when horse is killed while riding
|
||||||
-- also detach from horse properly
|
-- also detach from horse properly
|
||||||
if self.driver then
|
if self.driver then
|
||||||
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
local wielditem = clicker:get_wielded_item()
|
local wielditem = clicker:get_wielded_item()
|
||||||
-- Feed pig
|
-- Feed pig
|
||||||
if wielditem:get_name() ~= mobs_mc.items.carrot_on_a_stick then
|
if wielditem:get_name() ~= mobs_mc.items.carrot_on_a_stick then
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
end
|
end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
return
|
return
|
||||||
|
@ -139,13 +139,13 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
local name = clicker:get_player_name()
|
local name = clicker:get_player_name()
|
||||||
if self.driver and clicker == self.driver then
|
if self.driver and clicker == self.driver then
|
||||||
-- Detach if already attached
|
-- Detach if already attached
|
||||||
mobs.detach(clicker, {x=1, y=0, z=0})
|
mcl_mobs.detach(clicker, {x=1, y=0, z=0})
|
||||||
return
|
return
|
||||||
|
|
||||||
elseif not self.driver and self.saddle == "yes" and wielditem:get_name() == mobs_mc.items.carrot_on_a_stick then
|
elseif not self.driver and self.saddle == "yes" and wielditem:get_name() == mobs_mc.items.carrot_on_a_stick then
|
||||||
-- Ride pig if it has a saddle and player uses a carrot on a stick
|
-- Ride pig if it has a saddle and player uses a carrot on a stick
|
||||||
|
|
||||||
mobs.attach(self, clicker)
|
mcl_mobs.attach(self, clicker)
|
||||||
|
|
||||||
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
|
|
||||||
|
@ -167,13 +167,13 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
|
|
||||||
-- Capture pig
|
-- Capture pig
|
||||||
elseif not self.driver and clicker:get_wielded_item():get_name() ~= "" then
|
elseif not self.driver and clicker:get_wielded_item():get_name() ~= "" then
|
||||||
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_breed = function(parent1, parent2)
|
on_breed = function(parent1, parent2)
|
||||||
local pos = parent1.object:get_pos()
|
local pos = parent1.object:get_pos()
|
||||||
local child = mobs:spawn_child(pos, parent1.name)
|
local child = mcl_mobs:spawn_child(pos, parent1.name)
|
||||||
if child then
|
if child then
|
||||||
local ent_c = child:get_luaentity()
|
local ent_c = child:get_luaentity()
|
||||||
ent_c.tamed = true
|
ent_c.tamed = true
|
||||||
|
@ -183,7 +183,7 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:pig",
|
"mobs_mc:pig",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -234,4 +234,4 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:pig", S("Pig"), "mobs_mc_spawn_icon_pig.png", 0)
|
mcl_mobs:register_egg("mobs_mc:pig", S("Pig"), "mobs_mc_spawn_icon_pig.png", 0)
|
||||||
|
|
|
@ -7,7 +7,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:polar_bear", {
|
mcl_mobs:register_mob("mobs_mc:polar_bear", {
|
||||||
description = S("Polar Bear"),
|
description = S("Polar Bear"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -68,7 +68,7 @@ mobs:register_mob("mobs_mc:polar_bear", {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:polar_bear",
|
"mobs_mc:polar_bear",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -87,4 +87,4 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn egg
|
-- spawn egg
|
||||||
mobs:register_egg("mobs_mc:polar_bear", S("Polar Bear"), "mobs_mc_spawn_icon_polarbear.png", 0)
|
mcl_mobs:register_egg("mobs_mc:polar_bear", S("Polar Bear"), "mobs_mc_spawn_icon_polarbear.png", 0)
|
||||||
|
|
|
@ -61,9 +61,9 @@ local rabbit = {
|
||||||
replace_what = mobs_mc.replace.rabbit,
|
replace_what = mobs_mc.replace.rabbit,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
-- Feed, tame protect or capture
|
-- Feed, tame protect or capture
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
|
if mcl_mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
|
||||||
end,
|
end,
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
-- Easter egg: Change texture if rabbit is named “Toast”
|
-- Easter egg: Change texture if rabbit is named “Toast”
|
||||||
|
@ -80,7 +80,7 @@ local rabbit = {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:rabbit", rabbit)
|
mcl_mobs:register_mob("mobs_mc:rabbit", rabbit)
|
||||||
|
|
||||||
-- The killer bunny (Only with spawn egg)
|
-- The killer bunny (Only with spawn egg)
|
||||||
local killer_bunny = table.copy(rabbit)
|
local killer_bunny = table.copy(rabbit)
|
||||||
|
@ -106,12 +106,12 @@ killer_bunny.do_custom = function(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:killer_bunny", killer_bunny)
|
mcl_mobs:register_mob("mobs_mc:killer_bunny", killer_bunny)
|
||||||
|
|
||||||
-- Mob spawning rules.
|
-- Mob spawning rules.
|
||||||
-- Different skins depending on spawn location <- we'll get to this when the spawning algorithm is fleshed out
|
-- Different skins depending on spawn location <- we'll get to this when the spawning algorithm is fleshed out
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:rabbit",
|
"mobs_mc:rabbit",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -159,7 +159,7 @@ spawn_desert.on_spawn = function(self, pos)
|
||||||
self.base_texture = { "mobs_mc_rabbit_gold.png" }
|
self.base_texture = { "mobs_mc_rabbit_gold.png" }
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = self.base_texture})
|
||||||
end
|
end
|
||||||
mobs:spawn(spawn_desert)
|
mcl_mobs:spawn(spawn_desert)
|
||||||
|
|
||||||
local spawn_snow = table.copy(spawn)
|
local spawn_snow = table.copy(spawn)
|
||||||
spawn_snow.nodes = mobs_mc.spawn.snow
|
spawn_snow.nodes = mobs_mc.spawn.snow
|
||||||
|
@ -176,7 +176,7 @@ spawn_snow.on_spawn = function(self, pos)
|
||||||
self.base_texture = { texture }
|
self.base_texture = { texture }
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = self.base_texture})
|
||||||
end
|
end
|
||||||
mobs:spawn(spawn_snow)
|
mcl_mobs:spawn(spawn_snow)
|
||||||
|
|
||||||
local spawn_grass = table.copy(spawn)
|
local spawn_grass = table.copy(spawn)
|
||||||
spawn_grass.nodes = mobs_mc.spawn.grassland
|
spawn_grass.nodes = mobs_mc.spawn.grassland
|
||||||
|
@ -196,11 +196,11 @@ spawn_grass.on_spawn = function(self, pos)
|
||||||
self.base_texture = { texture }
|
self.base_texture = { texture }
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = self.base_texture})
|
||||||
end
|
end
|
||||||
mobs:spawn(spawn_grass)
|
mcl_mobs:spawn(spawn_grass)
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
-- Spawn egg
|
-- Spawn egg
|
||||||
mobs:register_egg("mobs_mc:rabbit", S("Rabbit"), "mobs_mc_spawn_icon_rabbit.png", 0)
|
mcl_mobs:register_egg("mobs_mc:rabbit", S("Rabbit"), "mobs_mc_spawn_icon_rabbit.png", 0)
|
||||||
|
|
||||||
-- Note: This spawn egg does not exist in Minecraft
|
-- Note: This spawn egg does not exist in Minecraft
|
||||||
mobs:register_egg("mobs_mc:killer_bunny", S("Killer Bunny"), "mobs_mc_spawn_icon_rabbit.png^[colorize:#FF0000:192", 0) -- TODO: Update inventory image
|
mcl_mobs:register_egg("mobs_mc:killer_bunny", S("Killer Bunny"), "mobs_mc_spawn_icon_rabbit.png^[colorize:#FF0000:192", 0) -- TODO: Update inventory image
|
||||||
|
|
|
@ -55,7 +55,7 @@ end
|
||||||
local gotten_texture = { "blank.png", "mobs_mc_sheep.png" }
|
local gotten_texture = { "blank.png", "mobs_mc_sheep.png" }
|
||||||
|
|
||||||
--mcsheep
|
--mcsheep
|
||||||
mobs:register_mob("mobs_mc:sheep", {
|
mcl_mobs:register_mob("mobs_mc:sheep", {
|
||||||
description = S("Sheep"),
|
description = S("Sheep"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -195,8 +195,8 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
|
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
if mcl_mobs:protect(self, clicker) then return end
|
||||||
|
|
||||||
if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then
|
if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then
|
||||||
self.gotten = true
|
self.gotten = true
|
||||||
|
@ -252,12 +252,12 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if mobs:capture_mob(self, clicker, 0, 5, 70, false, nil) then return end
|
if mcl_mobs:capture_mob(self, clicker, 0, 5, 70, false, nil) then return end
|
||||||
end,
|
end,
|
||||||
on_breed = function(parent1, parent2)
|
on_breed = function(parent1, parent2)
|
||||||
-- Breed sheep and choose a fur color for the child.
|
-- Breed sheep and choose a fur color for the child.
|
||||||
local pos = parent1.object:get_pos()
|
local pos = parent1.object:get_pos()
|
||||||
local child = mobs:spawn_child(pos, parent1.name)
|
local child = mcl_mobs:spawn_child(pos, parent1.name)
|
||||||
if child then
|
if child then
|
||||||
local ent_c = child:get_luaentity()
|
local ent_c = child:get_luaentity()
|
||||||
local color1 = parent1.color
|
local color1 = parent1.color
|
||||||
|
@ -304,7 +304,7 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:sheep",
|
"mobs_mc:sheep",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -355,4 +355,4 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:sheep", S("Sheep"), "mobs_mc_spawn_icon_sheep.png", 0)
|
mcl_mobs:register_egg("mobs_mc:sheep", S("Sheep"), "mobs_mc_spawn_icon_sheep.png", 0)
|
||||||
|
|
|
@ -11,7 +11,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
-- animation 45-80 is transition between passive and attack stance
|
-- animation 45-80 is transition between passive and attack stance
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:shulker", {
|
mcl_mobs:register_mob("mobs_mc:shulker", {
|
||||||
description = S("Shulker"),
|
description = S("Shulker"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -55,7 +55,7 @@ mobs:register_mob("mobs_mc:shulker", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- bullet arrow (weapon)
|
-- bullet arrow (weapon)
|
||||||
mobs:register_arrow("mobs_mc:shulkerbullet", {
|
mcl_mobs:register_arrow("mobs_mc:shulkerbullet", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 0.25, y = 0.25},
|
visual_size = {x = 0.25, y = 0.25},
|
||||||
textures = {"mobs_mc_shulkerbullet.png"},
|
textures = {"mobs_mc_shulkerbullet.png"},
|
||||||
|
@ -80,9 +80,9 @@ mobs:register_arrow("mobs_mc:shulkerbullet", {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
mobs:register_egg("mobs_mc:shulker", S("Shulker"), "mobs_mc_spawn_icon_shulker.png", 0)
|
mcl_mobs:register_egg("mobs_mc:shulker", S("Shulker"), "mobs_mc_spawn_icon_shulker.png", 0)
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:shulker",
|
"mobs_mc:shulker",
|
||||||
"end",
|
"end",
|
||||||
"ground",
|
"ground",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:silverfish", {
|
mcl_mobs:register_mob("mobs_mc:silverfish", {
|
||||||
description = S("Silverfish"),
|
description = S("Silverfish"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -49,7 +49,7 @@ mobs:register_mob("mobs_mc:silverfish", {
|
||||||
reach = 1,
|
reach = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_egg("mobs_mc:silverfish", S("Silverfish"), "mobs_mc_spawn_icon_silverfish.png", 0)
|
mcl_mobs:register_egg("mobs_mc:silverfish", S("Silverfish"), "mobs_mc_spawn_icon_silverfish.png", 0)
|
||||||
|
|
||||||
-- Monster egg blocks (Minetest Game)
|
-- Monster egg blocks (Minetest Game)
|
||||||
if minetest.get_modpath("default") and mobs_mc.create_monster_egg_nodes then
|
if minetest.get_modpath("default") and mobs_mc.create_monster_egg_nodes then
|
||||||
|
|
|
@ -102,7 +102,7 @@ local skeleton = {
|
||||||
harmed_by_heal = true,
|
harmed_by_heal = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:skeleton", skeleton)
|
mcl_mobs:register_mob("mobs_mc:skeleton", skeleton)
|
||||||
|
|
||||||
|
|
||||||
--###################
|
--###################
|
||||||
|
@ -139,10 +139,10 @@ table.insert(stray.drops, {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:stray", stray)
|
mcl_mobs:register_mob("mobs_mc:stray", stray)
|
||||||
|
|
||||||
-- Overworld spawn
|
-- Overworld spawn
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:skeleton",
|
"mobs_mc:skeleton",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -297,7 +297,7 @@ mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
|
|
||||||
-- Nether spawn
|
-- Nether spawn
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:skeleton",
|
"mobs_mc:skeleton",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -314,7 +314,7 @@ mobs_mc.spawn_height.nether_max)
|
||||||
|
|
||||||
-- Stray spawn
|
-- Stray spawn
|
||||||
-- TODO: Spawn directly under the sky
|
-- TODO: Spawn directly under the sky
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:stray",
|
"mobs_mc:stray",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -334,5 +334,5 @@ mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:skeleton", S("Skeleton"), "mobs_mc_spawn_icon_skeleton.png", 0)
|
mcl_mobs:register_egg("mobs_mc:skeleton", S("Skeleton"), "mobs_mc_spawn_icon_skeleton.png", 0)
|
||||||
mobs:register_egg("mobs_mc:stray", S("Stray"), "mobs_mc_spawn_icon_stray.png", 0)
|
mcl_mobs:register_egg("mobs_mc:stray", S("Stray"), "mobs_mc_spawn_icon_stray.png", 0)
|
||||||
|
|
|
@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
--################### WITHER SKELETON
|
--################### WITHER SKELETON
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:witherskeleton", {
|
mcl_mobs:register_mob("mobs_mc:witherskeleton", {
|
||||||
description = S("Wither Skeleton"),
|
description = S("Wither Skeleton"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -96,7 +96,7 @@ mobs:register_mob("mobs_mc:witherskeleton", {
|
||||||
})
|
})
|
||||||
|
|
||||||
--spawn
|
--spawn
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:witherskeleton",
|
"mobs_mc:witherskeleton",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -112,4 +112,4 @@ mobs_mc.spawn_height.nether_min,
|
||||||
mobs_mc.spawn_height.nether_max)
|
mobs_mc.spawn_height.nether_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "mobs_mc_spawn_icon_witherskeleton.png", 0)
|
mcl_mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "mobs_mc_spawn_icon_witherskeleton.png", 0)
|
||||||
|
|
|
@ -109,7 +109,7 @@ local slime_big = {
|
||||||
on_die = spawn_children_on_die("mobs_mc:slime_small", 4, 1.0, 1.5),
|
on_die = spawn_children_on_die("mobs_mc:slime_small", 4, 1.0, 1.5),
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
}
|
}
|
||||||
mobs:register_mob("mobs_mc:slime_big", slime_big)
|
mcl_mobs:register_mob("mobs_mc:slime_big", slime_big)
|
||||||
|
|
||||||
local slime_small = table.copy(slime_big)
|
local slime_small = table.copy(slime_big)
|
||||||
slime_small.sounds.base_pitch = 1.15
|
slime_small.sounds.base_pitch = 1.15
|
||||||
|
@ -126,7 +126,7 @@ slime_small.run_velocity = 1.3
|
||||||
slime_small.jump_height = 4.3
|
slime_small.jump_height = 4.3
|
||||||
slime_small.spawn_small_alternative = "mobs_mc:slime_tiny"
|
slime_small.spawn_small_alternative = "mobs_mc:slime_tiny"
|
||||||
slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 4, 0.6, 1.0)
|
slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 4, 0.6, 1.0)
|
||||||
mobs:register_mob("mobs_mc:slime_small", slime_small)
|
mcl_mobs:register_mob("mobs_mc:slime_small", slime_small)
|
||||||
|
|
||||||
local slime_tiny = table.copy(slime_big)
|
local slime_tiny = table.copy(slime_big)
|
||||||
slime_tiny.sounds.base_pitch = 1.3
|
slime_tiny.sounds.base_pitch = 1.3
|
||||||
|
@ -151,12 +151,12 @@ slime_tiny.jump_height = 3
|
||||||
slime_tiny.spawn_small_alternative = nil
|
slime_tiny.spawn_small_alternative = nil
|
||||||
slime_tiny.on_die = nil
|
slime_tiny.on_die = nil
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:slime_tiny", slime_tiny)
|
mcl_mobs:register_mob("mobs_mc:slime_tiny", slime_tiny)
|
||||||
|
|
||||||
local smin = mobs_mc.spawn_height.overworld_min
|
local smin = mobs_mc.spawn_height.overworld_min
|
||||||
local smax = mobs_mc.spawn_height.water - 23
|
local smax = mobs_mc.spawn_height.water - 23
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:slime_tiny",
|
"mobs_mc:slime_tiny",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -200,7 +200,7 @@ minetest.LIGHT_MAX+1,
|
||||||
smin,
|
smin,
|
||||||
smax)
|
smax)
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:slime_small",
|
"mobs_mc:slime_small",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -244,7 +244,7 @@ minetest.LIGHT_MAX+1,
|
||||||
smin,
|
smin,
|
||||||
smax)
|
smax)
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:slime_big",
|
"mobs_mc:slime_big",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -348,7 +348,7 @@ local magma_cube_big = {
|
||||||
on_die = spawn_children_on_die("mobs_mc:magma_cube_small", 3, 0.8, 1.5),
|
on_die = spawn_children_on_die("mobs_mc:magma_cube_small", 3, 0.8, 1.5),
|
||||||
fire_resistant = true,
|
fire_resistant = true,
|
||||||
}
|
}
|
||||||
mobs:register_mob("mobs_mc:magma_cube_big", magma_cube_big)
|
mcl_mobs:register_mob("mobs_mc:magma_cube_big", magma_cube_big)
|
||||||
|
|
||||||
local magma_cube_small = table.copy(magma_cube_big)
|
local magma_cube_small = table.copy(magma_cube_big)
|
||||||
magma_cube_small.sounds.jump = "mobs_mc_magma_cube_small"
|
magma_cube_small.sounds.jump = "mobs_mc_magma_cube_small"
|
||||||
|
@ -369,7 +369,7 @@ magma_cube_small.reach = 2.75
|
||||||
magma_cube_small.armor = 66
|
magma_cube_small.armor = 66
|
||||||
magma_cube_small.spawn_small_alternative = "mobs_mc:magma_cube_tiny"
|
magma_cube_small.spawn_small_alternative = "mobs_mc:magma_cube_tiny"
|
||||||
magma_cube_small.on_die = spawn_children_on_die("mobs_mc:magma_cube_tiny", 4, 0.6, 1.0)
|
magma_cube_small.on_die = spawn_children_on_die("mobs_mc:magma_cube_tiny", 4, 0.6, 1.0)
|
||||||
mobs:register_mob("mobs_mc:magma_cube_small", magma_cube_small)
|
mcl_mobs:register_mob("mobs_mc:magma_cube_small", magma_cube_small)
|
||||||
|
|
||||||
local magma_cube_tiny = table.copy(magma_cube_big)
|
local magma_cube_tiny = table.copy(magma_cube_big)
|
||||||
magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small"
|
magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small"
|
||||||
|
@ -391,13 +391,13 @@ magma_cube_tiny.drops = {}
|
||||||
magma_cube_tiny.spawn_small_alternative = nil
|
magma_cube_tiny.spawn_small_alternative = nil
|
||||||
magma_cube_tiny.on_die = nil
|
magma_cube_tiny.on_die = nil
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny)
|
mcl_mobs:register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny)
|
||||||
|
|
||||||
|
|
||||||
local mmin = mobs_mc.spawn_height.nether_min
|
local mmin = mobs_mc.spawn_height.nether_min
|
||||||
local mmax = mobs_mc.spawn_height.nether_max
|
local mmax = mobs_mc.spawn_height.nether_max
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:magma_cube_tiny",
|
"mobs_mc:magma_cube_tiny",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -413,7 +413,7 @@ mmin,
|
||||||
mmax)
|
mmax)
|
||||||
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:magma_cube_small",
|
"mobs_mc:magma_cube_small",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -428,7 +428,7 @@ minetest.LIGHT_MAX+1,
|
||||||
mmin,
|
mmin,
|
||||||
mmax)
|
mmax)
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:magma_cube_big",
|
"mobs_mc:magma_cube_big",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -443,11 +443,11 @@ minetest.LIGHT_MAX+1,
|
||||||
mmin,
|
mmin,
|
||||||
mmax)
|
mmax)
|
||||||
|
|
||||||
--mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11000, 4, mmin, mmax)
|
--mcl_mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11000, 4, mmin, mmax)
|
||||||
--mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11100, 4, mmin, mmax)
|
--mcl_mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11100, 4, mmin, mmax)
|
||||||
--mobs:spawn_specific("mobs_mc:magma_cube_big", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11200, 4, mmin, mmax)
|
--mcl_mobs:spawn_specific("mobs_mc:magma_cube_big", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11200, 4, mmin, mmax)
|
||||||
|
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:magma_cube_big", S("Magma Cube"), "mobs_mc_spawn_icon_magmacube.png")
|
mcl_mobs:register_egg("mobs_mc:magma_cube_big", S("Magma Cube"), "mobs_mc_spawn_icon_magmacube.png")
|
||||||
mobs:register_egg("mobs_mc:slime_big", S("Slime"), "mobs_mc_spawn_icon_slime.png")
|
mcl_mobs:register_egg("mobs_mc:slime_big", S("Slime"), "mobs_mc_spawn_icon_slime.png")
|
||||||
|
|
|
@ -20,7 +20,7 @@ local gotten_texture = {
|
||||||
"blank.png",
|
"blank.png",
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:snowman", {
|
mcl_mobs:register_mob("mobs_mc:snowman", {
|
||||||
description = S("Snow Golem"),
|
description = S("Snow Golem"),
|
||||||
type = "npc",
|
type = "npc",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -196,4 +196,4 @@ mobs_mc.tools.check_snow_golem_summon = function(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spawn egg
|
-- Spawn egg
|
||||||
mobs:register_egg("mobs_mc:snowman", S("Snow Golem"), "mobs_mc_spawn_icon_snowman.png", 0)
|
mcl_mobs:register_egg("mobs_mc:snowman", S("Snow Golem"), "mobs_mc_spawn_icon_snowman.png", 0)
|
||||||
|
|
|
@ -69,7 +69,7 @@ local spider = {
|
||||||
run_end = 20,
|
run_end = 20,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
mobs:register_mob("mobs_mc:spider", spider)
|
mcl_mobs:register_mob("mobs_mc:spider", spider)
|
||||||
|
|
||||||
-- Cave spider
|
-- Cave spider
|
||||||
local cave_spider = table.copy(spider)
|
local cave_spider = table.copy(spider)
|
||||||
|
@ -86,10 +86,10 @@ cave_spider.walk_velocity = 1.3
|
||||||
cave_spider.run_velocity = 3.2
|
cave_spider.run_velocity = 3.2
|
||||||
cave_spider.sounds = table.copy(spider.sounds)
|
cave_spider.sounds = table.copy(spider.sounds)
|
||||||
cave_spider.sounds.base_pitch = 1.25
|
cave_spider.sounds.base_pitch = 1.25
|
||||||
mobs:register_mob("mobs_mc:cave_spider", cave_spider)
|
mcl_mobs:register_mob("mobs_mc:cave_spider", cave_spider)
|
||||||
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:spider",
|
"mobs_mc:spider",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -243,5 +243,5 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:spider", S("Spider"), "mobs_mc_spawn_icon_spider.png", 0)
|
mcl_mobs:register_egg("mobs_mc:spider", S("Spider"), "mobs_mc_spawn_icon_spider.png", 0)
|
||||||
mobs:register_egg("mobs_mc:cave_spider", S("Cave Spider"), "mobs_mc_spawn_icon_cave_spider.png", 0)
|
mcl_mobs:register_egg("mobs_mc:cave_spider", S("Cave Spider"), "mobs_mc_spawn_icon_cave_spider.png", 0)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:squid", {
|
mcl_mobs:register_mob("mobs_mc:squid", {
|
||||||
description = S("Squid"),
|
description = S("Squid"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "water",
|
spawn_class = "water",
|
||||||
|
@ -63,7 +63,7 @@ mobs:register_mob("mobs_mc:squid", {
|
||||||
|
|
||||||
local water = mobs_mc.spawn_height.water
|
local water = mobs_mc.spawn_height.water
|
||||||
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:squid",
|
"mobs_mc:squid",
|
||||||
"overworld",
|
"overworld",
|
||||||
"water",
|
"water",
|
||||||
|
@ -217,4 +217,4 @@ water-16,
|
||||||
water+1)
|
water+1)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:squid", S("Squid"), "mobs_mc_spawn_icon_squid.png", 0)
|
mcl_mobs:register_egg("mobs_mc:squid", S("Squid"), "mobs_mc_spawn_icon_squid.png", 0)
|
||||||
|
|
Before Width: | Height: | Size: 99 B After Width: | Height: | Size: 99 B |
|
@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
--################### VEX
|
--################### VEX
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:vex", {
|
mcl_mobs:register_mob("mobs_mc:vex", {
|
||||||
description = S("Vex"),
|
description = S("Vex"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -94,4 +94,4 @@ mobs:register_mob("mobs_mc:vex", {
|
||||||
|
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:vex", S("Vex"), "mobs_mc_spawn_icon_vex.png", 0)
|
mcl_mobs:register_egg("mobs_mc:vex", S("Vex"), "mobs_mc_spawn_icon_vex.png", 0)
|
||||||
|
|
|
@ -577,7 +577,7 @@ local function go_home(entity)
|
||||||
entity.state = "go_home"
|
entity.state = "go_home"
|
||||||
local b=entity._bed
|
local b=entity._bed
|
||||||
if not b then return end
|
if not b then return end
|
||||||
mobs:gopath(entity,b,function(entity,b)
|
mcl_mobs:gopath(entity,b,function(entity,b)
|
||||||
if vector.distance(entity.object:get_pos(),b) < 2 then
|
if vector.distance(entity.object:get_pos(),b) < 2 then
|
||||||
entity.state = "stand"
|
entity.state = "stand"
|
||||||
set_velocity(entity,0)
|
set_velocity(entity,0)
|
||||||
|
@ -619,7 +619,7 @@ local function look_for_job(self)
|
||||||
local m=minetest.get_meta(n)
|
local m=minetest.get_meta(n)
|
||||||
if m:get_string("villager") == "" then
|
if m:get_string("villager") == "" then
|
||||||
--minetest.log("goingt to jobsite "..minetest.pos_to_string(n) )
|
--minetest.log("goingt to jobsite "..minetest.pos_to_string(n) )
|
||||||
local gp = mobs:gopath(self,n,function()
|
local gp = mcl_mobs:gopath(self,n,function()
|
||||||
--minetest.log("arrived jobsite "..minetest.pos_to_string(n) )
|
--minetest.log("arrived jobsite "..minetest.pos_to_string(n) )
|
||||||
end)
|
end)
|
||||||
if gp then return end
|
if gp then return end
|
||||||
|
@ -1200,7 +1200,7 @@ end)
|
||||||
|
|
||||||
--[=======[ MOB REGISTRATION AND SPAWNING ]=======]
|
--[=======[ MOB REGISTRATION AND SPAWNING ]=======]
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:villager", {
|
mcl_mobs:register_mob("mobs_mc:villager", {
|
||||||
description = S("Villager"),
|
description = S("Villager"),
|
||||||
type = "npc",
|
type = "npc",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -1259,7 +1259,7 @@ mobs:register_mob("mobs_mc:villager", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if clicker then
|
if clicker then
|
||||||
mobs:feed_tame(self, clicker, 1, true, false)
|
mcl_mobs:feed_tame(self, clicker, 1, true, false)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return true --do not pick up
|
return true --do not pick up
|
||||||
|
@ -1267,7 +1267,7 @@ mobs:register_mob("mobs_mc:villager", {
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
local trg=vector.new(0,9,0)
|
local trg=vector.new(0,9,0)
|
||||||
if self._jobsite then
|
if self._jobsite then
|
||||||
mobs:gopath(self,self._jobsite,function()
|
mcl_mobs:gopath(self,self._jobsite,function()
|
||||||
--minetest.log("arrived at jobsite")
|
--minetest.log("arrived at jobsite")
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -1375,7 +1375,7 @@ mobs:register_mob("mobs_mc:villager", {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:villager",
|
"mobs_mc:villager",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -1406,4 +1406,4 @@ mobs_mc.spawn_height.water+1,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:villager", S("Villager"), "mobs_mc_spawn_icon_villager.png", 0)
|
mcl_mobs:register_egg("mobs_mc:villager", S("Villager"), "mobs_mc_spawn_icon_villager.png", 0)
|
||||||
|
|
|
@ -11,7 +11,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
local pr = PseudoRandom(os.time()*666)
|
local pr = PseudoRandom(os.time()*666)
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:evoker", {
|
mcl_mobs:register_mob("mobs_mc:evoker", {
|
||||||
description = S("Evoker"),
|
description = S("Evoker"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -84,4 +84,4 @@ mobs:register_mob("mobs_mc:evoker", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:evoker", S("Evoker"), "mobs_mc_spawn_icon_evoker.png", 0)
|
mcl_mobs:register_egg("mobs_mc:evoker", S("Evoker"), "mobs_mc_spawn_icon_evoker.png", 0)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
local mod_bows = minetest.get_modpath("mcl_bows") ~= nil
|
local mod_bows = minetest.get_modpath("mcl_bows") ~= nil
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:illusioner", {
|
mcl_mobs:register_mob("mobs_mc:illusioner", {
|
||||||
description = S("Illusioner"),
|
description = S("Illusioner"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -61,4 +61,4 @@ mobs:register_mob("mobs_mc:illusioner", {
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:register_egg("mobs_mc:illusioner", S("Illusioner"), "mobs_mc_spawn_icon_illusioner.png", 0)
|
mcl_mobs:register_egg("mobs_mc:illusioner", S("Illusioner"), "mobs_mc_spawn_icon_illusioner.png", 0)
|
||||||
|
|
|
@ -10,7 +10,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:vindicator", {
|
mcl_mobs:register_mob("mobs_mc:vindicator", {
|
||||||
description = S("Vindicator"),
|
description = S("Vindicator"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -72,4 +72,4 @@ mobs:register_mob("mobs_mc:vindicator", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:vindicator", S("Vindicator"), "mobs_mc_spawn_icon_vindicator.png", 0)
|
mcl_mobs:register_egg("mobs_mc:vindicator", S("Vindicator"), "mobs_mc_spawn_icon_vindicator.png", 0)
|
||||||
|
|
|
@ -25,7 +25,7 @@ local professions = {
|
||||||
nitwit = "mobs_mc_villager.png",
|
nitwit = "mobs_mc_villager.png",
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:villager_zombie", {
|
mcl_mobs:register_mob("mobs_mc:villager_zombie", {
|
||||||
description = S("Zombie Villager"),
|
description = S("Zombie Villager"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -147,7 +147,7 @@ mobs:register_mob("mobs_mc:villager_zombie", {
|
||||||
harmed_by_heal = true,
|
harmed_by_heal = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:villager_zombie",
|
"mobs_mc:villager_zombie",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -239,7 +239,7 @@ mobs:spawn_specific(
|
||||||
4,
|
4,
|
||||||
mobs_mc.spawn_height.overworld_min,
|
mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
--mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max)
|
--mcl_mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:villager_zombie", S("Zombie Villager"), "mobs_mc_spawn_icon_zombie_villager.png", 0)
|
mcl_mobs:register_egg("mobs_mc:villager_zombie", S("Zombie Villager"), "mobs_mc_spawn_icon_zombie_villager.png", 0)
|
||||||
|
|
|
@ -12,7 +12,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:witch", {
|
mcl_mobs:register_mob("mobs_mc:witch", {
|
||||||
description = S("Witch"),
|
description = S("Witch"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -72,7 +72,7 @@ mobs:register_mob("mobs_mc:witch", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- potion projectile (EXPERIMENTAL)
|
-- potion projectile (EXPERIMENTAL)
|
||||||
mobs:register_arrow("mobs_mc:potion_arrow", {
|
mcl_mobs:register_arrow("mobs_mc:potion_arrow", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 0.5, y = 0.5},
|
visual_size = {x = 0.5, y = 0.5},
|
||||||
--textures = {"vessels_glass_bottle.png"}, --TODO fix to else if default
|
--textures = {"vessels_glass_bottle.png"}, --TODO fix to else if default
|
||||||
|
@ -101,9 +101,9 @@ mobs:register_arrow("mobs_mc:potion_arrow", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- TODO: Spawn when witch works properly <- eventually -j4i
|
-- TODO: Spawn when witch works properly <- eventually -j4i
|
||||||
--mobs:spawn_specific("mobs_mc:witch", mobs_mc.spawn.jungle, {"air"}, 0, minetest.LIGHT_MAX-6, 12, 20000, 2, mobs_mc.spawn_height.water-6, mobs_mc.spawn_height.overworld_max)
|
--mcl_mobs:spawn_specific("mobs_mc:witch", mobs_mc.spawn.jungle, {"air"}, 0, minetest.LIGHT_MAX-6, 12, 20000, 2, mobs_mc.spawn_height.water-6, mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:witch", S("Witch"), "mobs_mc_spawn_icon_witch.png", 0, true)
|
mcl_mobs:register_egg("mobs_mc:witch", S("Witch"), "mobs_mc_spawn_icon_witch.png", 0, true)
|
||||||
|
|
||||||
mcl_wip.register_wip_item("mobs_mc:witch")
|
mcl_wip.register_wip_item("mobs_mc:witch")
|
||||||
|
|
|
@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
--################### WITHER
|
--################### WITHER
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:wither", {
|
mcl_mobs:register_mob("mobs_mc:wither", {
|
||||||
description = S("Wither"),
|
description = S("Wither"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
@ -83,7 +83,7 @@ mobs:register_mob("mobs_mc:wither", {
|
||||||
|
|
||||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||||
|
|
||||||
mobs:register_arrow("mobs_mc:wither_skull", {
|
mcl_mobs:register_arrow("mobs_mc:wither_skull", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 0.75, y = 0.75},
|
visual_size = {x = 0.75, y = 0.75},
|
||||||
-- TODO: 3D projectile, replace tetxture
|
-- TODO: 3D projectile, replace tetxture
|
||||||
|
@ -96,7 +96,7 @@ mobs:register_arrow("mobs_mc:wither_skull", {
|
||||||
full_punch_interval = 0.5,
|
full_punch_interval = 0.5,
|
||||||
damage_groups = {fleshy = 8},
|
damage_groups = {fleshy = 8},
|
||||||
}, nil)
|
}, nil)
|
||||||
mobs:boom(self, self.object:get_pos(), 1)
|
mcl_mobs:boom(self, self.object:get_pos(), 1)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_mob = function(self, mob)
|
hit_mob = function(self, mob)
|
||||||
|
@ -104,17 +104,17 @@ mobs:register_arrow("mobs_mc:wither_skull", {
|
||||||
full_punch_interval = 0.5,
|
full_punch_interval = 0.5,
|
||||||
damage_groups = {fleshy = 8},
|
damage_groups = {fleshy = 8},
|
||||||
}, nil)
|
}, nil)
|
||||||
mobs:boom(self, self.object:get_pos(), 1)
|
mcl_mobs:boom(self, self.object:get_pos(), 1)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- node hit, explode
|
-- node hit, explode
|
||||||
hit_node = function(self, pos, node)
|
hit_node = function(self, pos, node)
|
||||||
mobs:boom(self, pos, 1)
|
mcl_mobs:boom(self, pos, 1)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
-- TODO: Add blue wither skull
|
-- TODO: Add blue wither skull
|
||||||
|
|
||||||
--Spawn egg
|
--Spawn egg
|
||||||
mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0, true)
|
mcl_mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0, true)
|
||||||
|
|
||||||
mcl_wip.register_wip_item("mobs_mc:wither")
|
mcl_wip.register_wip_item("mobs_mc:wither")
|
||||||
|
|
|
@ -57,7 +57,7 @@ local wolf = {
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
follow = mobs_mc.follow.wolf,
|
follow = mobs_mc.follow.wolf,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
-- Try to tame wolf (intentionally does NOT use mobs:feed_tame)
|
-- Try to tame wolf (intentionally does NOT use mcl_mobs:feed_tame)
|
||||||
local tool = clicker:get_wielded_item()
|
local tool = clicker:get_wielded_item()
|
||||||
|
|
||||||
local dog, ent
|
local dog, ent
|
||||||
|
@ -94,7 +94,7 @@ local wolf = {
|
||||||
specific_attack = { "player", "mobs_mc:sheep" },
|
specific_attack = { "player", "mobs_mc:sheep" },
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:wolf", wolf)
|
mcl_mobs:register_mob("mobs_mc:wolf", wolf)
|
||||||
|
|
||||||
-- Tamed wolf
|
-- Tamed wolf
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ dog.specific_attack = nil
|
||||||
dog.on_rightclick = function(self, clicker)
|
dog.on_rightclick = function(self, clicker)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
|
|
||||||
if mobs:protect(self, clicker) then
|
if mcl_mobs:protect(self, clicker) then
|
||||||
return
|
return
|
||||||
elseif item:get_name() ~= "" and mobs:capture_mob(self, clicker, 0, 2, 80, false, nil) then
|
elseif item:get_name() ~= "" and mcl_mobs:capture_mob(self, clicker, 0, 2, 80, false, nil) then
|
||||||
return
|
return
|
||||||
elseif is_food(item:get_name()) then
|
elseif is_food(item:get_name()) then
|
||||||
-- Feed to increase health
|
-- Feed to increase health
|
||||||
|
@ -230,10 +230,10 @@ dog.on_rightclick = function(self, clicker)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:dog", dog)
|
mcl_mobs:register_mob("mobs_mc:dog", dog)
|
||||||
|
|
||||||
-- Spawn
|
-- Spawn
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:wolf",
|
"mobs_mc:wolf",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -263,4 +263,4 @@ minetest.LIGHT_MAX+1,
|
||||||
mobs_mc.spawn_height.water+3,
|
mobs_mc.spawn_height.water+3,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
mobs:register_egg("mobs_mc:wolf", S("Wolf"), "mobs_mc_spawn_icon_wolf.png", 0)
|
mcl_mobs:register_egg("mobs_mc:wolf", S("Wolf"), "mobs_mc_spawn_icon_wolf.png", 0)
|
||||||
|
|
|
@ -97,7 +97,7 @@ local zombie = {
|
||||||
harmed_by_heal = true,
|
harmed_by_heal = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:zombie", zombie)
|
mcl_mobs:register_mob("mobs_mc:zombie", zombie)
|
||||||
|
|
||||||
-- Baby zombie.
|
-- Baby zombie.
|
||||||
-- A smaller and more dangerous variant of the zombie
|
-- A smaller and more dangerous variant of the zombie
|
||||||
|
@ -112,7 +112,7 @@ baby_zombie.walk_velocity = 1.2
|
||||||
baby_zombie.run_velocity = 2.4
|
baby_zombie.run_velocity = 2.4
|
||||||
baby_zombie.child = 1
|
baby_zombie.child = 1
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:baby_zombie", baby_zombie)
|
mcl_mobs:register_mob("mobs_mc:baby_zombie", baby_zombie)
|
||||||
|
|
||||||
-- Husk.
|
-- Husk.
|
||||||
-- Desert variant of the zombie
|
-- Desert variant of the zombie
|
||||||
|
@ -130,7 +130,7 @@ husk.sunlight_damage = 0
|
||||||
husk.drops = drops_common
|
husk.drops = drops_common
|
||||||
-- TODO: Husks avoid water
|
-- TODO: Husks avoid water
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:husk", husk)
|
mcl_mobs:register_mob("mobs_mc:husk", husk)
|
||||||
|
|
||||||
-- Baby husk.
|
-- Baby husk.
|
||||||
-- A smaller and more dangerous variant of the husk
|
-- A smaller and more dangerous variant of the husk
|
||||||
|
@ -144,12 +144,12 @@ baby_husk.walk_velocity = 1.2
|
||||||
baby_husk.run_velocity = 2.4
|
baby_husk.run_velocity = 2.4
|
||||||
baby_husk.child = 1
|
baby_husk.child = 1
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:baby_husk", baby_husk)
|
mcl_mobs:register_mob("mobs_mc:baby_husk", baby_husk)
|
||||||
|
|
||||||
|
|
||||||
-- Spawning
|
-- Spawning
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:zombie",
|
"mobs_mc:zombie",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -241,7 +241,7 @@ mobs:spawn_specific(
|
||||||
mobs_mc.spawn_height.overworld_min,
|
mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
-- Baby zombie is 20 times less likely than regular zombies
|
-- Baby zombie is 20 times less likely than regular zombies
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:baby_zombie",
|
"mobs_mc:baby_zombie",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -334,7 +334,7 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:husk",
|
"mobs_mc:husk",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -348,7 +348,7 @@ mobs:spawn_specific(
|
||||||
4,
|
4,
|
||||||
mobs_mc.spawn_height.overworld_min,
|
mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:baby_husk",
|
"mobs_mc:baby_husk",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -364,5 +364,5 @@ mobs_mc.spawn_height.overworld_min,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- Spawn eggs
|
-- Spawn eggs
|
||||||
mobs:register_egg("mobs_mc:husk", S("Husk"), "mobs_mc_spawn_icon_husk.png", 0)
|
mcl_mobs:register_egg("mobs_mc:husk", S("Husk"), "mobs_mc_spawn_icon_husk.png", 0)
|
||||||
mobs:register_egg("mobs_mc:zombie", S("Zombie"), "mobs_mc_spawn_icon_zombie.png", 0)
|
mcl_mobs:register_egg("mobs_mc:zombie", S("Zombie"), "mobs_mc_spawn_icon_zombie.png", 0)
|
||||||
|
|
|
@ -89,7 +89,7 @@ local pigman = {
|
||||||
fire_damage_resistant = true,
|
fire_damage_resistant = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:pigman", pigman)
|
mcl_mobs:register_mob("mobs_mc:pigman", pigman)
|
||||||
|
|
||||||
-- Baby pigman.
|
-- Baby pigman.
|
||||||
-- A smaller and more dangerous variant of the pigman
|
-- A smaller and more dangerous variant of the pigman
|
||||||
|
@ -110,10 +110,10 @@ baby_pigman.run_velocity = 2.4
|
||||||
baby_pigman.light_damage = 0
|
baby_pigman.light_damage = 0
|
||||||
baby_pigman.child = 1
|
baby_pigman.child = 1
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:baby_pigman", baby_pigman)
|
mcl_mobs:register_mob("mobs_mc:baby_pigman", baby_pigman)
|
||||||
|
|
||||||
-- Regular spawning in the Nether
|
-- Regular spawning in the Nether
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:pigman",
|
"mobs_mc:pigman",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -128,7 +128,7 @@ minetest.LIGHT_MAX+1,
|
||||||
mobs_mc.spawn_height.nether_min,
|
mobs_mc.spawn_height.nether_min,
|
||||||
mobs_mc.spawn_height.nether_max)
|
mobs_mc.spawn_height.nether_max)
|
||||||
-- Baby zombie is 20 times less likely than regular zombies
|
-- Baby zombie is 20 times less likely than regular zombies
|
||||||
mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
"mobs_mc:baby_pigman",
|
"mobs_mc:baby_pigman",
|
||||||
"nether",
|
"nether",
|
||||||
"ground",
|
"ground",
|
||||||
|
@ -147,4 +147,4 @@ mobs_mc.spawn_height.nether_max)
|
||||||
--mobs:spawn_specific("mobs_mc:pigman", mobs_mc.spawn.nether_portal, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 500, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max)
|
--mobs:spawn_specific("mobs_mc:pigman", mobs_mc.spawn.nether_portal, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 500, 4, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max)
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
mobs:register_egg("mobs_mc:pigman", S("Zombie Pigman"), "mobs_mc_spawn_icon_zombie_pigman.png", 0)
|
mcl_mobs:register_egg("mobs_mc:pigman", S("Zombie Pigman"), "mobs_mc_spawn_icon_zombie_pigman.png", 0)
|
||||||
|
|
|
@ -172,44 +172,10 @@ mobs_mc.override.replace = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- List of nodes which endermen can take
|
|
||||||
mobs_mc.override.enderman_takable = {
|
|
||||||
-- Generic handling, useful for entensions
|
|
||||||
"group:enderman_takable",
|
|
||||||
}
|
|
||||||
mobs_mc.override.enderman_replace_on_take = {
|
|
||||||
}
|
|
||||||
mobs_mc.override.misc = {
|
mobs_mc.override.misc = {
|
||||||
totem_fail_nodes = { "mcl_core:void", "mcl_core:realm_barrier" },
|
totem_fail_nodes = { "mcl_core:void", "mcl_core:realm_barrier" },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox
|
|
||||||
-- and the textures have tranparent pixels.
|
|
||||||
local cbackground = "mobs_mc_gameconfig_enderman_cactus_background.png"
|
|
||||||
local ctiles = minetest.registered_nodes["mcl_core:cactus"].tiles
|
|
||||||
|
|
||||||
local ctable = {}
|
|
||||||
local last
|
|
||||||
for i=1, 6 do
|
|
||||||
if ctiles[i] then
|
|
||||||
last = ctiles[i]
|
|
||||||
end
|
|
||||||
table.insert(ctable, cbackground .. "^" .. last)
|
|
||||||
end
|
|
||||||
|
|
||||||
mobs_mc.override.enderman_block_texture_overrides = {
|
|
||||||
["mcl_core:cactus"] = ctable,
|
|
||||||
-- FIXME: replace colorize colors with colors from palette
|
|
||||||
["mcl_core:dirt_with_grass"] =
|
|
||||||
{
|
|
||||||
"mcl_core_grass_block_top.png^[colorize:green:90",
|
|
||||||
"default_dirt.png",
|
|
||||||
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
|
|
||||||
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
|
|
||||||
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
|
|
||||||
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)"}
|
|
||||||
}
|
|
||||||
|
|
||||||
-- List of nodes on which mobs can spawn
|
-- List of nodes on which mobs can spawn
|
||||||
mobs_mc.override.spawn = {
|
mobs_mc.override.spawn = {
|
||||||
solid = { "group:solid", }, -- spawn on "solid" nodes
|
solid = { "group:solid", }, -- spawn on "solid" nodes
|
||||||
|
|
|
@ -78,7 +78,7 @@ end
|
||||||
|
|
||||||
function mcl_bossbars.update_boss(object, name, color)
|
function mcl_bossbars.update_boss(object, name, color)
|
||||||
local props = object:get_luaentity()
|
local props = object:get_luaentity()
|
||||||
if not props or not props._cmi_is_mob then
|
if not props or not props.is_mob then
|
||||||
props = object:get_properties()
|
props = object:get_properties()
|
||||||
props.health = object:get_hp()
|
props.health = object:get_hp()
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,7 +28,7 @@ local function pp_on_timer(pos, elapsed)
|
||||||
local obj_does_activate = function(obj, activated_by)
|
local obj_does_activate = function(obj, activated_by)
|
||||||
if activated_by.any then
|
if activated_by.any then
|
||||||
return true
|
return true
|
||||||
elseif activated_by.mob and obj:get_luaentity() and obj:get_luaentity()._cmi_is_mob == true then
|
elseif activated_by.mob and obj:get_luaentity() and obj:get_luaentity().is_mob == true then
|
||||||
return true
|
return true
|
||||||
elseif activated_by.player and obj:is_player() then
|
elseif activated_by.player and obj:is_player() then
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -106,7 +106,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||||
local mobname = ent.name
|
local mobname = ent.name
|
||||||
local def = minetest.registered_entities[mobname]
|
local def = minetest.registered_entities[mobname]
|
||||||
-- Approximation of monster detection range
|
-- Approximation of monster detection range
|
||||||
if def._cmi_is_mob and ((mobname ~= "mobs_mc:pigman" and def.type == "monster" and not monster_exceptions[mobname]) or (mobname == "mobs_mc:pigman" and ent.state == "attack")) then
|
if def.is_mob and ((mobname ~= "mobs_mc:pigman" and def.type == "monster" and not monster_exceptions[mobname]) or (mobname == "mobs_mc:pigman" and ent.state == "attack")) then
|
||||||
if math.abs(bed_pos.y - obj:get_pos().y) <= 5 then
|
if math.abs(bed_pos.y - obj:get_pos().y) <= 5 then
|
||||||
return false, S("You can't sleep now, monsters are nearby!")
|
return false, S("You can't sleep now, monsters are nearby!")
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ function mcl_bells.ring_once(pos)
|
||||||
local vv=minetest.get_objects_inside_radius(pos,150)
|
local vv=minetest.get_objects_inside_radius(pos,150)
|
||||||
for _,o in pairs(vv) do
|
for _,o in pairs(vv) do
|
||||||
if o.type == "npc" then
|
if o.type == "npc" then
|
||||||
mobs:gopath(o:get_luaentity(),pos,function() end)
|
mcl_mobs:gopath(o:get_luaentity(),pos,function() end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -203,7 +203,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
ok = true
|
ok = true
|
||||||
elseif obj:get_luaentity() then
|
elseif obj:get_luaentity() then
|
||||||
if (obj:get_luaentity()._cmi_is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
if (obj:get_luaentity().is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -226,7 +226,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
local obj = closest_object
|
local obj = closest_object
|
||||||
local is_player = obj:is_player()
|
local is_player = obj:is_player()
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
|
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua.is_mob or lua._hittable_by_projectile))) then
|
||||||
if obj:get_hp() > 0 then
|
if obj:get_hp() > 0 then
|
||||||
-- Check if there is no solid node between arrow and object
|
-- Check if there is no solid node between arrow and object
|
||||||
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
||||||
|
|
|
@ -24,7 +24,7 @@ local function damage_explosion(self, damagemulitplier)
|
||||||
for _,obj in pairs(objects) do
|
for _,obj in pairs(objects) do
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
mcl_util.deal_damage(obj, damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos()), {type = "explosion"})
|
mcl_util.deal_damage(obj, damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos()), {type = "explosion"})
|
||||||
elseif obj:get_luaentity()._cmi_is_mob then
|
elseif obj:get_luaentity().is_mob then
|
||||||
obj:punch(self.object, 1.0, {
|
obj:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos())},
|
damage_groups={fleshy=damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos())},
|
||||||
|
@ -415,7 +415,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
ok = true
|
ok = true
|
||||||
elseif obj:get_luaentity() then
|
elseif obj:get_luaentity() then
|
||||||
if (obj:get_luaentity()._cmi_is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
if (obj:get_luaentity().is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -438,7 +438,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
local obj = closest_object
|
local obj = closest_object
|
||||||
local is_player = obj:is_player()
|
local is_player = obj:is_player()
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua._cmi_is_mob or lua._hittable_by_projectile))) then
|
if obj == self._shooter and self._time_in_air > 1.02 or obj ~= self._shooter and (is_player or (lua and (lua.is_mob or lua._hittable_by_projectile))) then
|
||||||
if obj:get_hp() > 0 then
|
if obj:get_hp() > 0 then
|
||||||
-- Check if there is no solid node between arrow and object
|
-- Check if there is no solid node between arrow and object
|
||||||
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)
|
||||||
|
|
|
@ -155,7 +155,7 @@ local function spawn_mobs(pos, elapsed)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- are we spawning a registered mob?
|
-- are we spawning a registered mob?
|
||||||
if not mobs.spawning_mobs[mob] then
|
if not mcl_mobs.spawning_mobs[mob] then
|
||||||
minetest.log("error", "[mcl_mobspawners] Mob Spawner: Mob doesn't exist: "..mob)
|
minetest.log("error", "[mcl_mobspawners] Mob Spawner: Mob doesn't exist: "..mob)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -167,7 +167,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
if is_player then
|
if is_player then
|
||||||
player:set_hp(math.min(player:get_properties().hp_max or 20, player:get_hp() + 1), { type = "set_hp", other = "regeneration" })
|
player:set_hp(math.min(player:get_properties().hp_max or 20, player:get_hp() + 1), { type = "set_hp", other = "regeneration" })
|
||||||
EF.regenerating[player].heal_timer = 0
|
EF.regenerating[player].heal_timer = 0
|
||||||
elseif entity and entity._cmi_is_mob then
|
elseif entity and entity.is_mob then
|
||||||
entity.health = math.min(entity.hp_max, entity.health + 1)
|
entity.health = math.min(entity.hp_max, entity.health + 1)
|
||||||
EF.regenerating[player].heal_timer = 0
|
EF.regenerating[player].heal_timer = 0
|
||||||
else -- stop regenerating if not a player or mob
|
else -- stop regenerating if not a player or mob
|
||||||
|
@ -545,7 +545,7 @@ function mcl_potions.is_obj_hit(self, pos)
|
||||||
|
|
||||||
if entity and entity.name ~= self.object:get_luaentity().name then
|
if entity and entity.name ~= self.object:get_luaentity().name then
|
||||||
|
|
||||||
if entity._cmi_is_mob then
|
if entity.is_mob then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ function mcl_potions.healing_func(player, hp)
|
||||||
hp = 1
|
hp = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if obj and obj._cmi_is_mob then
|
if obj and obj.is_mob then
|
||||||
obj.health = math.max(obj.health + hp, obj.hp_max)
|
obj.health = math.max(obj.health + hp, obj.hp_max)
|
||||||
elseif player:is_player() then
|
elseif player:is_player() then
|
||||||
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })
|
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })
|
||||||
|
|
|
@ -281,7 +281,7 @@ local function water_splash(obj, damage)
|
||||||
end
|
end
|
||||||
-- Damage mobs that are vulnerable to water
|
-- Damage mobs that are vulnerable to water
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if lua and lua._cmi_is_mob then
|
if lua and lua.is_mob then
|
||||||
obj:punch(obj, 1.0, {
|
obj:punch(obj, 1.0, {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {water_vulnerable=damage},
|
damage_groups = {water_vulnerable=damage},
|
||||||
|
|
|
@ -66,7 +66,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
for _, obj in pairs(minetest.get_objects_inside_radius(pos, d)) do
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, d)) do
|
||||||
|
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if obj:is_player() or entity._cmi_is_mob then
|
if obj:is_player() or entity.is_mob then
|
||||||
|
|
||||||
vals.def.potion_fun(obj)
|
vals.def.potion_fun(obj)
|
||||||
-- TODO: Apply timer penalty only if the potion effect was acutally applied
|
-- TODO: Apply timer penalty only if the potion effect was acutally applied
|
||||||
|
|
|
@ -110,7 +110,7 @@ function mcl_potions.register_splash(name, descr, color, def)
|
||||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 4)) do
|
||||||
|
|
||||||
local entity = obj:get_luaentity()
|
local entity = obj:get_luaentity()
|
||||||
if obj:is_player() or entity._cmi_is_mob then
|
if obj:is_player() or entity.is_mob then
|
||||||
|
|
||||||
local pos2 = obj:get_pos()
|
local pos2 = obj:get_pos()
|
||||||
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
|
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
|
||||||
|
|
|
@ -216,7 +216,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
||||||
if obj ~= self._shooter and obj:is_player() then
|
if obj ~= self._shooter and obj:is_player() then
|
||||||
ok = true
|
ok = true
|
||||||
elseif obj:get_luaentity() then
|
elseif obj:get_luaentity() then
|
||||||
if obj ~= self._shooter and obj:get_luaentity()._cmi_is_mob then
|
if obj ~= self._shooter and obj:get_luaentity().is_mob then
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -238,7 +238,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
||||||
local obj = closest_object
|
local obj = closest_object
|
||||||
local is_player = obj:is_player()
|
local is_player = obj:is_player()
|
||||||
local lua = obj:get_luaentity()
|
local lua = obj:get_luaentity()
|
||||||
if obj ~= self._shooter and (is_player or (lua and lua._cmi_is_mob)) then
|
if obj ~= self._shooter and (is_player or (lua and lua.is_mob)) then
|
||||||
|
|
||||||
if obj:get_hp() > 0 then
|
if obj:get_hp() > 0 then
|
||||||
-- Check if there is no solid node between arrow and object
|
-- Check if there is no solid node between arrow and object
|
||||||
|
|
|
@ -64,7 +64,7 @@ local function check_object_hit(self, pos, dmg)
|
||||||
-- TODO: Deal knockback
|
-- TODO: Deal knockback
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return true
|
return true
|
||||||
elseif (entity._cmi_is_mob == true or entity._hittable_by_projectile) and (self._thrower ~= object) then
|
elseif (entity.is_mob == true or entity._hittable_by_projectile) and (self._thrower ~= object) then
|
||||||
-- FIXME: Knockback is broken
|
-- FIXME: Knockback is broken
|
||||||
object:punch(self.object, 1.0, {
|
object:punch(self.object, 1.0, {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
|
|
|
@ -38,7 +38,7 @@ minetest.register_node("mcl_villages:structblock", {drawtype="airlike",groups =
|
||||||
-- register inhabitants
|
-- register inhabitants
|
||||||
--
|
--
|
||||||
if minetest.get_modpath("mobs_mc") then
|
if minetest.get_modpath("mobs_mc") then
|
||||||
mobs:register_spawn("mobs_mc:villager", --name
|
mcl_mobs:register_spawn("mobs_mc:villager", --name
|
||||||
{"mcl_core:stonebrickcarved"}, --nodes
|
{"mcl_core:stonebrickcarved"}, --nodes
|
||||||
15, --max_light
|
15, --max_light
|
||||||
0, --min_light
|
0, --min_light
|
||||||
|
|
|
@ -4,7 +4,7 @@ local orig_func = minetest.registered_chatcommands["spawnentity"].func
|
||||||
local cmd = table.copy(minetest.registered_chatcommands["spawnentity"])
|
local cmd = table.copy(minetest.registered_chatcommands["spawnentity"])
|
||||||
cmd.func = function(name, param)
|
cmd.func = function(name, param)
|
||||||
local ent = minetest.registered_entities[param]
|
local ent = minetest.registered_entities[param]
|
||||||
if minetest.settings:get_bool("only_peaceful_mobs", false) and ent and ent._cmi_is_mob and ent.type == "monster" then
|
if minetest.settings:get_bool("only_peaceful_mobs", false) and ent and ent.is_mob and ent.type == "monster" then
|
||||||
return false, S("Only peaceful mobs allowed!")
|
return false, S("Only peaceful mobs allowed!")
|
||||||
else
|
else
|
||||||
local bool, msg = orig_func(name, param)
|
local bool, msg = orig_func(name, param)
|
||||||
|
|
|
@ -36,7 +36,7 @@ local function player_collision(player)
|
||||||
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
|
||||||
|
|
||||||
local ent = object:get_luaentity()
|
local ent = object:get_luaentity()
|
||||||
if (object:is_player() or (ent and ent._cmi_is_mob and object ~= player)) then
|
if (object:is_player() or (ent and ent.is_mob and object ~= player)) then
|
||||||
|
|
||||||
local pos2 = object:get_pos()
|
local pos2 = object:get_pos()
|
||||||
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
|
||||||
|
|
Loading…
Reference in a new issue