Remove use_cmi

This commit is contained in:
Elias Fleckenstein 2022-05-25 13:46:54 +02:00 committed by cora
parent fc3992ceb6
commit 6ae722a6ee
1 changed files with 9 additions and 44 deletions

View File

@ -23,10 +23,6 @@ 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
@ -850,10 +846,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)
@ -913,9 +905,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()
@ -3144,23 +3133,19 @@ 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
for group,_ in pairs( (tool_capabilities.damage_groups or {}) ) do
tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
if tmp < 0 then
tmp = 0.0
elseif tmp > 1 then
tmp = 1.0
end
damage = damage + (tool_capabilities.damage_groups[group] or 0)
* tmp * ((armor[group] or 0) / 100.0)
if tmp < 0 then
tmp = 0.0
elseif tmp > 1 then
tmp = 1.0
end
damage = damage + (tool_capabilities.damage_groups[group] or 0)
* tmp * ((armor[group] or 0) / 100.0)
end
if weapon then
@ -3186,13 +3171,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
@ -3400,10 +3378,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
@ -3581,11 +3555,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
@ -3596,10 +3565,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