Minor updates and fixes
This commit is contained in:
parent
c80c5d0540
commit
2e67b14295
@ -147,7 +147,8 @@ armor.set_player_armor = function(self, player)
|
|||||||
armor_groups.level = floor(armor_level / 20)
|
armor_groups.level = floor(armor_level / 20)
|
||||||
armor_groups.fleshy = 100 - armor_level
|
armor_groups.fleshy = 100 - armor_level
|
||||||
end
|
end
|
||||||
player:set_physics_override(physics)
|
-- temporary disable physics override
|
||||||
|
-- player:set_physics_override(physics)
|
||||||
self.textures[name].armor = texture
|
self.textures[name].armor = texture
|
||||||
self.def[name].state = state
|
self.def[name].state = state
|
||||||
self.def[name].count = count
|
self.def[name].count = count
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20210323",
|
version = "20210405",
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ end
|
|||||||
|
|
||||||
local S = mobs.S
|
local S = mobs.S
|
||||||
|
|
||||||
-- localize functions
|
-- localize common functions
|
||||||
local abs = math.abs
|
local abs = math.abs
|
||||||
local atan = function(x)
|
local atan = function(x)
|
||||||
return x and math.atan(x) or 0
|
return x and math.atan(x) or 0
|
||||||
@ -30,7 +30,6 @@ local pi = math.pi
|
|||||||
local rad = math.rad
|
local rad = math.rad
|
||||||
local random = math.random
|
local random = math.random
|
||||||
local sin = math.sin
|
local sin = math.sin
|
||||||
local square = math.sqrt
|
|
||||||
local vadd = vector.add
|
local vadd = vector.add
|
||||||
local vdistance = vector.distance
|
local vdistance = vector.distance
|
||||||
local vdirection = vector.direction
|
local vdirection = vector.direction
|
||||||
@ -109,6 +108,7 @@ local mob_class = {
|
|||||||
light_damage_max = 15,
|
light_damage_max = 15,
|
||||||
water_damage = 0,
|
water_damage = 0,
|
||||||
lava_damage = 5,
|
lava_damage = 5,
|
||||||
|
fire_damage = 4,
|
||||||
air_damage = 0,
|
air_damage = 0,
|
||||||
suffocation = 2,
|
suffocation = 2,
|
||||||
fall_damage = 1,
|
fall_damage = 1,
|
||||||
@ -161,6 +161,7 @@ local mob_class = {
|
|||||||
|
|
||||||
local mob_class_meta = {__index = mob_class}
|
local mob_class_meta = {__index = mob_class}
|
||||||
|
|
||||||
|
|
||||||
-- play sound
|
-- play sound
|
||||||
function mob_class:mob_sound(sound)
|
function mob_class:mob_sound(sound)
|
||||||
if not sound then
|
if not sound then
|
||||||
@ -903,7 +904,12 @@ local is_node_dangerous = function(self, nodename)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.lava_damage > 0
|
if self.lava_damage > 0
|
||||||
and minetest.get_item_group(nodename, "igniter") ~= 0 then
|
and minetest.get_item_group(nodename, "lava") ~= 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.fire_damage > 0
|
||||||
|
and minetest.get_item_group(nodename, "fire") ~= 0 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -981,44 +987,47 @@ function mob_class:do_env_damage()
|
|||||||
local nodef = minetest.registered_nodes[self.standing_in]
|
local nodef = minetest.registered_nodes[self.standing_in]
|
||||||
|
|
||||||
-- water
|
-- water
|
||||||
if self.water_damage and nodef.groups.water then
|
if self.water_damage ~= 0 and nodef.groups.water then
|
||||||
if self.water_damage ~= 0 then
|
self.health = self.health - self.water_damage
|
||||||
self.health = self.health - self.water_damage
|
|
||||||
effect(pos, 5, "bubble.png", nil, nil, 1, nil)
|
|
||||||
|
|
||||||
if self:check_for_death({
|
effect(pos, 5, "bubble.png", nil, nil, 1, nil)
|
||||||
type = "environment",
|
|
||||||
pos = pos,
|
if self:check_for_death({type = "environment", pos = pos,
|
||||||
node = self.standing_in
|
node = self.standing_in, hot = true}) then
|
||||||
}) then
|
return true
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ignition source (fire or lava)
|
-- lava damage
|
||||||
elseif self.lava_damage and nodef.groups.igniter then
|
elseif self.lava_damage ~= 0 and nodef.groups.lava then
|
||||||
if self.lava_damage ~= 0 then
|
self.health = self.health - self.lava_damage
|
||||||
self.health = self.health - self.lava_damage
|
|
||||||
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
|
||||||
|
|
||||||
if self:check_for_death({
|
effect(pos, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
|
||||||
type = "environment",
|
|
||||||
pos = pos,
|
if self:check_for_death({type = "environment", pos = pos,
|
||||||
node = self.standing_in,
|
node = self.standing_in, hot = true}) then
|
||||||
hot = true}) then
|
return true
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- damage_per_second node check
|
-- fire damage
|
||||||
elseif nodef.damage_per_second ~= 0 then
|
elseif self.fire_damage ~= 0 and nodef.groups.fire then
|
||||||
|
self.health = self.health - self.fire_damage
|
||||||
|
|
||||||
|
effect(pos, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
|
||||||
|
|
||||||
|
if self:check_for_death({type = "environment", pos = pos,
|
||||||
|
node = self.standing_in, hot = true}) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- damage_per_second node check (not fire and lava)
|
||||||
|
elseif nodef.damage_per_second ~= 0
|
||||||
|
and nodef.groups.lava == 0 and nodef.groups.fire == 0 then
|
||||||
self.health = self.health - nodef.damage_per_second
|
self.health = self.health - nodef.damage_per_second
|
||||||
effect(pos, 5, "item_smoke.png")
|
|
||||||
|
|
||||||
if self:check_for_death({
|
effect(pos, 5, "tnt_smoke.png")
|
||||||
type = "environment",
|
|
||||||
pos = pos,
|
if self:check_for_death({type = "environment",
|
||||||
node = self.standing_in}) then
|
pos = pos, node = self.standing_in}) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2521,18 +2530,19 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if hitter:is_player() then
|
-- is mob protected
|
||||||
local player_name = hitter:get_player_name()
|
if self.tamed then
|
||||||
|
-- did player hit mob and if so is it in protected area
|
||||||
|
if hitter:is_player() then
|
||||||
|
local player_name = hitter:get_player_name()
|
||||||
|
|
||||||
-- is_protected_action check
|
if player_name ~= self.owner
|
||||||
if mobs.is_creative(hitter) and minetest.is_protected_action(self.object:get_pos(), player_name) then
|
and minetest.is_protected(self.object:get_pos(), player_name) then
|
||||||
return true
|
minetest.chat_send_player(player_name,
|
||||||
end
|
S("Mob has been protected!"))
|
||||||
|
|
||||||
-- is mob protected?
|
return true
|
||||||
if self.tamed and minetest.is_protected(self.object:get_pos(), player_name) then
|
end
|
||||||
minetest.chat_send_player(player_name, S("Mob has been protected!"))
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2834,8 +2844,7 @@ function mob_class:mob_activate(staticdata, def, dtime)
|
|||||||
def.textures = {def.textures}
|
def.textures = {def.textures}
|
||||||
end
|
end
|
||||||
|
|
||||||
self.base_texture = def.textures and
|
self.base_texture = def.textures and def.textures[random(#def.textures)]
|
||||||
def.textures[random(#def.textures)]
|
|
||||||
self.base_mesh = def.mesh
|
self.base_mesh = def.mesh
|
||||||
self.base_size = self.visual_size
|
self.base_size = self.visual_size
|
||||||
self.base_colbox = self.collisionbox
|
self.base_colbox = self.collisionbox
|
||||||
@ -3200,6 +3209,7 @@ function mobs:register_mob(name, def)
|
|||||||
light_damage_max = def.light_damage_max,
|
light_damage_max = def.light_damage_max,
|
||||||
water_damage = def.water_damage,
|
water_damage = def.water_damage,
|
||||||
lava_damage = def.lava_damage,
|
lava_damage = def.lava_damage,
|
||||||
|
fire_damage = def.fire_damage,
|
||||||
air_damage = def.air_damage,
|
air_damage = def.air_damage,
|
||||||
suffocation = def.suffocation,
|
suffocation = def.suffocation,
|
||||||
fall_damage = def.fall_damage,
|
fall_damage = def.fall_damage,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user