forked from VoxeLibre/VoxeLibre
Compare commits
9 Commits
master
...
player_vs_
Author | SHA1 | Date |
---|---|---|
|
00165959af | |
|
4cd2962a87 | |
|
be2fcc925a | |
|
5ebe9f549b | |
|
107fb0b082 | |
|
91a3f11689 | |
|
72768d9191 | |
|
98a61ec0be | |
|
b2da2b2f63 |
|
@ -532,6 +532,13 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local time_now = minetest.get_us_time()
|
||||||
|
|
||||||
|
-- check for invulnerability time in microseconds (0.5 second)
|
||||||
|
if time_now - self.last_invul_time <= 500000 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local is_player = hitter:is_player()
|
local is_player = hitter:is_player()
|
||||||
|
|
||||||
if is_player then
|
if is_player then
|
||||||
|
@ -657,6 +664,9 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
-- do damage
|
-- do damage
|
||||||
self.health = self.health - damage
|
self.health = self.health - damage
|
||||||
|
|
||||||
|
-- give invulnerability
|
||||||
|
self.last_invul_time = time_now
|
||||||
|
|
||||||
-- skip future functions if dead, except alerting others
|
-- skip future functions if dead, except alerting others
|
||||||
if self:check_for_death( "hit", {type = "punch", puncher = hitter}) then
|
if self:check_for_death( "hit", {type = "punch", puncher = hitter}) then
|
||||||
die = true
|
die = true
|
||||||
|
@ -672,7 +682,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
if not v then return end
|
if not v then return end
|
||||||
local r = 1.4 - math.min(punch_interval, 1.4)
|
local r = 1.4 - math.min(punch_interval, 1.4)
|
||||||
local kb = r * (math.abs(v.x)+math.abs(v.z))
|
local kb = r * (math.abs(v.x)+math.abs(v.z))
|
||||||
local up = 2
|
local up = 2.5
|
||||||
|
|
||||||
if die==true then
|
if die==true then
|
||||||
kb=kb*2
|
kb=kb*2
|
||||||
|
@ -689,7 +699,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
if tool_capabilities.damage_groups["knockback"] then
|
if tool_capabilities.damage_groups["knockback"] then
|
||||||
kb = tool_capabilities.damage_groups["knockback"]
|
kb = tool_capabilities.damage_groups["knockback"]
|
||||||
else
|
else
|
||||||
kb = kb * 1.5
|
kb = kb * 2.5
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -699,7 +709,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
end
|
end
|
||||||
if hitter and is_player then
|
if hitter and is_player then
|
||||||
local wielditem = hitter:get_wielded_item()
|
local wielditem = hitter:get_wielded_item()
|
||||||
kb = kb + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
kb = kb + 10 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||||
elseif luaentity and luaentity._knockback then
|
elseif luaentity and luaentity._knockback then
|
||||||
kb = kb + luaentity._knockback
|
kb = kb + luaentity._knockback
|
||||||
end
|
end
|
||||||
|
|
|
@ -220,6 +220,7 @@ function mcl_mobs.register_mob(name, def)
|
||||||
replace_delay = def.replace_delay or 0,
|
replace_delay = def.replace_delay or 0,
|
||||||
timer = 0,
|
timer = 0,
|
||||||
env_damage_timer = 0,
|
env_damage_timer = 0,
|
||||||
|
last_invul_time = 0,
|
||||||
tamed = false,
|
tamed = false,
|
||||||
pause_timer = 0,
|
pause_timer = 0,
|
||||||
horny = false,
|
horny = false,
|
||||||
|
|
|
@ -173,7 +173,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif food_tick_timer > 0.5 and food_level == 20 and food_saturation_level > 0 then -- fast regeneration
|
elseif food_tick_timer > 4 and food_level == 20 and food_saturation_level > 0 then -- fast regeneration
|
||||||
if player_health > 0 and player_health < 20 then
|
if player_health > 0 and player_health < 20 then
|
||||||
food_tick_timer = 0
|
food_tick_timer = 0
|
||||||
player:set_hp(player_health+1)
|
player:set_hp(player_health+1)
|
||||||
|
|
|
@ -39,7 +39,7 @@ local node_def = {
|
||||||
shearsy_wool = { speed = 1, level = 0, uses = 0 },
|
shearsy_wool = { speed = 1, level = 0, uses = 0 },
|
||||||
shearsy_cobweb = { speed = 1, level = 0, uses = 0 },
|
shearsy_cobweb = { speed = 1, level = 0, uses = 0 },
|
||||||
},
|
},
|
||||||
range = tonumber(minetest.settings:get("mcl_hand_range")) or 4.5
|
range = tonumber(minetest.settings:get("mcl_hand_range")) or 3.5
|
||||||
}
|
}
|
||||||
|
|
||||||
-- This is for _mcl_autogroup to know about the survival hand tool capabilites
|
-- This is for _mcl_autogroup to know about the survival hand tool capabilites
|
||||||
|
|
|
@ -82,8 +82,8 @@ mcl_craftguide_progressive_mode (Learn crafting recipes progressively) bool true
|
||||||
mcl_enable_skin_customization (Enable player skin customization) bool true
|
mcl_enable_skin_customization (Enable player skin customization) bool true
|
||||||
|
|
||||||
# How far the player hand can reach
|
# How far the player hand can reach
|
||||||
# Default:4.5
|
# Default:3.5
|
||||||
mcl_hand_range (Hand range) float 4.5 1 128
|
mcl_hand_range (Hand range) float 3.5 1 128
|
||||||
|
|
||||||
# How far the player hand can reach in creative mode
|
# How far the player hand can reach in creative mode
|
||||||
# Default:10
|
# Default:10
|
||||||
|
|
Loading…
Reference in New Issue