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:
cora 2022-05-25 21:19:07 +00:00
commit 8210fba65b
67 changed files with 381 additions and 515 deletions

View file

@ -78,7 +78,7 @@ function mcl_damage.from_punch(mcl_reason, object)
mcl_reason.type = "arrow"
elseif luaentity._is_fireball then
mcl_reason.type = "fireball"
elseif luaentity._cmi_is_mob then
elseif luaentity.is_mob then
mcl_reason.type = "mob"
end
mcl_reason.source = mcl_reason.source or luaentity._source_object

View file

@ -524,7 +524,7 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
if luaentity.deal_damage then
luaentity:deal_damage(damage, mcl_reason or {type = "generic"})
return
elseif luaentity._cmi_is_mob then
elseif luaentity.is_mob then
-- 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)
if luaentity.health > 0 then
@ -544,7 +544,7 @@ end
function mcl_util.get_hp(obj)
local luaentity = obj:get_luaentity()
if luaentity and luaentity._cmi_is_mob then
if luaentity and luaentity.is_mob then
return luaentity.health
else
return obj:get_hp()

View file

@ -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
local entity = obj:get_luaentity()
if entity and entity._cmi_is_mob then
if entity and entity.is_mob then
attach_object(self, obj)
break
end

View file

@ -1,9 +1,7 @@
-- API for Mobs Redo: MineClone 2 Edition (MRM)
mobs = {}
mobs.mod = "mrm"
mobs.version = "20210106" -- don't rely too much on this, rarely updated, if ever
mcl_mobs = {}
local MAX_MOB_NAME_LENGTH = 30
local HORNY_TIME = 30
@ -23,22 +21,8 @@ MOB_CAP.water = 15
-- Localize
local S = minetest.get_translator("mcl_mobs")
-- CMI support check
local use_cmi = minetest.global_exists("cmi")
-- Invisibility mod check
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
mcl_mobs.invis = {}
-- localize math functions
local pi = math.pi
@ -50,6 +34,7 @@ local max = math.max
local atann = math.atan
local random = math.random
local floor = math.floor
local atan = function(x)
if not x or x ~= x then
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_snowblock = "mcl_core:snowblock"
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",{
privs={maphack=true},
params = "<all>|<nametagged>|<range>",
@ -113,7 +86,7 @@ minetest.register_chatcommand("clearmobs",{
local p = minetest.get_player_by_name(n)
local num=tonumber(param)
for _,o in pairs(minetest.luaentities) do
if is_mob(o) then
if o.is_mob then
if param == "all" or
( param == "nametagged" and o.nametag ) or
( param == "" and not o.nametag and not o.tamed ) or
@ -199,7 +172,7 @@ local function object_in_range(self, object)
end
local factor
-- 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]
factor = factors and factors[self.name]
end
@ -246,7 +219,7 @@ local collision = function(self)
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
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 vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
@ -353,7 +326,7 @@ local set_yaw = function(self, yaw, delay, dtime)
end
-- 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)
end
@ -424,7 +397,7 @@ end
-- above function exported for mount.lua
function mobs:set_animation(self, anim)
function mcl_mobs:set_animation(self, anim)
set_animation(self, anim)
end
@ -628,7 +601,7 @@ local damage_effect = function(self, damage)
end
end
mobs.death_effect = function(pos, yaw, collisionbox, rotate)
mcl_mobs.death_effect = function(pos, yaw, collisionbox, rotate)
local min, max
if collisionbox then
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")
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))
end
end
@ -857,10 +830,6 @@ local check_for_death = function(self, cause, cmi_cause)
death_handle(self)
end
if use_cmi then
cmi.notify_die(self.object, cmi_cause)
end
if on_die_exit == true then
self.state = "die"
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
return
end
if use_cmi then
cmi.notify_die(self.object, cmi_cause)
end
death_handle(self)
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
mcl_burning.extinguish(self.object)
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
if length <= 0 then
kill(self)
@ -1042,7 +1008,7 @@ end
-- get node but use fallback for nil or unknown
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)
@ -1093,7 +1059,7 @@ local do_env_damage = function(self)
-- Deal light damage to mob, returns true if mob died
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
effect(pos, 5, "mcl_particles_smoke.png")
@ -1114,10 +1080,7 @@ local do_env_damage = function(self)
return true
end
end
local _, dim = nil, "overworld"
if mod_worlds then
_, dim = mcl_worlds.y_to_layer(pos.y)
end
local _, dim = mcl_worlds.y_to_layer(pos.y)
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
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]
-- 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
self.health = self.health - self.rain_damage
@ -1440,7 +1403,7 @@ end
local follow_holding = function(self, clicker)
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
end
@ -1578,10 +1541,7 @@ local breed = function(self)
return
end
-- Give XP
if mod_experience then
mcl_experience.throw_xp(pos, math.random(1, 7))
end
-- custom breed function
if parent1.on_breed then
@ -1591,7 +1551,7 @@ local breed = function(self)
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()
@ -1827,7 +1787,7 @@ local smart_mobs = function(self, s, p, dist, dtime)
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
@ -1962,7 +1922,7 @@ local monster_attack = function(self)
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 = ""
else
player = objs[n]
@ -2091,7 +2051,7 @@ local runaway_from = function(self)
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 (not object_in_range(self, objs[n])) then
type = ""
@ -2173,7 +2133,7 @@ local follow_flop = function(self)
for n = 1, #players do
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]
@ -2330,7 +2290,7 @@ local function go_to_pos(entity,b)
if b.x > s.x then yaw = yaw + math.pi end
entity.object:set_yaw(yaw)
set_velocity(entity,entity.follow_velocity)
mobs:set_animation(entity, "walk")
mcl_mobs:set_animation(entity, "walk")
end
local function check_doors(self)
@ -2576,7 +2536,7 @@ local do_states = function(self, dtime)
or not self.attack:get_pos()
or not object_in_range(self, self.attack)
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"
set_velocity(self, 0)
@ -2667,7 +2627,6 @@ local do_states = function(self, dtime)
local pos = self.object:get_pos()
if mod_explosions 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)
else
@ -2680,7 +2639,6 @@ local do_states = function(self, dtime)
entity_physics(pos, entity_damage_radius)
effect(pos, 32, "mcl_particles_smoke.png", nil, nil, node_break_radius, 1, 0)
end
end
mcl_burning.extinguish(self.object)
self.object:remove()
@ -2948,7 +2906,7 @@ local plane_adjacents = {
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 t = vector.offset(target,0,1,0)
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
-- exhaust attacker
if mod_hunger and is_player then
if is_player then
mcl_hunger.exhaust(hitter:get_player_name(), mcl_hunger.EXHAUST_ATTACK)
end
@ -3151,9 +3109,6 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
tflp = 0.2
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
@ -3168,7 +3123,6 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
damage = damage + (tool_capabilities.damage_groups[group] or 0)
* tmp * ((armor[group] or 0) / 100.0)
end
end
if weapon then
local fire_aspect_level = mcl_enchanting.get_enchantment(weapon, "fire_aspect")
@ -3193,13 +3147,6 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
return
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
punch_interval = tool_capabilities.full_punch_interval or 1.4
end
@ -3333,7 +3280,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
and self.state ~= "flop"
and (self.child == false or self.type == "monster")
and hitter:get_player_name() ~= self.owner
and not mobs.invis[ name ] then
and not mcl_mobs.invis[ name ] then
if not die then
-- attack whoever punched mob
@ -3407,10 +3354,6 @@ local mob_staticdata = function(self)
self.following = nil
self.state = "stand"
if use_cmi then
self.serialized_cmi_components = cmi.serialize_components(self._cmi_components)
end
local tmp = {}
for _,stat in pairs(self) do
@ -3588,11 +3531,6 @@ local mob_activate = function(self, staticdata, def, dtime)
if def.after_activate then
def.after_activate(self, staticdata, def, dtime)
end
if use_cmi then
self._cmi_components = cmi.activate_components(self.serialized_cmi_components)
cmi.notify_activate(self.object, dtime)
end
end
@ -3603,10 +3541,6 @@ local mob_step = function(self, dtime)
mcl_burning.tick(self.object, dtime, self)
end
if use_cmi then
cmi.notify_step(self.object, dtime)
end
local pos = self.object:get_pos()
local yaw = 0
@ -3841,7 +3775,7 @@ local do_tnt = function(obj, damage)
end
mobs.spawning_mobs = {}
mcl_mobs.spawning_mobs = {}
-- Code to execute before custom on_rightclick handling
local on_rightclick_prefix = function(self, clicker)
@ -3859,7 +3793,7 @@ local on_rightclick_prefix = function(self, clicker)
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()
clicker:set_wielded_item(item)
end
@ -3880,9 +3814,9 @@ local create_mob_on_rightclick = function(on_rightclick)
end
-- 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
if def.can_despawn ~= nil then
@ -4013,7 +3947,7 @@ minetest.register_entity(name, {
runaway_from = def.runaway_from,
owner_loyal = def.owner_loyal,
facing_fence = false,
_cmi_is_mob = true,
is_mob = true,
pushable = def.pushable or true,
@ -4061,6 +3995,7 @@ minetest.register_entity(name, {
--this is a temporary hack so mobs stop
--glitching and acting really weird with the
--default built in engine collision detection
self.is_mob = true
self.object:set_properties({
collide_with_objects = false,
})
@ -4079,11 +4014,11 @@ if minetest.get_modpath("doc_identifier") ~= nil then
doc.sub.identifier.register_object(name, "basics", "mobs")
end
end -- END mobs:register_mob function
end -- END mcl_mobs:register_mob function
-- 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
@ -4185,7 +4120,7 @@ function mobs:register_arrow(name, def)
if entity
and self.hit_mob
and entity._cmi_is_mob == true
and entity.is_mob == true
and tostring(player) ~= self.owner_id
and entity.name ~= self.object:get_luaentity().name then
self.hit_mob(self, player)
@ -4195,7 +4130,7 @@ function mobs:register_arrow(name, def)
if entity
and self.hit_object
and (not entity._cmi_is_mob)
and (not entity.is_mob)
and tostring(player) ~= self.owner_id
and entity.name ~= self.object:get_luaentity().name then
self.hit_object(self, player)
@ -4212,7 +4147,7 @@ end
-- 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", {
pos = pos,
gain = 1.0,
@ -4225,15 +4160,11 @@ end
-- make explosion with protection and tnt mod check
function mobs:boom(self, pos, strength, fire)
if mod_explosions then
function mcl_mobs:boom(self, pos, strength, fire)
if mobs_griefing and not minetest.is_protected(pos, "") then
mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object)
else
mobs:safe_boom(self, pos, strength)
end
else
mobs:safe_boom(self, pos, strength)
mcl_mobs:safe_boom(self, pos, strength)
end
-- 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:
-- * spawn_egg=1: Spawn egg (generic mob, no 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}
@ -4289,7 +4220,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
local name = placer:get_player_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
minetest.record_protection_violation(pointed_thing.under, name)
return itemstack
@ -4299,7 +4230,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
return itemstack
end
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()
end
return itemstack
@ -4339,7 +4270,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
end
-- 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()
end
end
@ -4353,19 +4284,19 @@ end
-- No-op in MCL2 (capturing mobs is not possible).
-- 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
end
-- No-op in MCL2 (protecting mobs is not possible).
function mobs:protect(self, clicker)
function mcl_mobs:protect(self, clicker)
return false
end
-- 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
return false
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 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()
@ -4440,7 +4371,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
end
-- 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)
if not child then
return
@ -4487,7 +4418,7 @@ end
-- 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
minetest.register_alias(old_name, new_name)
@ -4518,7 +4449,7 @@ minetest.register_globalstep(function(dtime)
local pos = player:get_pos()
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 47)) do
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.despawn_immediately = false
end

View file

@ -12,7 +12,7 @@ local crash_threshold = 6.5 -- ignored if enable_crash=false
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)
@ -119,7 +119,7 @@ end)
-------------------------------------------------------------------------------
function mobs.attach(entity, player)
function mcl_mobs.attach(entity, player)
local attach_at, eye_offset
@ -162,7 +162,7 @@ function mobs.attach(entity, player)
end
function mobs.detach(player, offset)
function mcl_mobs.detach(player, offset)
force_detach(player)
@ -185,7 +185,7 @@ function mobs.detach(player, offset)
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
@ -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 stand_anim then
mobs:set_animation(entity, stand_anim)
mcl_mobs:set_animation(entity, stand_anim)
end
return
@ -269,7 +269,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
-- set moving animation
if moving_anim then
mobs:set_animation(entity, moving_anim)
mcl_mobs:set_animation(entity, moving_anim)
end
-- Stop!
@ -388,7 +388,7 @@ end
-- 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 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
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
-- moving animation
mobs:set_animation(entity, moving_anim)
mcl_mobs:set_animation(entity, moving_anim)
end
end

View file

@ -195,7 +195,7 @@ local list_of_all_biomes = {
local function count_mobs(pos)
local num = 0
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
end
end
@ -205,7 +205,7 @@ end
-- 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
-- return true to stop spawning mob
end
@ -241,7 +241,7 @@ WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua??
local spawn_dictionary = {}
local summary_chance = 0
function mobs:spawn_setup(def)
function mcl_mobs:spawn_setup(def)
if not mobs_spawn then return end
if not def then
@ -275,10 +275,10 @@ function mobs:spawn_setup(def)
chance = tonumber(numbers[1]) or chance
aoc = tonumber(numbers[2]) or aoc
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
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
if chance < 1 then
@ -304,7 +304,7 @@ function mobs:spawn_setup(def)
summary_chance = summary_chance + chance
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?
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
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
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
--load information into the spawn dictionary

View file

@ -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
mobs_mc.spawn = {
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)
if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then
local tables = {"items", "follow", "replace", "spawn", "spawn_height", "misc"}
for t=1, #tables do
local tbl = tables[t]
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
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

View file

@ -198,7 +198,7 @@ if c("egg") then
local egg_GRAVITY = 9
local egg_VELOCITY = 19
mobs:register_arrow("mobs_mc:egg_entity", {
mcl_mobs:register_arrow("mobs_mc:egg_entity", {
visual = "sprite",
visual_size = {x=.5, y=.5},
textures = {"mobs_chicken_egg.png"},
@ -318,7 +318,7 @@ end
local snowball_GRAVITY = 9
local snowball_VELOCITY = 19
mobs:register_arrow("mobs_mc:snowball_entity", {
mcl_mobs:register_arrow("mobs_mc:snowball_entity", {
visual = "sprite",
visual_size = {x=.5, y=.5},
textures = {"mcl_throwing_snowball.png"},

View file

@ -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
end
function mobs:spawn_abm_check(pos, node, name)
function mcl_mobs:spawn_abm_check(pos, node, name)
-- 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
return true

View file

@ -4,7 +4,7 @@
local S = minetest.get_translator("mobs_mc")
mobs:register_mob("mobs_mc:agent", {
mcl_mobs:register_mob("mobs_mc:agent", {
type = "npc",
spawn_class = "passive",
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)

View file

@ -2,7 +2,7 @@
local S = minetest.get_translator("mobs_mc")
mobs:register_mob("mobs_mc:bat", {
mcl_mobs:register_mob("mobs_mc:bat", {
description = S("Bat"),
type = "animal",
spawn_class = "ambient",
@ -65,7 +65,7 @@ else
end
-- Spawn on solid blocks at or below Sea level and the selected light level
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:bat",
"overworld",
"ground",
@ -143,4 +143,4 @@ mobs_mc.spawn_height.water-1)
-- 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)

View file

@ -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"),
type = "monster",
spawn_class = "hostile",
@ -131,7 +131,7 @@ mobs:register_mob("mobs_mc:blaze", {
end,
})
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:blaze",
"nether",
"ground",
@ -145,7 +145,7 @@ mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- Blaze fireball
mobs:register_arrow("mobs_mc:blaze_fireball", {
mcl_mobs:register_arrow("mobs_mc:blaze_fireball", {
visual = "sprite",
visual_size = {x = 0.3, y = 0.3},
textures = {"mcl_fire_fire_charge.png"},
@ -200,4 +200,4 @@ mobs:register_arrow("mobs_mc:blaze_fireball", {
})
-- 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)

View file

@ -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"),
type = "animal",
spawn_class = "passive",
@ -69,9 +69,9 @@ mobs:register_mob("mobs_mc:chicken", {
fear_height = 4,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
if mcl_mobs:protect(self, clicker) then return end
if mcl_mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
end,
do_custom = function(self, dtime)
@ -101,7 +101,7 @@ mobs:register_mob("mobs_mc:chicken", {
})
--spawn
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:chicken",
"overworld",
"ground",
@ -151,4 +151,4 @@ mobs_mc.spawn_height.water,
mobs_mc.spawn_height.overworld_max)
-- 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)

View file

@ -49,8 +49,8 @@ local cow_def = {
},
follow = mobs_mc.follow.cow,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
if mcl_mobs:protect(self, clicker) then return end
if self.child then
return
@ -71,14 +71,14 @@ local cow_def = {
end
return
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end,
follow = mobs_mc.items.wheat,
view_range = 10,
fear_height = 4,
}
mobs:register_mob("mobs_mc:cow", cow_def)
mcl_mobs:register_mob("mobs_mc:cow", cow_def)
-- Mooshroom
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.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)
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
if mcl_mobs:protect(self, clicker) then return end
if self.child then
return
@ -140,13 +140,13 @@ mooshroom_def.on_rightclick = function(self, clicker)
minetest.add_item(pos, {name = mobs_mc.items.mushroom_stew})
end
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end
mobs:register_mob("mobs_mc:mooshroom", mooshroom_def)
mcl_mobs:register_mob("mobs_mc:mooshroom", mooshroom_def)
-- Spawning
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:cow",
"overworld",
"ground",
@ -198,7 +198,7 @@ mobs_mc.spawn_height.overworld_max)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:mooshroom",
"overworld",
"ground",
@ -215,5 +215,5 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- spawn egg
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:cow", S("Cow"), "mobs_mc_spawn_icon_cow.png", 0)
mcl_mobs:register_egg("mobs_mc:mooshroom", S("Mooshroom"), "mobs_mc_spawn_icon_mooshroom.png", 0)

View file

@ -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",
spawn_class = "hostile",
hp_min = 20,
@ -77,7 +77,7 @@ mobs:register_mob("mobs_mc:creeper", {
if self._forced_explosion_countdown_timer ~= nil then
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
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,
@ -129,7 +129,7 @@ mobs:register_mob("mobs_mc:creeper", {
view_range = 16,
})
mobs:register_mob("mobs_mc:creeper_charged", {
mcl_mobs:register_mob("mobs_mc:creeper_charged", {
description = S("Creeper"),
type = "monster",
spawn_class = "hostile",
@ -199,7 +199,7 @@ mobs:register_mob("mobs_mc:creeper_charged", {
if self._forced_explosion_countdown_timer ~= nil then
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
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,
@ -254,7 +254,7 @@ mobs:register_mob("mobs_mc:creeper_charged", {
glow = 3,
})
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:creeper",
"overworld",
"ground",
@ -408,4 +408,4 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- 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)

View file

@ -4,7 +4,7 @@
local S = minetest.get_translator("mobs_mc")
mobs:register_mob("mobs_mc:enderdragon", {
mcl_mobs:register_mob("mobs_mc:enderdragon", {
description = S("Ender Dragon"),
type = "monster",
spawn_class = "hostile",
@ -109,7 +109,7 @@ mobs:register_mob("mobs_mc:enderdragon", {
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
-- dragon fireball (projectile)
mobs:register_arrow("mobs_mc:dragon_fireball", {
mcl_mobs:register_arrow("mobs_mc:dragon_fireball", {
visual = "sprite",
visual_size = {x = 1.25, y = 1.25},
textures = {"mobs_mc_dragon_fireball.png"},
@ -133,10 +133,10 @@ mobs:register_arrow("mobs_mc:dragon_fireball", {
-- node hit, explode
hit_node = function(self, pos, node)
mobs:boom(self, pos, 2)
mcl_mobs:boom(self, pos, 2)
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")

View file

@ -48,6 +48,37 @@ local take_frequency_max = 245
local place_frequency_min = 235
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
-- the enderman holds (if any).
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 textures = {}
local last
if mobs_mc.enderman_block_texture_overrides[itemstring] then
if block_texture_overrides[itemstring] then
-- Texture override available? Use these instead!
textures = mobs_mc.enderman_block_texture_overrides[itemstring]
textures = block_texture_overrides[itemstring]
else
-- Extract the texture names
for i = 1, 6 do
@ -189,7 +220,7 @@ end
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"),
type = "monster",
spawn_class = "passive",
@ -388,7 +419,7 @@ mobs:register_mob("mobs_mc:enderman", {
self._take_place_timer = 0
self._next_take_place_time = math.random(place_frequency_min, place_frequency_max)
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
local r = pr:next(1, #takable_nodes)
local take_pos = takable_nodes[r]
@ -398,11 +429,7 @@ mobs:register_mob("mobs_mc:enderman", {
minetest.remove_node(take_pos)
local dug = minetest.get_node_or_nil(take_pos)
if dug and dug.name == "air" then
if mobs_mc.enderman_replace_on_take[node.name] then
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]
-- Update animation and texture accordingly (adds visibly carried block)
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.object:set_properties({ textures = self.base_texture })
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
minetest.sound_play(def.sounds.dug, {pos = take_pos, max_hear_distance = 16}, true)
end
@ -454,7 +481,7 @@ mobs:register_mob("mobs_mc:enderman", {
local def = minetest.registered_nodes[self._taken_node]
-- Update animation accordingly (removes visible block)
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
minetest.sound_play(def.sounds.place, {pos = place_pos, max_hear_distance = 16}, true)
end
@ -565,7 +592,7 @@ mobs:register_mob("mobs_mc:enderman", {
-- End spawn
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:enderman",
"end",
"ground",
@ -580,7 +607,7 @@ minetest.LIGHT_MAX+1,
mobs_mc.spawn_height.end_min,
mobs_mc.spawn_height.end_max)
-- Overworld spawn
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:enderman",
"overworld",
"ground",
@ -734,7 +761,7 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- Nether spawn (rare)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:enderman",
"nether",
"ground",
@ -750,4 +777,4 @@ mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- 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)

View file

@ -4,7 +4,7 @@
local S = minetest.get_translator("mobs_mc")
mobs:register_mob("mobs_mc:endermite", {
mcl_mobs:register_mob("mobs_mc:endermite", {
description = S("Endermite"),
type = "monster",
spawn_class = "hostile",
@ -38,4 +38,4 @@ mobs:register_mob("mobs_mc:endermite", {
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)

View file

@ -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"),
type = "monster",
spawn_class = "hostile",
@ -76,7 +76,7 @@ mobs:register_mob("mobs_mc:ghast", {
})
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:ghast",
"nether",
"ground",
@ -92,7 +92,7 @@ mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- fireball (projectile)
mobs:register_arrow("mobs_mc:fireball", {
mcl_mobs:register_arrow("mobs_mc:fireball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"mcl_fire_fire_charge.png"},
@ -105,7 +105,7 @@ mobs:register_arrow("mobs_mc:fireball", {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
mobs:boom(self, self.object:get_pos(), 1, true)
mcl_mobs:boom(self, self.object:get_pos(), 1, true)
end,
hit_mob = function(self, mob)
@ -113,11 +113,11 @@ mobs:register_arrow("mobs_mc:fireball", {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
mobs:boom(self, self.object:get_pos(), 1, true)
mcl_mobs:boom(self, self.object:get_pos(), 1, true)
end,
hit_node = function(self, pos, node)
mobs:boom(self, pos, 1, true)
mcl_mobs:boom(self, pos, 1, true)
end
})
@ -125,4 +125,4 @@ mobs:register_arrow("mobs_mc:fireball", {
-- 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)

View file

@ -4,7 +4,7 @@
local S = minetest.get_translator("mobs_mc")
mobs:register_mob("mobs_mc:guardian", {
mcl_mobs:register_mob("mobs_mc:guardian", {
description = S("Guardian"),
type = "monster",
spawn_class = "hostile",
@ -99,7 +99,7 @@ mobs:register_mob("mobs_mc:guardian", {
-- Spawning disabled due to size issues
-- 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
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)

View file

@ -6,7 +6,7 @@
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"),
type = "monster",
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
-- 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
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)

View file

@ -161,7 +161,7 @@ local horse = {
-- Some weird human is riding. Buck them off?
if self.driver and not self.tamed and self.buck_off_time <= 0 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
else
-- 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 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
end
@ -198,7 +198,7 @@ local horse = {
end
-- also detach from horse properly
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,
@ -235,7 +235,7 @@ local horse = {
-- Trying to ride
elseif not self.driver then
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?
if self.temper > 100 then
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
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
-- If nothing happened temper_increase = 0 and addition does nothing
@ -263,7 +263,7 @@ local horse = {
elseif (iname == mobs_mc.items.golden_carrot) then
heal = 4
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
end
end
@ -278,11 +278,11 @@ local horse = {
elseif (iname == mobs_mc.items.hay_bale) then
heal = 20
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
end
if mobs:protect(self, clicker) then
if mcl_mobs:protect(self, clicker) then
return
end
@ -294,7 +294,7 @@ local horse = {
-- detatch player already riding horse
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
elseif not self.driver and not self._saddle
@ -355,18 +355,18 @@ local horse = {
elseif not self.driver and self._saddle then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
mcl_mobs.attach(self, clicker)
-- Used to capture horse
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,
on_breed = function(parent1, parent2)
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
local ent_c = child:get_luaentity()
local p = math.random(1, 2)
@ -415,7 +415,7 @@ local horse = {
end,
}
mobs:register_mob("mobs_mc:horse", horse)
mcl_mobs:register_mob("mobs_mc:horse", horse)
-- Skeleton horse
local skeleton_horse = table.copy(horse)
@ -438,7 +438,7 @@ skeleton_horse.sounds = {
distance = 16,
}
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
local zombie_horse = table.copy(horse)
@ -462,7 +462,7 @@ zombie_horse.sounds = {
distance = 16,
}
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
local d = 0.86 -- donkey scale
@ -493,7 +493,7 @@ donkey.collisionbox = {
donkey.jump = true
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
local m = 0.94
@ -511,11 +511,11 @@ mule.collisionbox = {
horse.collisionbox[5] * m,
horse.collisionbox[6] * m,
}
mobs:register_mob("mobs_mc:mule", mule)
mcl_mobs:register_mob("mobs_mc:mule", mule)
--===========================
--Spawn Function
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:horse",
"overworld",
"ground",
@ -566,7 +566,7 @@ mobs_mc.spawn_height.water+3,
mobs_mc.spawn_height.overworld_max)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:donkey",
"overworld",
"ground",
@ -587,8 +587,8 @@ mobs_mc.spawn_height.water+3,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs
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:horse", S("Horse"), "mobs_mc_spawn_icon_horse.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: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:donkey", S("Donkey"), "mobs_mc_spawn_icon_donkey.png", 0)
mcl_mobs:register_egg("mobs_mc:mule", S("Mule"), "mobs_mc_spawn_icon_mule.png", 0)

View file

@ -11,7 +11,7 @@ local S = minetest.get_translator("mobs_mc")
local etime = 0
mobs:register_mob("mobs_mc:iron_golem", {
mcl_mobs:register_mob("mobs_mc:iron_golem", {
description = S("Iron Golem"),
type = "npc",
spawn_class = "passive",
@ -84,7 +84,7 @@ mobs:register_mob("mobs_mc:iron_golem", {
etime = etime + dtime
if etime > 10 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,
@ -92,7 +92,7 @@ mobs:register_mob("mobs_mc:iron_golem", {
-- 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.

View file

@ -24,7 +24,7 @@ local carpets = {
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"),
type = "animal",
spawn_class = "passive",
@ -101,7 +101,7 @@ mobs:register_mob("mobs_mc:llama", {
-- if driver present allow control of llama
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
end
@ -113,7 +113,7 @@ mobs:register_mob("mobs_mc:llama", {
-- detach from llama properly
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,
@ -128,12 +128,12 @@ mobs:register_mob("mobs_mc:llama", {
local item = clicker:get_wielded_item()
if item:get_name() == mobs_mc.items.hay_bale then
-- 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
-- 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
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
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
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
elseif not self.driver then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
mcl_mobs.attach(self, clicker)
end
-- Used to capture llama
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,
@ -196,7 +196,7 @@ mobs:register_mob("mobs_mc:llama", {
else
parent = parent2
end
child = mobs:spawn_child(pos, parent.name)
child = mcl_mobs:spawn_child(pos, parent.name)
if child then
local ent_c = child:get_luaentity()
ent_c.base_texture = table.copy(ent_c.base_texture)
@ -212,7 +212,7 @@ mobs:register_mob("mobs_mc:llama", {
})
--spawn
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:llama",
"overworld",
"ground",
@ -239,4 +239,4 @@ mobs_mc.spawn_height.water+15,
mobs_mc.spawn_height.overworld_max)
-- 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)

View file

@ -99,7 +99,7 @@ local ocelot = {
end,
}
mobs:register_mob("mobs_mc:ocelot", ocelot)
mcl_mobs:register_mob("mobs_mc:ocelot", ocelot)
-- Cat
local cat = table.copy(ocelot)
@ -122,9 +122,9 @@ cat.sounds = {
distance = 16,
}
cat.on_rightclick = function(self, clicker)
if 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 mobs:protect(self, clicker) then return end
if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end
if mcl_mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
if mcl_mobs:protect(self, clicker) then return end
if self.child then return end
@ -149,13 +149,13 @@ cat.on_rightclick = function(self, clicker)
end
mobs:register_mob("mobs_mc:cat", cat)
mcl_mobs:register_mob("mobs_mc:cat", cat)
local base_spawn_chance = 5000
-- Spawn ocelot
--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",
"overworld",
"ground",
@ -232,4 +232,4 @@ mobs:spawn({
-- spawn eggs
-- 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)

View file

@ -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"),
type = "npc",
spawn_class = "passive",
@ -84,15 +84,15 @@ mobs:register_mob("mobs_mc:parrot", {
end
-- Feed to tame, but not breed
if mobs:feed_tame(self, clicker, 1, false, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
if mcl_mobs:feed_tame(self, clicker, 1, false, true) then return end
if mcl_mobs:protect(self, clicker) then return end
if mcl_mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
end,
})
-- 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",
"overworld",
"ground",
@ -111,4 +111,4 @@ mobs_mc.spawn_height.water+7,
mobs_mc.spawn_height.overworld_max)
-- 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)

View file

@ -2,7 +2,7 @@
local S = minetest.get_translator("mobs_mc")
mobs:register_mob("mobs_mc:pig", {
mcl_mobs:register_mob("mobs_mc:pig", {
description = S("Pig"),
type = "animal",
spawn_class = "passive",
@ -69,7 +69,7 @@ mobs:register_mob("mobs_mc:pig", {
-- if driver present allow control of horse
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
end
@ -82,7 +82,7 @@ mobs:register_mob("mobs_mc:pig", {
-- drop saddle when horse is killed while riding
-- also detach from horse properly
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,
@ -94,9 +94,9 @@ mobs:register_mob("mobs_mc:pig", {
local wielditem = clicker:get_wielded_item()
-- Feed pig
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
if mobs:protect(self, clicker) then return end
if mcl_mobs:protect(self, clicker) then return end
if self.child then
return
@ -139,13 +139,13 @@ mobs:register_mob("mobs_mc:pig", {
local name = clicker:get_player_name()
if self.driver and clicker == self.driver then
-- Detach if already attached
mobs.detach(clicker, {x=1, y=0, z=0})
mcl_mobs.detach(clicker, {x=1, y=0, z=0})
return
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
mobs.attach(self, clicker)
mcl_mobs.attach(self, clicker)
if not minetest.is_creative_enabled(clicker:get_player_name()) then
@ -167,13 +167,13 @@ mobs:register_mob("mobs_mc:pig", {
-- Capture pig
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,
on_breed = function(parent1, parent2)
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
local ent_c = child:get_luaentity()
ent_c.tamed = true
@ -183,7 +183,7 @@ mobs:register_mob("mobs_mc:pig", {
end,
})
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:pig",
"overworld",
"ground",
@ -234,4 +234,4 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- 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)

View file

@ -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"),
type = "animal",
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",
"overworld",
"ground",
@ -87,4 +87,4 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- 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)

View file

@ -61,9 +61,9 @@ local rabbit = {
replace_what = mobs_mc.replace.rabbit,
on_rightclick = function(self, clicker)
-- Feed, tame protect or capture
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
if mcl_mobs:feed_tame(self, clicker, 1, true, true) then return end
if mcl_mobs:protect(self, clicker) then return end
if mcl_mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
end,
do_custom = function(self)
-- Easter egg: Change texture if rabbit is named “Toast”
@ -80,7 +80,7 @@ local rabbit = {
end,
}
mobs:register_mob("mobs_mc:rabbit", rabbit)
mcl_mobs:register_mob("mobs_mc:rabbit", rabbit)
-- The killer bunny (Only with spawn egg)
local killer_bunny = table.copy(rabbit)
@ -106,12 +106,12 @@ killer_bunny.do_custom = function(self)
end
end
mobs:register_mob("mobs_mc:killer_bunny", killer_bunny)
mcl_mobs:register_mob("mobs_mc:killer_bunny", killer_bunny)
-- Mob spawning rules.
-- 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",
"overworld",
"ground",
@ -159,7 +159,7 @@ spawn_desert.on_spawn = function(self, pos)
self.base_texture = { "mobs_mc_rabbit_gold.png" }
self.object:set_properties({textures = self.base_texture})
end
mobs:spawn(spawn_desert)
mcl_mobs:spawn(spawn_desert)
local spawn_snow = table.copy(spawn)
spawn_snow.nodes = mobs_mc.spawn.snow
@ -176,7 +176,7 @@ spawn_snow.on_spawn = function(self, pos)
self.base_texture = { texture }
self.object:set_properties({textures = self.base_texture})
end
mobs:spawn(spawn_snow)
mcl_mobs:spawn(spawn_snow)
local spawn_grass = table.copy(spawn)
spawn_grass.nodes = mobs_mc.spawn.grassland
@ -196,11 +196,11 @@ spawn_grass.on_spawn = function(self, pos)
self.base_texture = { texture }
self.object:set_properties({textures = self.base_texture})
end
mobs:spawn(spawn_grass)
mcl_mobs:spawn(spawn_grass)
]]--
-- 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
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

View file

@ -55,7 +55,7 @@ end
local gotten_texture = { "blank.png", "mobs_mc_sheep.png" }
--mcsheep
mobs:register_mob("mobs_mc:sheep", {
mcl_mobs:register_mob("mobs_mc:sheep", {
description = S("Sheep"),
type = "animal",
spawn_class = "passive",
@ -195,8 +195,8 @@ mobs:register_mob("mobs_mc:sheep", {
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if mcl_mobs:feed_tame(self, clicker, 1, true, true) 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
self.gotten = true
@ -252,12 +252,12 @@ mobs:register_mob("mobs_mc:sheep", {
end
return
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,
on_breed = function(parent1, parent2)
-- Breed sheep and choose a fur color for the child.
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
local ent_c = child:get_luaentity()
local color1 = parent1.color
@ -304,7 +304,7 @@ mobs:register_mob("mobs_mc:sheep", {
end
end,
})
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:sheep",
"overworld",
"ground",
@ -355,4 +355,4 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- 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)

View file

@ -11,7 +11,7 @@ local S = minetest.get_translator("mobs_mc")
-- 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"),
type = "monster",
spawn_class = "hostile",
@ -55,7 +55,7 @@ mobs:register_mob("mobs_mc:shulker", {
})
-- bullet arrow (weapon)
mobs:register_arrow("mobs_mc:shulkerbullet", {
mcl_mobs:register_arrow("mobs_mc:shulkerbullet", {
visual = "sprite",
visual_size = {x = 0.25, y = 0.25},
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",
"end",
"ground",

View file

@ -4,7 +4,7 @@
local S = minetest.get_translator("mobs_mc")
mobs:register_mob("mobs_mc:silverfish", {
mcl_mobs:register_mob("mobs_mc:silverfish", {
description = S("Silverfish"),
type = "monster",
spawn_class = "hostile",
@ -49,7 +49,7 @@ mobs:register_mob("mobs_mc:silverfish", {
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)
if minetest.get_modpath("default") and mobs_mc.create_monster_egg_nodes then

View file

@ -102,7 +102,7 @@ local skeleton = {
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,
})
mobs:register_mob("mobs_mc:stray", stray)
mcl_mobs:register_mob("mobs_mc:stray", stray)
-- Overworld spawn
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:skeleton",
"overworld",
"ground",
@ -297,7 +297,7 @@ mobs_mc.spawn_height.overworld_max)
-- Nether spawn
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:skeleton",
"nether",
"ground",
@ -314,7 +314,7 @@ mobs_mc.spawn_height.nether_max)
-- Stray spawn
-- TODO: Spawn directly under the sky
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:stray",
"overworld",
"ground",
@ -334,5 +334,5 @@ mobs_mc.spawn_height.overworld_max)
-- spawn eggs
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:skeleton", S("Skeleton"), "mobs_mc_spawn_icon_skeleton.png", 0)
mcl_mobs:register_egg("mobs_mc:stray", S("Stray"), "mobs_mc_spawn_icon_stray.png", 0)

View file

@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
--################### WITHER SKELETON
--###################
mobs:register_mob("mobs_mc:witherskeleton", {
mcl_mobs:register_mob("mobs_mc:witherskeleton", {
description = S("Wither Skeleton"),
type = "monster",
spawn_class = "hostile",
@ -96,7 +96,7 @@ mobs:register_mob("mobs_mc:witherskeleton", {
})
--spawn
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:witherskeleton",
"nether",
"ground",
@ -112,4 +112,4 @@ mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- 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)

View file

@ -109,7 +109,7 @@ local slime_big = {
on_die = spawn_children_on_die("mobs_mc:slime_small", 4, 1.0, 1.5),
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)
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.spawn_small_alternative = "mobs_mc:slime_tiny"
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)
slime_tiny.sounds.base_pitch = 1.3
@ -151,12 +151,12 @@ slime_tiny.jump_height = 3
slime_tiny.spawn_small_alternative = 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 smax = mobs_mc.spawn_height.water - 23
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:slime_tiny",
"overworld",
"ground",
@ -200,7 +200,7 @@ minetest.LIGHT_MAX+1,
smin,
smax)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:slime_small",
"overworld",
"ground",
@ -244,7 +244,7 @@ minetest.LIGHT_MAX+1,
smin,
smax)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:slime_big",
"overworld",
"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),
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)
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.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)
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)
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.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 mmax = mobs_mc.spawn_height.nether_max
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:magma_cube_tiny",
"nether",
"ground",
@ -413,7 +413,7 @@ mmin,
mmax)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:magma_cube_small",
"nether",
"ground",
@ -428,7 +428,7 @@ minetest.LIGHT_MAX+1,
mmin,
mmax)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:magma_cube_big",
"nether",
"ground",
@ -443,11 +443,11 @@ minetest.LIGHT_MAX+1,
mmin,
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)
--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_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_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_big", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11200, 4, mmin, mmax)
-- spawn eggs
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:magma_cube_big", S("Magma Cube"), "mobs_mc_spawn_icon_magmacube.png")
mcl_mobs:register_egg("mobs_mc:slime_big", S("Slime"), "mobs_mc_spawn_icon_slime.png")

View file

@ -20,7 +20,7 @@ local gotten_texture = {
"blank.png",
}
mobs:register_mob("mobs_mc:snowman", {
mcl_mobs:register_mob("mobs_mc:snowman", {
description = S("Snow Golem"),
type = "npc",
spawn_class = "passive",
@ -196,4 +196,4 @@ mobs_mc.tools.check_snow_golem_summon = function(pos)
end
-- 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)

View file

@ -69,7 +69,7 @@ local spider = {
run_end = 20,
},
}
mobs:register_mob("mobs_mc:spider", spider)
mcl_mobs:register_mob("mobs_mc:spider", spider)
-- Cave 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.sounds = table.copy(spider.sounds)
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",
"overworld",
"ground",
@ -243,5 +243,5 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs
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:spider", S("Spider"), "mobs_mc_spawn_icon_spider.png", 0)
mcl_mobs:register_egg("mobs_mc:cave_spider", S("Cave Spider"), "mobs_mc_spawn_icon_cave_spider.png", 0)

View file

@ -6,7 +6,7 @@
local S = minetest.get_translator("mobs_mc")
mobs:register_mob("mobs_mc:squid", {
mcl_mobs:register_mob("mobs_mc:squid", {
description = S("Squid"),
type = "animal",
spawn_class = "water",
@ -63,7 +63,7 @@ mobs:register_mob("mobs_mc:squid", {
local water = mobs_mc.spawn_height.water
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:squid",
"overworld",
"water",
@ -217,4 +217,4 @@ water-16,
water+1)
-- 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)

View file

@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
--################### VEX
--###################
mobs:register_mob("mobs_mc:vex", {
mcl_mobs:register_mob("mobs_mc:vex", {
description = S("Vex"),
type = "monster",
spawn_class = "hostile",
@ -94,4 +94,4 @@ mobs:register_mob("mobs_mc:vex", {
-- 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)

View file

@ -577,7 +577,7 @@ local function go_home(entity)
entity.state = "go_home"
local b=entity._bed
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
entity.state = "stand"
set_velocity(entity,0)
@ -619,7 +619,7 @@ local function look_for_job(self)
local m=minetest.get_meta(n)
if m:get_string("villager") == "" then
--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) )
end)
if gp then return end
@ -1200,7 +1200,7 @@ end)
--[=======[ MOB REGISTRATION AND SPAWNING ]=======]
mobs:register_mob("mobs_mc:villager", {
mcl_mobs:register_mob("mobs_mc:villager", {
description = S("Villager"),
type = "npc",
spawn_class = "passive",
@ -1259,7 +1259,7 @@ mobs:register_mob("mobs_mc:villager", {
end
end
if clicker then
mobs:feed_tame(self, clicker, 1, true, false)
mcl_mobs:feed_tame(self, clicker, 1, true, false)
return
end
return true --do not pick up
@ -1267,7 +1267,7 @@ mobs:register_mob("mobs_mc:villager", {
on_rightclick = function(self, clicker)
local trg=vector.new(0,9,0)
if self._jobsite then
mobs:gopath(self,self._jobsite,function()
mcl_mobs:gopath(self,self._jobsite,function()
--minetest.log("arrived at jobsite")
end)
end
@ -1375,7 +1375,7 @@ mobs:register_mob("mobs_mc:villager", {
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:villager",
"overworld",
"ground",
@ -1406,4 +1406,4 @@ mobs_mc.spawn_height.water+1,
mobs_mc.spawn_height.overworld_max)
-- 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)

View file

@ -11,7 +11,7 @@ local S = minetest.get_translator("mobs_mc")
local pr = PseudoRandom(os.time()*666)
mobs:register_mob("mobs_mc:evoker", {
mcl_mobs:register_mob("mobs_mc:evoker", {
description = S("Evoker"),
type = "monster",
spawn_class = "hostile",
@ -84,4 +84,4 @@ mobs:register_mob("mobs_mc:evoker", {
})
-- 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)

View file

@ -6,7 +6,7 @@
local S = minetest.get_translator("mobs_mc")
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"),
type = "monster",
spawn_class = "hostile",
@ -61,4 +61,4 @@ mobs:register_mob("mobs_mc:illusioner", {
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)

View file

@ -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"),
type = "monster",
spawn_class = "hostile",
@ -72,4 +72,4 @@ mobs:register_mob("mobs_mc:vindicator", {
})
-- 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)

View file

@ -25,7 +25,7 @@ local professions = {
nitwit = "mobs_mc_villager.png",
}
mobs:register_mob("mobs_mc:villager_zombie", {
mcl_mobs:register_mob("mobs_mc:villager_zombie", {
description = S("Zombie Villager"),
type = "monster",
spawn_class = "hostile",
@ -147,7 +147,7 @@ mobs:register_mob("mobs_mc:villager_zombie", {
harmed_by_heal = true,
})
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:villager_zombie",
"overworld",
"ground",
@ -239,7 +239,7 @@ mobs:spawn_specific(
4,
mobs_mc.spawn_height.overworld_min,
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
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)

View file

@ -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"),
type = "monster",
spawn_class = "hostile",
@ -72,7 +72,7 @@ mobs:register_mob("mobs_mc:witch", {
})
-- potion projectile (EXPERIMENTAL)
mobs:register_arrow("mobs_mc:potion_arrow", {
mcl_mobs:register_arrow("mobs_mc:potion_arrow", {
visual = "sprite",
visual_size = {x = 0.5, y = 0.5},
--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
--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
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")

View file

@ -9,7 +9,7 @@ local S = minetest.get_translator("mobs_mc")
--################### WITHER
--###################
mobs:register_mob("mobs_mc:wither", {
mcl_mobs:register_mob("mobs_mc:wither", {
description = S("Wither"),
type = "monster",
spawn_class = "hostile",
@ -83,7 +83,7 @@ mobs:register_mob("mobs_mc:wither", {
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_size = {x = 0.75, y = 0.75},
-- TODO: 3D projectile, replace tetxture
@ -96,7 +96,7 @@ mobs:register_arrow("mobs_mc:wither_skull", {
full_punch_interval = 0.5,
damage_groups = {fleshy = 8},
}, nil)
mobs:boom(self, self.object:get_pos(), 1)
mcl_mobs:boom(self, self.object:get_pos(), 1)
end,
hit_mob = function(self, mob)
@ -104,17 +104,17 @@ mobs:register_arrow("mobs_mc:wither_skull", {
full_punch_interval = 0.5,
damage_groups = {fleshy = 8},
}, nil)
mobs:boom(self, self.object:get_pos(), 1)
mcl_mobs:boom(self, self.object:get_pos(), 1)
end,
-- node hit, explode
hit_node = function(self, pos, node)
mobs:boom(self, pos, 1)
mcl_mobs:boom(self, pos, 1)
end
})
-- TODO: Add blue wither skull
--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")

View file

@ -57,7 +57,7 @@ local wolf = {
fear_height = 4,
follow = mobs_mc.follow.wolf,
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 dog, ent
@ -94,7 +94,7 @@ local wolf = {
specific_attack = { "player", "mobs_mc:sheep" },
}
mobs:register_mob("mobs_mc:wolf", wolf)
mcl_mobs:register_mob("mobs_mc:wolf", wolf)
-- Tamed wolf
@ -148,9 +148,9 @@ dog.specific_attack = nil
dog.on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if mobs:protect(self, clicker) then
if mcl_mobs:protect(self, clicker) then
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
elseif is_food(item:get_name()) then
-- Feed to increase health
@ -230,10 +230,10 @@ dog.on_rightclick = function(self, clicker)
end
end
mobs:register_mob("mobs_mc:dog", dog)
mcl_mobs:register_mob("mobs_mc:dog", dog)
-- Spawn
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:wolf",
"overworld",
"ground",
@ -263,4 +263,4 @@ minetest.LIGHT_MAX+1,
mobs_mc.spawn_height.water+3,
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)

View file

@ -97,7 +97,7 @@ local zombie = {
harmed_by_heal = true,
}
mobs:register_mob("mobs_mc:zombie", zombie)
mcl_mobs:register_mob("mobs_mc:zombie", zombie)
-- Baby 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.child = 1
mobs:register_mob("mobs_mc:baby_zombie", baby_zombie)
mcl_mobs:register_mob("mobs_mc:baby_zombie", baby_zombie)
-- Husk.
-- Desert variant of the zombie
@ -130,7 +130,7 @@ husk.sunlight_damage = 0
husk.drops = drops_common
-- TODO: Husks avoid water
mobs:register_mob("mobs_mc:husk", husk)
mcl_mobs:register_mob("mobs_mc:husk", husk)
-- Baby 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.child = 1
mobs:register_mob("mobs_mc:baby_husk", baby_husk)
mcl_mobs:register_mob("mobs_mc:baby_husk", baby_husk)
-- Spawning
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:zombie",
"overworld",
"ground",
@ -241,7 +241,7 @@ mobs:spawn_specific(
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- Baby zombie is 20 times less likely than regular zombies
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:baby_zombie",
"overworld",
"ground",
@ -334,7 +334,7 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:husk",
"overworld",
"ground",
@ -348,7 +348,7 @@ mobs:spawn_specific(
4,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:baby_husk",
"overworld",
"ground",
@ -364,5 +364,5 @@ mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- Spawn eggs
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:husk", S("Husk"), "mobs_mc_spawn_icon_husk.png", 0)
mcl_mobs:register_egg("mobs_mc:zombie", S("Zombie"), "mobs_mc_spawn_icon_zombie.png", 0)

View file

@ -89,7 +89,7 @@ local pigman = {
fire_damage_resistant = true,
}
mobs:register_mob("mobs_mc:pigman", pigman)
mcl_mobs:register_mob("mobs_mc:pigman", pigman)
-- Baby 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.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
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:pigman",
"nether",
"ground",
@ -128,7 +128,7 @@ minetest.LIGHT_MAX+1,
mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- Baby zombie is 20 times less likely than regular zombies
mobs:spawn_specific(
mcl_mobs:spawn_specific(
"mobs_mc:baby_pigman",
"nether",
"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)
-- 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)

View file

@ -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 = {
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
mobs_mc.override.spawn = {
solid = { "group:solid", }, -- spawn on "solid" nodes

View file

@ -78,7 +78,7 @@ end
function mcl_bossbars.update_boss(object, name, color)
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.health = object:get_hp()
end

View file

@ -28,7 +28,7 @@ local function pp_on_timer(pos, elapsed)
local obj_does_activate = function(obj, activated_by)
if activated_by.any then
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
elseif activated_by.player and obj:is_player() then
return true

View file

@ -106,7 +106,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
local mobname = ent.name
local def = minetest.registered_entities[mobname]
-- 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
return false, S("You can't sleep now, monsters are nearby!")
end

View file

@ -9,7 +9,7 @@ function mcl_bells.ring_once(pos)
local vv=minetest.get_objects_inside_radius(pos,150)
for _,o in pairs(vv) do
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

View file

@ -203,7 +203,7 @@ function ARROW_ENTITY.on_step(self, dtime)
if obj:is_player() then
ok = true
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
end
end
@ -226,7 +226,7 @@ function ARROW_ENTITY.on_step(self, dtime)
local obj = closest_object
local is_player = obj:is_player()
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
-- Check if there is no solid node between arrow and object
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)

View file

@ -24,7 +24,7 @@ local function damage_explosion(self, damagemulitplier)
for _,obj in pairs(objects) do
if obj:is_player() then
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, {
full_punch_interval=1.0,
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
ok = true
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
end
end
@ -438,7 +438,7 @@ function ARROW_ENTITY.on_step(self, dtime)
local obj = closest_object
local is_player = obj:is_player()
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
-- Check if there is no solid node between arrow and object
local ray = minetest.raycast(self.object:get_pos(), obj:get_pos(), true)

View file

@ -155,7 +155,7 @@ local function spawn_mobs(pos, elapsed)
end
-- 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)
return
end

View file

@ -167,7 +167,7 @@ minetest.register_globalstep(function(dtime)
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" })
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)
EF.regenerating[player].heal_timer = 0
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._cmi_is_mob then
if entity.is_mob then
return true
end
@ -686,7 +686,7 @@ function mcl_potions.healing_func(player, hp)
hp = 1
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)
elseif player:is_player() then
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })

View file

@ -281,7 +281,7 @@ local function water_splash(obj, damage)
end
-- Damage mobs that are vulnerable to water
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, {
full_punch_interval = 1.0,
damage_groups = {water_vulnerable=damage},

View file

@ -66,7 +66,7 @@ minetest.register_globalstep(function(dtime)
for _, obj in pairs(minetest.get_objects_inside_radius(pos, d)) do
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)
-- TODO: Apply timer penalty only if the potion effect was acutally applied

View file

@ -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
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 rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))

View file

@ -216,7 +216,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
if obj ~= self._shooter and obj:is_player() then
ok = true
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
end
end
@ -238,7 +238,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
local obj = closest_object
local is_player = obj:is_player()
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
-- Check if there is no solid node between arrow and object

View file

@ -64,7 +64,7 @@ local function check_object_hit(self, pos, dmg)
-- TODO: Deal knockback
self.object:remove()
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
object:punch(self.object, 1.0, {
full_punch_interval = 1.0,

View file

@ -38,7 +38,7 @@ minetest.register_node("mcl_villages:structblock", {drawtype="airlike",groups =
-- register inhabitants
--
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
15, --max_light
0, --min_light

View file

@ -4,7 +4,7 @@ local orig_func = minetest.registered_chatcommands["spawnentity"].func
local cmd = table.copy(minetest.registered_chatcommands["spawnentity"])
cmd.func = function(name, 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!")
else
local bool, msg = orig_func(name, param)

View file

@ -36,7 +36,7 @@ local function player_collision(player)
for _,object in pairs(minetest.get_objects_inside_radius(pos, width)) do
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 vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}