forked from VoxeLibre/VoxeLibre
Compare commits
63 Commits
Author | SHA1 | Date |
---|---|---|
Eliy21 | 95be0ca64c | |
Eliy21 | c09c3aad47 | |
Eliy21 | bac92efd8f | |
Eliy21 | fafe585dde | |
Eliy21 | 589d7e660e | |
Eliy21 | d074ed6cc3 | |
Eliy21 | bf8c452165 | |
Eliy21 | 2901eadc55 | |
the-real-herowl | d658b1977f | |
the-real-herowl | 2e30b2120c | |
Bakawun | 8555afe7f7 | |
Bakawun | 89a2c3f681 | |
the-real-herowl | 80af7a29a9 | |
the-real-herowl | 0aa2ff6a68 | |
bakawun | a30df7dcdc | |
the-real-herowl | dd50112349 | |
Michieal | d63cf1478d | |
the-real-herowl | b5112fd5c5 | |
the-real-herowl | 9e1a2a480b | |
the-real-herowl | fafc28a694 | |
the-real-herowl | 4314de9d88 | |
the-real-herowl | a37ebc0f87 | |
the-real-herowl | 9dd524003d | |
the-real-herowl | 7334416a53 | |
the-real-herowl | b4329d0b44 | |
Michieal | fb13dfec4f | |
Michieal | 0e3c8f063f | |
Michieal | 149097ff90 | |
Michieal | 03a4afa416 | |
Michieal | a6a39cb8f0 | |
Michieal | a82ff254ff | |
Michieal | a24e5f85c0 | |
Michieal | dd00dc4496 | |
Michieal | b4e8b0ea88 | |
bakawun | 8fad74c90f | |
bakawun | 06132d01a8 | |
bakawun | ba564f843f | |
bakawun | cff3d8d802 | |
bakawun | 238031921a | |
bakawun | e152a392e0 | |
bakawun | 91880967cb | |
bakawun | d2d04d77ca | |
bakawun | 8c7e26989f | |
bakawun | 31a56f6a2a | |
bakawun | 3a00986266 | |
cora | ad3a888e65 | |
bakawun | e86c8a8ac6 | |
bakawun | d12cbbb706 | |
the-real-herowl | 2a0e21444b | |
bakawun | 78ef56a2f3 | |
bakawun | 697fdca549 | |
cora | 83522126c5 | |
cora | 069513f70b | |
cora | 6c93e17731 | |
cora | 28c1fb4278 | |
Bakawun | a845437ea3 | |
Bakawun | 2a3abe54e9 | |
Bakawun | b7f84bb059 | |
Bakawun | 74aa25da4c | |
Bakawun | 69cca594e2 | |
Bakawun | 77e2beea17 | |
bakawun | 0952a92a5e | |
bakawun | edc4c95f6d |
|
@ -459,7 +459,7 @@ function mcl_explosions.explode(pos, strength, info, direct, source)
|
|||
end
|
||||
|
||||
-- The maximum blast radius (in the air)
|
||||
local radius = math.ceil(1.3 * strength / (0.3 * 0.75) * 0.3)
|
||||
local radius = math.floor(1.3 * strength / 0.225 * 0.3 + 0.5)
|
||||
|
||||
if not sphere_shapes[radius] then
|
||||
sphere_shapes[radius] = compute_sphere_rays(radius)
|
||||
|
|
|
@ -1231,6 +1231,9 @@ function mob_class:do_states_attack (dtime)
|
|||
-- important for mcl_shields
|
||||
ent._shooter = self.object
|
||||
ent._saved_shooter_pos = self.object:get_pos()
|
||||
if ent.homing then
|
||||
ent._target = self.attack
|
||||
end
|
||||
end
|
||||
|
||||
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
||||
|
|
|
@ -334,6 +334,13 @@ function mcl_mobs.register_mob(name, def)
|
|||
end -- END mcl_mobs.register_mob function
|
||||
|
||||
|
||||
function mcl_mobs.get_arrow_damage_func(damage, typ)
|
||||
local typ = mcl_damage.types[typ] and typ or "arrow"
|
||||
return function(projectile, object)
|
||||
return mcl_util.deal_damage(object, damage, {type = typ})
|
||||
end
|
||||
end
|
||||
|
||||
-- register arrow for shoot attack
|
||||
function mcl_mobs.register_arrow(name, def)
|
||||
|
||||
|
@ -350,6 +357,7 @@ function mcl_mobs.register_arrow(name, def)
|
|||
hit_node = def.hit_node,
|
||||
hit_mob = def.hit_mob,
|
||||
hit_object = def.hit_object,
|
||||
homing = def.homing,
|
||||
drop = def.drop or false, -- drops arrow as registered item when true
|
||||
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
||||
timer = 0,
|
||||
|
@ -422,6 +430,17 @@ function mcl_mobs.register_arrow(name, def)
|
|||
end
|
||||
end
|
||||
|
||||
if self.homing and self._target then
|
||||
local p = self._target:get_pos()
|
||||
if p then
|
||||
if minetest.line_of_sight(self.object:get_pos(), p) then
|
||||
self.object:set_velocity(vector.direction(self.object:get_pos(), p) * self.velocity)
|
||||
end
|
||||
else
|
||||
self.target = nil
|
||||
end
|
||||
end
|
||||
|
||||
if self.hit_player or self.hit_mob or self.hit_object then
|
||||
|
||||
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
||||
|
|
|
@ -104,20 +104,23 @@ function mob_class:item_drop(cooked, looting_level)
|
|||
if chance_function then
|
||||
chance = chance_function(looting_level)
|
||||
elseif looting_type == "rare" then
|
||||
chance = chance + (dropdef.looting_factor or 0.01) * looting_level
|
||||
local enchant_bonus = (dropdef.looting_factor or 0.01) * looting_level
|
||||
chance = chance + enchant_bonus
|
||||
--simulate 2nd roll by adding its chance value
|
||||
local chance_bonus = chance * (looting_level / (looting_level + 1))
|
||||
chance = chance + chance_bonus
|
||||
end
|
||||
end
|
||||
|
||||
local num = 0
|
||||
local do_common_looting = (looting_level > 0 and looting_type == "common")
|
||||
if math.random() < chance then
|
||||
chance = math.floor(1 / chance)
|
||||
if math.random(1, chance) == 1 then
|
||||
num = math.random(dropdef.min or 1, dropdef.max or 1)
|
||||
elseif not dropdef.looting_ignore_chance then
|
||||
do_common_looting = false
|
||||
end
|
||||
|
||||
if do_common_looting then
|
||||
num = num + math.floor(math.random(0, looting_level) + 0.5)
|
||||
num = num + math.random(0, looting_level)
|
||||
end
|
||||
|
||||
if num > 0 then
|
||||
|
|
|
@ -16,7 +16,6 @@ local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air
|
|||
local get_biome_name = minetest.get_biome_name
|
||||
local get_objects_inside_radius = minetest.get_objects_inside_radius
|
||||
local get_connected_players = minetest.get_connected_players
|
||||
local minetest_get_perlin = minetest.get_perlin
|
||||
|
||||
local math_random = math.random
|
||||
local math_floor = math.floor
|
||||
|
@ -97,19 +96,6 @@ local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
|
|||
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
||||
local logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
|
||||
|
||||
local noise_params = {
|
||||
offset = 0,
|
||||
scale = 3,
|
||||
spread = {
|
||||
x = 301,
|
||||
y = 50,
|
||||
z = 304,
|
||||
},
|
||||
seed = 100,
|
||||
octaves = 3,
|
||||
persistence = 0.5,
|
||||
}
|
||||
|
||||
-- THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs
|
||||
-- Also used for missing parameter
|
||||
-- Please update the list when adding new biomes!
|
||||
|
@ -446,7 +432,6 @@ WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua??
|
|||
local spawn_dictionary = {}
|
||||
--this is where all of the spawning information is kept for mobs that don't naturally spawn
|
||||
local non_spawn_dictionary = {}
|
||||
local summary_chance = 0
|
||||
|
||||
function mcl_mobs:spawn_setup(def)
|
||||
if not mobs_spawn then return end
|
||||
|
@ -508,7 +493,6 @@ function mcl_mobs:spawn_setup(def)
|
|||
check_position = check_position,
|
||||
on_spawn = on_spawn,
|
||||
}
|
||||
summary_chance = summary_chance + chance
|
||||
end
|
||||
|
||||
function mcl_mobs:mob_light_lvl(mob_name, dimension)
|
||||
|
@ -612,10 +596,8 @@ function mcl_mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_
|
|||
spawn_dictionary[key]["day_toggle"] = day_toggle
|
||||
spawn_dictionary[key]["check_position"] = check_position
|
||||
|
||||
summary_chance = summary_chance + chance
|
||||
end
|
||||
|
||||
|
||||
local two_pi = 2 * math.pi
|
||||
local function get_next_mob_spawn_pos(pos)
|
||||
-- TODO We should consider spawning something a little further away sporadically.
|
||||
|
@ -875,8 +857,6 @@ minetest.register_chatcommand("spawn_mob",{
|
|||
|
||||
if mobs_spawn then
|
||||
|
||||
local perlin_noise
|
||||
|
||||
-- Get pos to spawn, x and z are randomised, y is range
|
||||
|
||||
|
||||
|
@ -973,9 +953,21 @@ if mobs_spawn then
|
|||
return spawning_position
|
||||
end
|
||||
|
||||
local cumulative_chance = nil
|
||||
local mob_library_worker_table = nil
|
||||
local function initialize_spawn_data()
|
||||
if not mob_library_worker_table then
|
||||
mob_library_worker_table = table_copy(spawn_dictionary)
|
||||
end
|
||||
if not cumulative_chance then
|
||||
cumulative_chance = 0
|
||||
for k, v in pairs(mob_library_worker_table) do
|
||||
cumulative_chance = cumulative_chance + v.chance
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_a_mob(pos, cap_space_hostile, cap_space_non_hostile)
|
||||
--create a disconnected clone of the spawn dictionary, prevents memory leak
|
||||
local mob_library_worker_table = table_copy(spawn_dictionary)
|
||||
|
||||
local spawning_position = find_spawning_position(pos, FIND_SPAWN_POS_RETRIES)
|
||||
if not spawning_position then
|
||||
|
@ -988,22 +980,25 @@ if mobs_spawn then
|
|||
--output_mob_stats(mob_counts_wide)
|
||||
|
||||
--grab mob that fits into the spawning location
|
||||
--randomly grab a mob, don't exclude any possibilities
|
||||
perlin_noise = perlin_noise or minetest_get_perlin(noise_params)
|
||||
local noise = perlin_noise:get_3d(spawning_position)
|
||||
local current_summary_chance = summary_chance
|
||||
--use random weighted choice with replacement to grab a mob, don't exclude any possibilities
|
||||
--shuffle table once every loop to provide equal inclusion probability to all mobs
|
||||
--repeat grabbing a mob to maintain existing spawn rates
|
||||
local spawn_loop_counter = #mob_library_worker_table
|
||||
|
||||
while spawn_loop_counter > 0 do
|
||||
table.shuffle(mob_library_worker_table)
|
||||
|
||||
while #mob_library_worker_table > 0 do
|
||||
local mob_chance_offset = (math_round(noise * current_summary_chance + 12345) % current_summary_chance) + 1
|
||||
local mob_chance_offset = math_random(1, cumulative_chance)
|
||||
local mob_index = 1
|
||||
local mob_chance = mob_library_worker_table[mob_index].chance
|
||||
local step_chance = mob_chance
|
||||
while step_chance < mob_chance_offset do
|
||||
mob_index = mob_index + 1
|
||||
if mob_index <= #mob_library_worker_table then
|
||||
mob_chance = mob_library_worker_table[mob_index].chance
|
||||
step_chance = step_chance + mob_chance
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
--minetest.log(mob_def.name.." "..step_chance.. " "..mob_chance)
|
||||
|
||||
|
@ -1088,8 +1083,7 @@ if mobs_spawn then
|
|||
end
|
||||
|
||||
end
|
||||
current_summary_chance = current_summary_chance - mob_chance
|
||||
table_remove(mob_library_worker_table, mob_index)
|
||||
spawn_loop_counter = spawn_loop_counter - 1
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1101,6 +1095,7 @@ if mobs_spawn then
|
|||
|
||||
timer = timer + dtime
|
||||
if timer < WAIT_FOR_SPAWN_ATTEMPT then return end
|
||||
initialize_spawn_data()
|
||||
timer = 0
|
||||
|
||||
local players = get_connected_players()
|
||||
|
|
|
@ -171,7 +171,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
4000,
|
||||
100,
|
||||
3,
|
||||
water-16,
|
||||
water+1)
|
||||
|
|
|
@ -150,7 +150,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
maxlight,
|
||||
20,
|
||||
5000,
|
||||
100,
|
||||
2,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mobs_mc.water_level-1)
|
||||
|
|
|
@ -151,7 +151,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
5000,
|
||||
1000,
|
||||
3,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
|
|
@ -65,13 +65,13 @@ mcl_mobs.register_mob("mobs_mc:chicken", {
|
|||
},
|
||||
animation = {
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 20, walk_speed = 25,
|
||||
run_start = 0, run_end = 20, run_speed = 50,
|
||||
walk_start = 0, walk_end = 20, walk_speed = 100,
|
||||
run_start = 0, run_end = 20, run_speed = 200,
|
||||
},
|
||||
child_animations = {
|
||||
stand_start = 31, stand_end = 31,
|
||||
walk_start = 31, walk_end = 51, walk_speed = 37,
|
||||
run_start = 31, run_end = 51, run_speed = 75,
|
||||
walk_start = 31, walk_end = 51, walk_speed = 100,
|
||||
run_start = 31, run_end = 51, run_speed = 200,
|
||||
},
|
||||
follow = {
|
||||
"mcl_farming:wheat_seeds",
|
||||
|
@ -157,7 +157,7 @@ mcl_mobs:spawn_specific(
|
|||
},
|
||||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30, 17000,
|
||||
30, 100,
|
||||
3,
|
||||
mobs_mc.water_level,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -67,7 +67,8 @@ local cod = {
|
|||
{name = "mcl_bone_meal:bone_meal",
|
||||
chance = 20,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
max = 1,
|
||||
looting = rare},
|
||||
},
|
||||
visual_size = {x=3, y=3},
|
||||
makes_footstep_sound = false,
|
||||
|
@ -266,7 +267,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
4000,
|
||||
750,
|
||||
3,
|
||||
water-16,
|
||||
water+1)
|
||||
|
|
|
@ -50,13 +50,13 @@ local cow_def = {
|
|||
},
|
||||
animation = {
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 30,
|
||||
run_start = 0, run_end = 40, run_speed = 40,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 100,
|
||||
run_start = 0, run_end = 40, run_speed = 200,
|
||||
},
|
||||
child_animations = {
|
||||
stand_start = 41, stand_end = 41,
|
||||
walk_start = 41, walk_end = 81, walk_speed = 45,
|
||||
run_start = 41, run_end = 81, run_speed = 60,
|
||||
walk_start = 41, walk_end = 81, walk_speed = 100,
|
||||
run_start = 41, run_end = 81, run_speed = 200,
|
||||
},
|
||||
on_rightclick = function(self, clicker)
|
||||
if self:feed_tame(clicker, 1, true, false) then return end
|
||||
|
@ -207,7 +207,7 @@ mcl_mobs:spawn_specific(
|
|||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
17000,
|
||||
80,
|
||||
10,
|
||||
mobs_mc.water_level,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
@ -225,7 +225,7 @@ mcl_mobs:spawn_specific(
|
|||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
17000,
|
||||
80,
|
||||
5,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -115,14 +115,14 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
|
|||
max = 1,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
run_start = 24,
|
||||
run_end = 49,
|
||||
walk_speed = 100,
|
||||
walk_start = 0,
|
||||
walk_end = 40,
|
||||
run_speed = 100,
|
||||
run_start = 0,
|
||||
run_end = 40,
|
||||
hurt_start = 110,
|
||||
hurt_end = 139,
|
||||
death_start = 140,
|
||||
|
@ -241,12 +241,12 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
|||
max = 1,},
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 24,
|
||||
speed_run = 48,
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_speed = 100,
|
||||
walk_start = 24,
|
||||
walk_end = 49,
|
||||
run_speed = 200,
|
||||
run_start = 24,
|
||||
run_end = 49,
|
||||
hurt_start = 110,
|
||||
|
@ -407,7 +407,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
20,
|
||||
16500,
|
||||
1000,
|
||||
2,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -244,7 +244,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
4000,
|
||||
70,
|
||||
3,
|
||||
water-16,
|
||||
water+1)
|
||||
|
|
|
@ -205,8 +205,8 @@ local select_enderman_animation = function(animation_type)
|
|||
-- Enderman holds a block
|
||||
if animation_type == "block" then
|
||||
return {
|
||||
walk_speed = 25,
|
||||
run_speed = 50,
|
||||
walk_speed = 80,
|
||||
run_speed = 160,
|
||||
stand_speed = 25,
|
||||
stand_start = 200,
|
||||
stand_end = 200,
|
||||
|
@ -220,8 +220,8 @@ local select_enderman_animation = function(animation_type)
|
|||
-- Enderman doesn't hold a block
|
||||
elseif animation_type == "normal" or animation_type == nil then
|
||||
return {
|
||||
walk_speed = 25,
|
||||
run_speed = 50,
|
||||
walk_speed = 80,
|
||||
run_speed = 160,
|
||||
stand_speed = 25,
|
||||
stand_start = 40,
|
||||
stand_end = 80,
|
||||
|
@ -292,7 +292,8 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
|
|||
random = {name="mobs_mc_enderman_random", gain=0.5},
|
||||
distance = 16,
|
||||
},
|
||||
walk_velocity = 0.2,
|
||||
walk_velocity = 1.0,
|
||||
walk_chance = 10,
|
||||
run_velocity = 3.4,
|
||||
damage = 7,
|
||||
reach = 2,
|
||||
|
@ -668,7 +669,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
3000,
|
||||
100,
|
||||
12,
|
||||
mcl_vars.mg_end_min,
|
||||
mcl_vars.mg_end_max)
|
||||
|
@ -816,7 +817,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
19000,
|
||||
100,
|
||||
2,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
@ -833,7 +834,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
11,
|
||||
30,
|
||||
27500,
|
||||
100,
|
||||
4,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
@ -849,7 +850,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
11,
|
||||
30,
|
||||
5000,
|
||||
100,
|
||||
4,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
|
|
@ -33,7 +33,7 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
|||
death = "mobs_mc_zombie_death",
|
||||
attack = "mobs_fireball",
|
||||
random = "mobs_eerie",
|
||||
distance = 16,
|
||||
distance = 80,
|
||||
-- TODO: damage
|
||||
-- TODO: better death
|
||||
},
|
||||
|
@ -41,7 +41,7 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
|||
run_velocity = 3.2,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:gunpowder", chance = 1, min = 0, max = 2, looting = "common"},
|
||||
{name = "mcl_mobitems:ghast_tear", chance = 10/6, min = 0, max = 1, looting = "common", looting_ignore_chance = true},
|
||||
{name = "mcl_mobitems:ghast_tear", chance = 1, min = 0, max = 1, looting = "common",},
|
||||
},
|
||||
animation = {
|
||||
stand_speed = 50, walk_speed = 50, run_speed = 50,
|
||||
|
@ -50,10 +50,10 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
|||
run_start = 0, run_end = 40,
|
||||
},
|
||||
fall_damage = 0,
|
||||
view_range = 100,
|
||||
view_range = 64,
|
||||
attack_type = "dogshoot",
|
||||
arrow = "mobs_mc:fireball",
|
||||
shoot_interval = 3.5,
|
||||
shoot_interval = 3,
|
||||
shoot_offset = -5,
|
||||
dogshoot_switch = 1,
|
||||
dogshoot_count_max =1,
|
||||
|
@ -97,7 +97,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
72000,
|
||||
400,
|
||||
2,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
@ -107,7 +107,7 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
|
|||
visual = "sprite",
|
||||
visual_size = {x = 1, y = 1},
|
||||
textures = {"mcl_fire_fire_charge.png"},
|
||||
velocity = 15,
|
||||
velocity = 5,
|
||||
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
|
||||
_is_fireball = true,
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX + 1,
|
||||
30,
|
||||
10000,
|
||||
100,
|
||||
3,
|
||||
water - 16,
|
||||
water)
|
||||
|
|
|
@ -80,25 +80,25 @@ mcl_mobs.register_mob("mobs_mc:guardian_elder", {
|
|||
min = 1,
|
||||
max = 1,
|
||||
looting = "rare",
|
||||
looting_factor = 0.01 / 4,},
|
||||
looting_factor = 0.0025,},
|
||||
{name = "mcl_fishing:salmon_raw",
|
||||
chance = 160,
|
||||
min = 1,
|
||||
max = 1,
|
||||
looting = "rare",
|
||||
looting_factor = 0.01 / 4,},
|
||||
looting_factor = 0.0025,},
|
||||
{name = "mcl_fishing:clownfish_raw",
|
||||
chance = 160,
|
||||
min = 1,
|
||||
max = 1,
|
||||
looting = "rare",
|
||||
looting_factor = 0.01 / 4,},
|
||||
looting_factor = 0.0025,},
|
||||
{name = "mcl_fishing:pufferfish_raw",
|
||||
chance = 160,
|
||||
min = 1,
|
||||
max = 1,
|
||||
looting = "rare",
|
||||
looting_factor = 0.01 / 4,},
|
||||
looting_factor = 0.0025,},
|
||||
},
|
||||
fly = true,
|
||||
makes_footstep_sound = false,
|
||||
|
|
|
@ -43,13 +43,13 @@ local hoglin = {
|
|||
{name = "mobs_mcitems:leather",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
},
|
||||
drops = {
|
||||
max = 2,
|
||||
looting = "common",},
|
||||
{name = "mcl_mobitems:porkchop",
|
||||
chance = 1,
|
||||
min = 2,
|
||||
max = 4,},
|
||||
max = 4,
|
||||
looting = "common",},
|
||||
},
|
||||
animation = {
|
||||
stand_speed = 7,
|
||||
|
@ -129,7 +129,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
6000,
|
||||
200,
|
||||
3,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
|
|
@ -122,10 +122,10 @@ local horse = {
|
|||
stand_speed = 25,
|
||||
stand_start = 0,
|
||||
stand_end = 0,
|
||||
walk_speed = 25,
|
||||
walk_speed = 100,
|
||||
walk_start = 0,
|
||||
walk_end = 40,
|
||||
run_speed = 60,
|
||||
run_speed = 200,
|
||||
run_start = 0,
|
||||
run_end = 40,
|
||||
},
|
||||
|
@ -543,11 +543,6 @@ donkey.description = S("Donkey")
|
|||
donkey.textures = {{"blank.png", "mobs_mc_donkey.png", "blank.png"}}
|
||||
donkey.spawn_in_group = 3
|
||||
donkey.spawn_in_group_min = 1
|
||||
donkey.animation = {
|
||||
speed_normal = 25,
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 40,
|
||||
}
|
||||
donkey.sounds = {
|
||||
random = "mobs_mc_donkey_random",
|
||||
damage = "mobs_mc_donkey_hurt",
|
||||
|
@ -609,7 +604,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15000,
|
||||
40,
|
||||
4,
|
||||
mobs_mc.water_level+3,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
@ -632,7 +627,7 @@ mcl_mobs:spawn_specific(
|
|||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15000,
|
||||
10,
|
||||
4,
|
||||
mobs_mc.water_level+3,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -80,7 +80,7 @@ mcl_mobs.register_mob("mobs_mc:iron_golem", {
|
|||
},
|
||||
fall_damage = 0,
|
||||
animation = {
|
||||
stand_speed = 15, walk_speed = 15, run_speed = 25, punch_speed = 15,
|
||||
stand_speed = 15, walk_speed = 50, run_speed = 100, punch_speed = 15,
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 40,
|
||||
run_start = 0, run_end = 40,
|
||||
|
|
|
@ -102,13 +102,13 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
|||
},
|
||||
animation = {
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 35,
|
||||
run_start = 0, run_end = 40, run_speed = 50,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 100,
|
||||
run_start = 0, run_end = 40, run_speed = 200,
|
||||
},
|
||||
child_animations = {
|
||||
stand_start = 41, stand_end = 41,
|
||||
walk_start = 41, walk_end = 81, walk_speed = 50,
|
||||
run_start = 41, run_end = 81, run_speed = 75,
|
||||
walk_start = 41, walk_end = 81, walk_speed = 200,
|
||||
run_start = 41, run_end = 81, run_speed = 400,
|
||||
},
|
||||
follow = { "mcl_farming:wheat_item", "mcl_farming:hay_block" },
|
||||
view_range = 16,
|
||||
|
@ -291,7 +291,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15000,
|
||||
50,
|
||||
5,
|
||||
mobs_mc.water_level+15,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -63,14 +63,14 @@ local ocelot = {
|
|||
},
|
||||
animation = {
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 40,
|
||||
run_start = 0, run_end = 40, run_speed = 50,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 100,
|
||||
run_start = 0, run_end = 40, run_speed = 200,
|
||||
sit_start = 50, sit_end = 50,
|
||||
},
|
||||
child_animations = {
|
||||
stand_start = 51, stand_end = 51,
|
||||
walk_start = 51, walk_end = 91, walk_speed = 60,
|
||||
run_start = 51, run_end = 91, run_speed = 75,
|
||||
walk_start = 51, walk_end = 91, walk_speed = 200,
|
||||
run_start = 51, run_end = 91, run_speed = 400,
|
||||
sit_start = 101, sit_end = 101,
|
||||
},
|
||||
follow = follow,
|
||||
|
@ -186,7 +186,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15000,
|
||||
300,
|
||||
5,
|
||||
mobs_mc.water_level+15,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -166,8 +166,8 @@ mcl_mobs.register_mob("mobs_mc:parrot", {
|
|||
fly_speed = 50,
|
||||
stand_start = 0,
|
||||
stand_end = 0,
|
||||
fly_start = 30,
|
||||
fly_end = 45,
|
||||
fly_start = 130,
|
||||
fly_end = 150,
|
||||
walk_start = 0,
|
||||
walk_end = 20,
|
||||
-- TODO: actual walk animation
|
||||
|
@ -235,7 +235,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
7,
|
||||
30000,
|
||||
400,
|
||||
1,
|
||||
mobs_mc.water_level+7,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -258,7 +258,7 @@ mcl_mobs:spawn_specific(
|
|||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15000,
|
||||
100,
|
||||
8,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -71,14 +71,14 @@ local piglin = {
|
|||
run_velocity = 2.8,
|
||||
drops = {
|
||||
{name = "mcl_bows:crossbow",
|
||||
chance = 10,
|
||||
chance = 11, -- 8.5% approximated
|
||||
min = 1,
|
||||
max = 1,},
|
||||
},
|
||||
animation = {
|
||||
stand_speed = 30,
|
||||
walk_speed = 30,
|
||||
run_speed = 30,
|
||||
walk_speed = 100,
|
||||
run_speed = 200,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
|
@ -200,9 +200,9 @@ sword_piglin.drops = {
|
|||
sword_piglin.attack_type = "dogfight"
|
||||
sword_piglin.animation = {
|
||||
stand_speed = 30,
|
||||
walk_speed = 30,
|
||||
walk_speed = 100,
|
||||
punch_speed = 45,
|
||||
run_speed = 30,
|
||||
run_speed = 200,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
|
@ -288,8 +288,8 @@ local zombified_piglin = {
|
|||
},
|
||||
animation = {
|
||||
stand_speed = 25,
|
||||
walk_speed = 25,
|
||||
run_speed = 50,
|
||||
walk_speed = 100,
|
||||
run_speed = 200,
|
||||
stand_start = 40,
|
||||
stand_end = 80,
|
||||
walk_start = 0,
|
||||
|
@ -361,9 +361,9 @@ piglin_brute.textures = {"extra_mobs_piglin_brute.png", "default_tool_goldaxe.pn
|
|||
piglin_brute.attack_type = "dogfight"
|
||||
piglin_brute.animation = {
|
||||
stand_speed = 30,
|
||||
walk_speed = 30,
|
||||
walk_speed = 100,
|
||||
punch_speed = 45,
|
||||
run_speed = 30,
|
||||
run_speed = 200,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
|
@ -397,7 +397,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
6000,
|
||||
150,
|
||||
3,
|
||||
mcl_vars.mg_lava_nether_max,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
@ -413,7 +413,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
6000,
|
||||
150,
|
||||
3,
|
||||
mcl_vars.mg_lava_nether_max,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
@ -429,7 +429,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
6000,
|
||||
1000,
|
||||
3,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
@ -446,7 +446,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
100000,
|
||||
50,
|
||||
4,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
|
|
@ -71,10 +71,11 @@ pillager = {
|
|||
},
|
||||
{
|
||||
name = "mcl_bows:crossbow",
|
||||
chance = 100 / 8.5,
|
||||
chance = 11, -- 8.5% approximated
|
||||
min = 1,
|
||||
max = 1,
|
||||
looting = "rare",
|
||||
looting_factor = 0.012,
|
||||
},
|
||||
},
|
||||
animation = {
|
||||
|
@ -82,8 +83,8 @@ pillager = {
|
|||
unloaded_stand_start = 41, unloaded_stand_end = 60,
|
||||
reload_stand_start = 61, reload_stand_end = 100, reload_stand_speed = 20,
|
||||
stand_start = 101, stand_end = 109, stand_speed = 6,
|
||||
walk_start = 111, walk_end = 150, walk_speed = 30,
|
||||
run_start = 111, run_end = 150, run_speed = 50,
|
||||
walk_start = 111, walk_end = 150, walk_speed = 200,
|
||||
run_start = 111, run_end = 150, run_speed = 400,
|
||||
reload_run_start = 151, reload_run_end = 190, reload_run_speed = 20,
|
||||
die_start = 191, die_end = 192, die_speed = 15,
|
||||
stand_unloaded_start = 40, stand_unloaded_end = 59,
|
||||
|
|
|
@ -64,10 +64,10 @@ mcl_mobs.register_mob("mobs_mc:polar_bear", {
|
|||
distance = 16,
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 25, speed_run = 50,
|
||||
speed_normal = 25,
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 40,
|
||||
run_start = 0, run_end = 40,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 100,
|
||||
run_start = 0, run_end = 40, run_speed = 200,
|
||||
},
|
||||
|
||||
view_range = 16,
|
||||
|
@ -86,7 +86,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
7000,
|
||||
50,
|
||||
3,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -47,20 +47,20 @@ local rabbit = {
|
|||
runaway = true,
|
||||
jump = true,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:rabbit", chance = 1, min = 0, max = 1, looting = "common",},
|
||||
{name = "mcl_mobitems:rabbit", chance = 1, min = 1, max = 1, looting = "common",},
|
||||
{name = "mcl_mobitems:rabbit_hide", chance = 1, min = 0, max = 1, looting = "common",},
|
||||
{name = "mcl_mobitems:rabbit_foot", chance = 10, min = 0, max = 1, looting = "rare", looting_factor = 0.03,},
|
||||
{name = "mcl_mobitems:rabbit_foot", chance = 10, min = 1, max = 1, looting = "rare", looting_factor = 0.03,},
|
||||
},
|
||||
fear_height = 4,
|
||||
animation = {
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 20, walk_speed = 20,
|
||||
run_start = 0, run_end = 20, run_speed = 30,
|
||||
walk_start = 0, walk_end = 20, walk_speed = 100,
|
||||
run_start = 0, run_end = 20, run_speed = 200,
|
||||
},
|
||||
child_animations = {
|
||||
stand_start = 21, stand_end = 21,
|
||||
walk_start = 21, walk_end = 41, walk_speed = 30,
|
||||
run_start = 21, run_end = 41, run_speed = 45,
|
||||
walk_start = 21, walk_end = 41, walk_speed = 200,
|
||||
run_start = 21, run_end = 41, run_speed = 400,
|
||||
},
|
||||
-- Follow (yellow) dangelions, carrots and golden carrots
|
||||
follow = {
|
||||
|
@ -148,7 +148,7 @@ mcl_mobs:spawn_specific(
|
|||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15000,
|
||||
40,
|
||||
8,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -45,7 +45,8 @@ local salmon = {
|
|||
{name = "mcl_bone_meal:bone_meal",
|
||||
chance = 20,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
max = 1,
|
||||
looting = "rare",},
|
||||
},
|
||||
visual_size = {x=3, y=3},
|
||||
makes_footstep_sound = false,
|
||||
|
@ -220,7 +221,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
4000,
|
||||
260,
|
||||
3,
|
||||
water-16,
|
||||
water+1)
|
||||
|
|
|
@ -101,14 +101,14 @@ mcl_mobs.register_mob("mobs_mc:sheep", {
|
|||
},
|
||||
animation = {
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 30,
|
||||
run_start = 0, run_end = 40, run_speed = 40,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 80,
|
||||
run_start = 0, run_end = 40, run_speed = 160,
|
||||
eat_start = 40, eat_end = 80, eat_loop = false,
|
||||
},
|
||||
child_animations = {
|
||||
stand_start = 81, stand_end = 81,
|
||||
walk_start = 81, walk_end = 121, walk_speed = 45,
|
||||
run_start = 81, run_end = 121, run_speed = 60,
|
||||
walk_start = 81, walk_end = 121, walk_speed = 160,
|
||||
run_start = 81, run_end = 121, run_speed = 320,
|
||||
eat_start = 121, eat_start = 161, eat_loop = false,
|
||||
},
|
||||
follow = { "mcl_farming:wheat_item" },
|
||||
|
@ -379,7 +379,7 @@ mcl_mobs:spawn_specific(
|
|||
9,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15000,
|
||||
120,
|
||||
3,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -35,7 +35,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
|||
type = "monster",
|
||||
spawn_class = "hostile",
|
||||
attack_type = "shoot",
|
||||
shoot_interval = 0.5,
|
||||
shoot_interval = 6,
|
||||
arrow = "mobs_mc:shulkerbullet",
|
||||
shoot_offset = 0.5,
|
||||
passive = false,
|
||||
|
@ -43,7 +43,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
|||
hp_max = 30,
|
||||
xp_min = 5,
|
||||
xp_max = 5,
|
||||
armor = 150,
|
||||
armor = 20,
|
||||
collisionbox = {-0.5, -0.01, -0.5, 0.5, 0.99, 0.5},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_mc_shulker.b3d",
|
||||
|
@ -51,7 +51,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
|||
-- TODO: sounds
|
||||
-- TODO: Make shulker dye-able
|
||||
visual_size = {x=3, y=3},
|
||||
walk_chance = 0,
|
||||
walk_chance = 10,
|
||||
knock_back = false,
|
||||
jump = false,
|
||||
can_despawn = false,
|
||||
|
@ -59,21 +59,25 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
|||
drops = {
|
||||
{name = "mcl_mobitems:shulker_shell",
|
||||
chance = 2,
|
||||
min = 1,
|
||||
min = 0,
|
||||
max = 1,
|
||||
looting = "rare",
|
||||
looting_factor = 0.0625},
|
||||
},
|
||||
animation = {
|
||||
stand_speed = 25, walk_speed = 0, run_speed = 50, punch_speed = 25,
|
||||
stand_speed = 25, walk_speed = 25, run_speed = 50, punch_speed = 25,
|
||||
speed_normal = 25, speed_run = 50,
|
||||
stand_start = 0, stand_end = 25,
|
||||
walk_start = 25, walk_end = 45,
|
||||
run_start = 45, run_end = 85,
|
||||
walk_start = 45, walk_end = 65,
|
||||
walk_loop = false,
|
||||
run_start = 65, run_end = 85,
|
||||
run_loop = false,
|
||||
punch_start = 80, punch_end = 100,
|
||||
},
|
||||
view_range = 16,
|
||||
fear_height = 0,
|
||||
walk_velocity = 0,
|
||||
run_velocity = 0,
|
||||
noyaw = true,
|
||||
do_custom = function(self,dtime)
|
||||
local pos = self.object:get_pos()
|
||||
|
@ -81,12 +85,13 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
|||
self.object:set_yaw(0)
|
||||
mcl_mobs:yaw(self, 0, 0, dtime)
|
||||
end
|
||||
if self.state == "walk" or self.state == "stand" then
|
||||
self.state = "stand"
|
||||
self:set_animation("stand")
|
||||
end
|
||||
if self.state == "attack" then
|
||||
self:set_animation("punch")
|
||||
self:set_animation("run")
|
||||
self.armor = 0
|
||||
elseif self.state == "stand" then
|
||||
self.armor = 20
|
||||
elseif self.state == "walk" or self.state == "run" then
|
||||
self.armor = 0
|
||||
end
|
||||
self.path.way = false
|
||||
self.look_at_players = false
|
||||
|
@ -149,6 +154,9 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
|||
end
|
||||
end
|
||||
end,
|
||||
on_attack = function(self, dtime)
|
||||
self.shoot_interval = math.random(1, 6)
|
||||
end,
|
||||
})
|
||||
|
||||
-- bullet arrow (weapon)
|
||||
|
@ -156,27 +164,12 @@ mcl_mobs.register_arrow("mobs_mc:shulkerbullet", {
|
|||
visual = "sprite",
|
||||
visual_size = {x = 0.25, y = 0.25},
|
||||
textures = {"mobs_mc_shulkerbullet.png"},
|
||||
velocity = 6,
|
||||
|
||||
hit_player = function(self, player)
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 4},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_mob = function(self, mob)
|
||||
mob:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 4},
|
||||
}, nil)
|
||||
end,
|
||||
|
||||
hit_node = function(self, pos, node)
|
||||
end
|
||||
velocity = 5,
|
||||
homing = true,
|
||||
hit_player = mcl_mobs.get_arrow_damage_func(4),
|
||||
hit_mob = mcl_mobs.get_arrow_damage_func(4),
|
||||
})
|
||||
|
||||
|
||||
mcl_mobs.register_egg("mobs_mc:shulker", S("Shulker"), "#946694", "#4d3852", 0)
|
||||
mcl_mobs:non_spawn_specific("mobs_mc:shulker","overworld",0,minetest.LIGHT_MAX+1)
|
||||
--[[
|
||||
|
|
|
@ -55,7 +55,7 @@ local skeleton = {
|
|||
max = 2,
|
||||
looting = "common",},
|
||||
{name = "mcl_bows:bow",
|
||||
chance = 100 / 8.5,
|
||||
chance = 11, -- 8.5%
|
||||
min = 1,
|
||||
max = 1,
|
||||
looting = "rare",},
|
||||
|
@ -76,10 +76,10 @@ local skeleton = {
|
|||
stand_speed = 15,
|
||||
stand_start = 0,
|
||||
stand_end = 40,
|
||||
walk_speed = 15,
|
||||
walk_speed = 45,
|
||||
walk_start = 40,
|
||||
walk_end = 60,
|
||||
run_speed = 30,
|
||||
run_speed = 90,
|
||||
shoot_start = 70,
|
||||
shoot_end = 90,
|
||||
jockey_start = 172,
|
||||
|
@ -299,7 +299,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
20,
|
||||
17000,
|
||||
800,
|
||||
2,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
@ -316,7 +316,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
10000,
|
||||
800,
|
||||
3,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
@ -336,7 +336,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
20,
|
||||
19000,
|
||||
1200,
|
||||
2,
|
||||
mobs_mc.water_level,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -71,10 +71,10 @@ mcl_mobs.register_mob("mobs_mc:witherskeleton", {
|
|||
stand_speed = 15,
|
||||
walk_start = 40,
|
||||
walk_end = 60,
|
||||
walk_speed = 15,
|
||||
walk_speed = 45,
|
||||
run_start = 40,
|
||||
run_end = 60,
|
||||
run_speed = 30,
|
||||
run_speed = 90,
|
||||
shoot_start = 70,
|
||||
shoot_end = 90,
|
||||
punch_start = 110,
|
||||
|
@ -116,7 +116,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
5000,
|
||||
500,
|
||||
5,
|
||||
mcl_vars.mg_nether_min,
|
||||
mcl_vars.mg_nether_max)
|
||||
|
|
|
@ -197,7 +197,7 @@ local slime_big = {
|
|||
distance = 16,
|
||||
},
|
||||
damage = 4,
|
||||
reach = 3,
|
||||
reach = 2.5,
|
||||
armor = 100,
|
||||
drops = {},
|
||||
-- TODO: Fix animations
|
||||
|
@ -238,7 +238,7 @@ slime_small.xp_max = 2
|
|||
slime_small.collisionbox = {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51}
|
||||
slime_small.visual_size = {x=6.25, y=6.25}
|
||||
slime_small.damage = 3
|
||||
slime_small.reach = 2.75
|
||||
slime_small.reach = 2.25
|
||||
slime_small.walk_velocity = 1.8
|
||||
slime_small.run_velocity = 1.8
|
||||
slime_small.jump_height = 4.3
|
||||
|
@ -254,8 +254,8 @@ slime_tiny.xp_min = 1
|
|||
slime_tiny.xp_max = 1
|
||||
slime_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505}
|
||||
slime_tiny.visual_size = {x=3.125, y=3.125}
|
||||
slime_tiny.damage = 0
|
||||
slime_tiny.reach = 2.5
|
||||
slime_tiny.damage = 1
|
||||
slime_tiny.reach = 2
|
||||
slime_tiny.drops = {
|
||||
-- slimeball
|
||||
{name = "mcl_mobitems:slimeball",
|
||||
|
@ -321,7 +321,7 @@ cave_biomes,
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
12000,
|
||||
1000,
|
||||
4,
|
||||
cave_min,
|
||||
cave_max,
|
||||
|
@ -335,7 +335,7 @@ swampy_biomes,
|
|||
0,
|
||||
swamp_light_max,
|
||||
30,
|
||||
12000,
|
||||
1000,
|
||||
4,
|
||||
swamp_min,
|
||||
swamp_max)
|
||||
|
@ -348,7 +348,7 @@ cave_biomes,
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
8500,
|
||||
1000,
|
||||
4,
|
||||
cave_min,
|
||||
cave_max,
|
||||
|
@ -362,7 +362,7 @@ swampy_biomes,
|
|||
0,
|
||||
swamp_light_max,
|
||||
30,
|
||||
8500,
|
||||
1000,
|
||||
4,
|
||||
swamp_min,
|
||||
swamp_max)
|
||||
|
@ -375,7 +375,7 @@ cave_biomes,
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
10000,
|
||||
1000,
|
||||
4,
|
||||
cave_min,
|
||||
cave_max,
|
||||
|
@ -389,7 +389,7 @@ swampy_biomes,
|
|||
0,
|
||||
swamp_light_max,
|
||||
30,
|
||||
10000,
|
||||
1000,
|
||||
4,
|
||||
swamp_min,
|
||||
swamp_max)
|
||||
|
@ -418,12 +418,12 @@ local magma_cube_big = {
|
|||
walk_velocity = 2.5,
|
||||
run_velocity = 2.5,
|
||||
damage = 6,
|
||||
reach = 3,
|
||||
reach = 2.35,
|
||||
armor = 53,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:magma_cream",
|
||||
chance = 4,
|
||||
min = 1,
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
},
|
||||
-- TODO: Fix animations
|
||||
|
@ -466,7 +466,7 @@ magma_cube_small.xp_max = 2
|
|||
magma_cube_small.collisionbox = {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51}
|
||||
magma_cube_small.visual_size = {x=6.25, y=6.25}
|
||||
magma_cube_small.damage = 3
|
||||
magma_cube_small.reach = 2.75
|
||||
magma_cube_small.reach = 2.1
|
||||
magma_cube_small.walk_velocity = .8
|
||||
magma_cube_small.run_velocity = 2.0
|
||||
magma_cube_small.jump_height = 6
|
||||
|
@ -491,7 +491,7 @@ magma_cube_tiny.walk_velocity = 1.02
|
|||
magma_cube_tiny.run_velocity = 1.02
|
||||
magma_cube_tiny.jump_height = 4
|
||||
magma_cube_tiny.damage = 3
|
||||
magma_cube_tiny.reach = 2.5
|
||||
magma_cube_tiny.reach = 2
|
||||
magma_cube_tiny.armor = 50
|
||||
magma_cube_tiny.drops = {}
|
||||
magma_cube_tiny.spawn_small_alternative = nil
|
||||
|
@ -512,7 +512,7 @@ magma_cube_biomes,
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15000,
|
||||
100,
|
||||
4,
|
||||
nether_min,
|
||||
nether_max)
|
||||
|
@ -525,7 +525,7 @@ magma_cube_biomes,
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
15500,
|
||||
100,
|
||||
4,
|
||||
nether_min,
|
||||
nether_max)
|
||||
|
@ -538,7 +538,7 @@ magma_cube_biomes,
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
16000,
|
||||
100,
|
||||
4,
|
||||
nether_min,
|
||||
nether_max)
|
||||
|
|
|
@ -90,16 +90,14 @@ local spider = {
|
|||
floats = 1,
|
||||
drops = {
|
||||
{name = "mcl_mobitems:string", chance = 1, min = 0, max = 2, looting = "common"},
|
||||
{name = "mcl_mobitems:spider_eye", chance = 3, min = 1, max = 1, looting = "common", looting_chance_function = function(lvl)
|
||||
return 1 - 2 / (lvl + 3)
|
||||
end},
|
||||
{name = "mcl_mobitems:spider_eye", chance = 1, min = 0, max = 1, looting = "common",},
|
||||
},
|
||||
specific_attack = { "player", "mobs_mc:iron_golem" },
|
||||
fear_height = 4,
|
||||
animation = {
|
||||
stand_speed = 10,
|
||||
walk_speed = 25,
|
||||
run_speed = 50,
|
||||
walk_speed = 100,
|
||||
run_speed = 200,
|
||||
stand_start = 20,
|
||||
stand_end = 40,
|
||||
walk_start = 0,
|
||||
|
@ -287,7 +285,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
17000,
|
||||
1000,
|
||||
2,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -211,7 +211,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
5500,
|
||||
80,
|
||||
3,
|
||||
water-16,
|
||||
water+1)
|
||||
|
|
|
@ -39,13 +39,13 @@ local strider = {
|
|||
drops = {
|
||||
{name = "mcl_mobsitems:string",
|
||||
chance = 1,
|
||||
min = 2,
|
||||
min = 0,
|
||||
max = 5,},
|
||||
},
|
||||
animation = {
|
||||
stand_speed = 15,
|
||||
walk_speed = 15,
|
||||
run_speed = 30,
|
||||
walk_speed = 30,
|
||||
run_speed = 60,
|
||||
stand_start = 5,
|
||||
stand_end = 5,
|
||||
walk_start = 1,
|
||||
|
@ -225,7 +225,7 @@ mcl_mobs:spawn_setup({
|
|||
},
|
||||
min_height = mcl_vars.mg_nether_min,
|
||||
max_height = mcl_vars.mg_nether_max,
|
||||
chance = 2000,
|
||||
chance = 200,
|
||||
})
|
||||
|
||||
mcl_mobs:spawn_setup({
|
||||
|
@ -241,7 +241,7 @@ mcl_mobs:spawn_setup({
|
|||
},
|
||||
min_height = mcl_vars.mg_nether_min,
|
||||
max_height = mcl_vars.mg_nether_max,
|
||||
chance = 100,
|
||||
chance = 20,
|
||||
})
|
||||
|
||||
-- spawn eggs
|
||||
|
|
|
@ -90,7 +90,8 @@ local tropical_fish = {
|
|||
{name = "mcl_bone_meal:bone_meal",
|
||||
chance = 20,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
max = 1,
|
||||
looting = "rare",},
|
||||
},
|
||||
visual_size = {x=3, y=3},
|
||||
makes_footstep_sound = false,
|
||||
|
@ -183,7 +184,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
4000,
|
||||
750,
|
||||
3,
|
||||
water-16,
|
||||
water+1)
|
||||
|
|
|
@ -37,6 +37,7 @@ mcl_mobs.register_mob("mobs_mc:vex", {
|
|||
walk_velocity = 3.2,
|
||||
run_velocity = 5.9,
|
||||
attack_type = "dogfight",
|
||||
attack_frequency = 2,
|
||||
sounds = {
|
||||
-- TODO: random
|
||||
death = "mobs_mc_vex_death",
|
||||
|
@ -63,10 +64,13 @@ mcl_mobs.register_mob("mobs_mc:vex", {
|
|||
self.object:set_properties({textures=self.base_texture})
|
||||
end
|
||||
else
|
||||
if self.base_texture[2] == "mobs_mc_vex_charging.png" then
|
||||
self.base_texture[2] = "mobs_mc_vex.png"
|
||||
end
|
||||
if self.base_texture[1] ~= "default_tool_steelsword.png" then
|
||||
self.base_texture[1] = "default_tool_steelsword.png"
|
||||
self.object:set_properties({textures=self.base_texture})
|
||||
end
|
||||
self.object:set_properties({textures=self.base_texture})
|
||||
end
|
||||
|
||||
-- Take constant damage if the vex' life clock ran out
|
||||
|
|
|
@ -33,6 +33,7 @@ local PLAYER_SCAN_RADIUS = 4 -- scan radius for looking for nearby players
|
|||
local RESETTLE_DISTANCE = 100 -- If a mob is transported this far from home, it gives up bed and job and resettles
|
||||
|
||||
local PATHFINDING = "gowp"
|
||||
local VILLAGER_SEARCH_RADIUS = tonumber(minetest.settings:get("mcl_mobs_villager_search_radius")) or 20
|
||||
|
||||
--[=======[ TRADING ]=======]
|
||||
|
||||
|
@ -793,13 +794,13 @@ local function find_closest_bed (self)
|
|||
|
||||
--local spawnable_bed={}
|
||||
--table.insert(spawnable_bed, "mcl_beds:bed_red_bottom")
|
||||
--local nn = minetest.find_nodes_in_area(vector.offset(p,-48,-48,-48),vector.offset(p,48,48,48), spawnable_bed)
|
||||
--local nn = minetest.find_nodes_in_area(vector.offset(p,-VILLAGER_SEARCH_RADIUS,-VILLAGER_SEARCH_RADIUS,-VILLAGER_SEARCH_RADIUS),vector.offset(p,VILLAGER_SEARCH_RADIUS,VILLAGER_SEARCH_RADIUS,VILLAGER_SEARCH_RADIUS), spawnable_bed)
|
||||
--if nn then
|
||||
-- mcl_log("Red beds: " .. #nn)
|
||||
--end
|
||||
|
||||
local unclaimed_beds = {}
|
||||
local nn2 = minetest.find_nodes_in_area(vector.offset(p,-48,-48,-48),vector.offset(p,48,48,48), {"group:bed"})
|
||||
local nn2 = minetest.find_nodes_in_area(vector.offset(p,-VILLAGER_SEARCH_RADIUS,-VILLAGER_SEARCH_RADIUS,-VILLAGER_SEARCH_RADIUS),vector.offset(p,VILLAGER_SEARCH_RADIUS,VILLAGER_SEARCH_RADIUS,VILLAGER_SEARCH_RADIUS), {"group:bed"})
|
||||
if nn2 then
|
||||
--mcl_log("All bed parts: " .. #nn2)
|
||||
|
||||
|
@ -878,7 +879,7 @@ local function find_closest_bed (self)
|
|||
end
|
||||
|
||||
local function find_closest_unclaimed_block (p, requested_block_types)
|
||||
local nn = minetest.find_nodes_in_area(vector.offset(p,-48,-48,-48),vector.offset(p,48,48,48), requested_block_types)
|
||||
local nn = minetest.find_nodes_in_area(vector.offset(p,-VILLAGER_SEARCH_RADIUS,-VILLAGER_SEARCH_RADIUS,-VILLAGER_SEARCH_RADIUS),vector.offset(p,VILLAGER_SEARCH_RADIUS,VILLAGER_SEARCH_RADIUS,VILLAGER_SEARCH_RADIUS), requested_block_types)
|
||||
|
||||
local distance_to_closest_block = nil
|
||||
local closest_block = nil
|
||||
|
@ -1372,7 +1373,7 @@ local function go_to_town_bell(self)
|
|||
table.insert(looking_for_type, "mcl_bells:bell")
|
||||
|
||||
local p = self.object:get_pos()
|
||||
local nn = minetest.find_nodes_in_area(vector.offset(p,-48,-48,-48),vector.offset(p,48,48,48), looking_for_type)
|
||||
local nn = minetest.find_nodes_in_area(vector.offset(p,-VILLAGER_SEARCH_RADIUS,-VILLAGER_SEARCH_RADIUS,-VILLAGER_SEARCH_RADIUS),vector.offset(p,VILLAGER_SEARCH_RADIUS,VILLAGER_SEARCH_RADIUS,VILLAGER_SEARCH_RADIUS), looking_for_type)
|
||||
|
||||
--Ideally should check for closest available. It'll make pathing easier.
|
||||
for _,n in pairs(nn) do
|
||||
|
@ -2335,7 +2336,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
20,
|
||||
2,
|
||||
4,
|
||||
mobs_mc.water_level+1,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -38,10 +38,11 @@ mcl_mobs.register_mob("mobs_mc:evoker", {
|
|||
} },
|
||||
makes_footstep_sound = true,
|
||||
damage = 6,
|
||||
walk_velocity = 0.2,
|
||||
walk_velocity = 1.0,
|
||||
run_velocity = 1.4,
|
||||
group_attack = true,
|
||||
attack_type = "dogfight",
|
||||
attack_frequency = 15,
|
||||
-- Summon vexes
|
||||
custom_attack = function(self, to_attack)
|
||||
if not spawned_vexes[self] then spawned_vexes[self] = {} end
|
||||
|
@ -64,7 +65,6 @@ mcl_mobs.register_mob("mobs_mc:evoker", {
|
|||
table.insert(spawned_vexes[self],ent)
|
||||
end
|
||||
end,
|
||||
shoot_interval = 15,
|
||||
passive = false,
|
||||
drops = {
|
||||
{name = "mcl_core:emerald",
|
||||
|
@ -80,12 +80,17 @@ mcl_mobs.register_mob("mobs_mc:evoker", {
|
|||
-- TODO: sounds
|
||||
animation = {
|
||||
stand_start = 0, stand_end = 0,
|
||||
walk_start = 0, walk_end = 40, walk_speed = 6,
|
||||
run_start = 0, run_end = 40, run_speed = 24,
|
||||
walk_start = 0, walk_end = 40, walk_speed =100,
|
||||
run_start = 0, run_end = 40, run_speed = 140,
|
||||
shoot_start = 142, shoot_end = 152, -- Magic arm swinging
|
||||
},
|
||||
view_range = 16,
|
||||
fear_height = 4,
|
||||
|
||||
on_spawn = function(self)
|
||||
self.timer = 15
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
-- spawn eggs
|
||||
|
|
|
@ -49,10 +49,10 @@ mcl_mobs.register_mob("mobs_mc:illusioner", {
|
|||
stand_speed = 25,
|
||||
stand_start = 40,
|
||||
stand_end = 59,
|
||||
walk_speed = 25,
|
||||
walk_speed = 100,
|
||||
walk_start = 0,
|
||||
walk_end = 40,
|
||||
run_speed = 25,
|
||||
run_speed = 200,
|
||||
shoot_start = 150,
|
||||
shoot_end = 170,
|
||||
die_speed = 15,
|
||||
|
|
|
@ -50,7 +50,7 @@ mcl_mobs.register_mob("mobs_mc:vindicator", {
|
|||
max = 1,
|
||||
looting = "common",},
|
||||
{name = "mcl_tools:axe_iron",
|
||||
chance = 100 / 8.5,
|
||||
chance = 11, --8.5% approximated
|
||||
min = 1,
|
||||
max = 1,
|
||||
looting = "rare",},
|
||||
|
@ -60,10 +60,10 @@ mcl_mobs.register_mob("mobs_mc:vindicator", {
|
|||
stand_speed = 25,
|
||||
stand_start = 40,
|
||||
stand_end = 59,
|
||||
walk_speed = 25,
|
||||
walk_speed = 100,
|
||||
walk_start = 0,
|
||||
walk_end = 40,
|
||||
run_speed = 25,
|
||||
run_speed = 200,
|
||||
punch_speed = 25,
|
||||
punch_start = 90,
|
||||
punch_end = 110,
|
||||
|
|
|
@ -225,7 +225,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
4090,
|
||||
50,
|
||||
4,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -224,7 +224,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
minetest.LIGHT_MAX+1,
|
||||
30,
|
||||
9000,
|
||||
80,
|
||||
7,
|
||||
mobs_mc.water_level+3,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -90,8 +90,8 @@ local zombie = {
|
|||
drops = drops_zombie,
|
||||
animation = {
|
||||
stand_start = 40, stand_end = 49, stand_speed = 2,
|
||||
walk_start = 0, walk_end = 39, speed_normal = 25,
|
||||
run_start = 0, run_end = 39, speed_run = 50,
|
||||
walk_start = 0, walk_end = 39, walk_speed = 80,
|
||||
run_start = 0, run_end = 39, run_speed = 150,
|
||||
punch_start = 50, punch_end = 59, punch_speed = 20,
|
||||
},
|
||||
ignited_by_sunlight = true,
|
||||
|
@ -118,8 +118,8 @@ baby_zombie.child = 1
|
|||
baby_zombie.reach = 1
|
||||
baby_zombie.animation = {
|
||||
stand_start = 100, stand_end = 109, stand_speed = 2,
|
||||
walk_start = 60, walk_end = 99, speed_normal = 40,
|
||||
run_start = 60, run_end = 99, speed_run = 80,
|
||||
walk_start = 60, walk_end = 99, walk_speed = 150,
|
||||
run_start = 60, run_end = 99, run_speed = 300,
|
||||
punch_start = 109, punch_end = 119
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
6000,
|
||||
1000,
|
||||
4,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
@ -332,7 +332,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
60000,
|
||||
50,
|
||||
4,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
@ -348,7 +348,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
6500,
|
||||
2400,
|
||||
4,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
@ -362,7 +362,7 @@ mcl_mobs:spawn_specific(
|
|||
0,
|
||||
7,
|
||||
30,
|
||||
65000,
|
||||
120,
|
||||
4,
|
||||
mcl_vars.mg_overworld_min,
|
||||
mcl_vars.mg_overworld_max)
|
||||
|
|
|
@ -33,6 +33,15 @@ local bow_load = {}
|
|||
-- Another player table, this one stores the wield index of the bow being charged
|
||||
local bow_index = {}
|
||||
|
||||
-- define FOV modifier(s)
|
||||
mcl_fovapi.register_modifier({
|
||||
name = "bowcomplete",
|
||||
fov_factor = 0.8,
|
||||
time = 1,
|
||||
reset_time = 0.3,
|
||||
is_multiplier = true,
|
||||
})
|
||||
|
||||
function mcl_bows.shoot_arrow(arrow_item, pos, dir, yaw, shooter, power, damage, is_critical, bow_stack, collectable)
|
||||
local obj = minetest.add_entity({x=pos.x,y=pos.y,z=pos.z}, arrow_item.."_entity")
|
||||
if power == nil then
|
||||
|
@ -183,6 +192,9 @@ end
|
|||
|
||||
-- Resets the bow charging state and player speed. To be used when the player is no longer charging the bow
|
||||
local function reset_bow_state(player, also_reset_bows)
|
||||
-- clear the FOV change from the player.
|
||||
mcl_fovapi.remove_modifier(player, "bowcomplete") -- for the complete zoom in FOV Modifier.
|
||||
|
||||
bow_load[player:get_player_name()] = nil
|
||||
bow_index[player:get_player_name()] = nil
|
||||
if minetest.get_modpath("playerphysics") then
|
||||
|
@ -314,6 +326,9 @@ controls.register_on_hold(function(player, key, time)
|
|||
end
|
||||
bow_load[name] = minetest.get_us_time()
|
||||
bow_index[name] = player:get_wield_index()
|
||||
|
||||
-- begin Bow Zoom.
|
||||
mcl_fovapi.apply_modifier(player, "bowcomplete")
|
||||
else
|
||||
if player:get_wield_index() == bow_index[name] then
|
||||
if type(bow_load[name]) == "number" then
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name = mcl_bows
|
||||
author = Arcelmi
|
||||
description = This mod adds bows and arrows for MineClone 2.
|
||||
depends = controls, mcl_particles, mcl_enchanting, mcl_init, mcl_util, mcl_shields
|
||||
depends = controls, mcl_particles, mcl_enchanting, mcl_init, mcl_util, mcl_shields, mcl_fovapi
|
||||
optional_depends = awards, mcl_achievements, mcl_core, mcl_mobitems, playerphysics, doc, doc_identifier, mesecons_button
|
||||
|
||||
|
|
|
@ -133,10 +133,14 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
|
|||
if wielditem then
|
||||
local fire_aspect_level = mcl_enchanting.get_enchantment(wielditem, "fire_aspect")
|
||||
if fire_aspect_level > 0 then
|
||||
local player_pos = player:get_pos()
|
||||
local hitter_pos = hitter:get_pos()
|
||||
if vector.distance(hitter_pos, player_pos) <= 3 then
|
||||
mcl_burning.set_on_fire(player, fire_aspect_level * 4)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
mcl_enchanting.enchantments.flame = {
|
||||
|
@ -276,15 +280,32 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
|||
if hitter then
|
||||
luaentity = hitter:get_luaentity()
|
||||
end
|
||||
if hitter and hitter:is_player() then
|
||||
if hitter and hitter:is_player() and distance <= 3 then
|
||||
local wielditem = hitter:get_wielded_item()
|
||||
knockback = knockback + 5 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||
-- add vertical lift to knockback
|
||||
local v = player:get_velocity()
|
||||
if v and v.y <= 0.1 and v.y >= -0.1 and dir.y <= 0.44 then
|
||||
player:add_velocity({
|
||||
x = 0,
|
||||
y = 4.5,
|
||||
z = 0
|
||||
})
|
||||
-- add minimum knockback
|
||||
if knockback <= 1.5 then
|
||||
knockback = knockback + 6
|
||||
end
|
||||
end
|
||||
-- add player velocity to knockback
|
||||
local hv = hitter:get_velocity()
|
||||
local dir_dot = (hv.x * dir.x) + (hv.z * dir.z)
|
||||
if dir_dot > 0 then
|
||||
knockback = knockback + dir_dot * 2
|
||||
local hitter_mag = math.sqrt((hv.x * hv.x) + (hv.z * hv.z))
|
||||
local player_mag = math.sqrt((v.x * v.x) + (v.z * v.z))
|
||||
if dir_dot > 0 and player_mag <= hitter_mag * 0.625 then
|
||||
knockback = knockback + hitter_mag * 0.375
|
||||
end
|
||||
elseif hitter and hitter:is_player() and distance > 3 then
|
||||
knockback = 0
|
||||
elseif luaentity and luaentity._knockback then
|
||||
local kb = knockback + luaentity._knockback / 4
|
||||
local punch_dir = dir
|
||||
|
|
|
@ -17,6 +17,15 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
mcl_fovapi.register_modifier({
|
||||
name = "spyglass",
|
||||
fov_factor = 8,
|
||||
time = 0.1,
|
||||
reset_time = 0,
|
||||
is_multiplier = false,
|
||||
exclusive = true,
|
||||
})
|
||||
|
||||
local spyglass_scope = {}
|
||||
|
||||
local function add_scope(player)
|
||||
|
@ -37,7 +46,8 @@ local function remove_scope(player)
|
|||
player:hud_remove(spyglass_scope[player])
|
||||
spyglass_scope[player] = nil
|
||||
player:hud_set_flags({wielditem = true})
|
||||
player:set_fov(86.1)
|
||||
mcl_fovapi.remove_modifier(player, "spyglass") -- use the api to remove the FOV effect.
|
||||
-- old code: player:set_fov(86.1)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -55,7 +65,8 @@ controls.register_on_hold(function(player, key, time)
|
|||
if key ~= "RMB" then return end
|
||||
local wielditem = player:get_wielded_item()
|
||||
if wielditem:get_name() == "mcl_spyglass:spyglass" then
|
||||
player:set_fov(8, false, 0.1)
|
||||
mcl_fovapi.apply_modifier(player, "spyglass") -- apply the FOV effect.
|
||||
-- old code: player:set_fov(8, false, 0.1)
|
||||
if spyglass_scope[player] == nil then
|
||||
add_scope(player)
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = mcl_spyglass
|
||||
author = NO11
|
||||
description = This mod adds a spyglass, which is an item that can be used for zooming in on specific locations.
|
||||
depends = mcl_core, controls
|
||||
depends = mcl_core, controls, mcl_fovapi
|
||||
|
|
|
@ -83,7 +83,7 @@ if mg_name ~= "singlenode" then
|
|||
if maxp.y < 0 then return end
|
||||
|
||||
-- randomly try to build settlements
|
||||
if blockseed % 77 ~= 17 then return end
|
||||
if blockseed % 31 ~= 17 then return end
|
||||
--minetest.log("Rng good. Generate attempt")
|
||||
|
||||
-- needed for manual and automated settlement building
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
minetest.register_on_mods_loaded(function()
|
||||
for name in pairs(minetest.registered_items) do
|
||||
if name:find("bow") then
|
||||
minetest.override_item(name, {
|
||||
touch_controls = {
|
||||
pointed_nothing = "short_dig_long_place",
|
||||
pointed_node = "short_dig_long_place",
|
||||
pointed_object = "short_dig_long_place",
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
for name in pairs(minetest.registered_items) do
|
||||
if name:find("spyglass") then
|
||||
minetest.override_item(name, {
|
||||
touch_controls = {
|
||||
pointed_nothing = "short_dig_long_place",
|
||||
pointed_node = "short_dig_long_place",
|
||||
pointed_object = "short_dig_long_place",
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
for name in pairs(minetest.registered_items) do
|
||||
if name:find("rocket") then
|
||||
minetest.override_item(name, {
|
||||
touch_controls = {
|
||||
pointed_nothing = "short_dig_long_place",
|
||||
pointed_node = "short_dig_long_place",
|
||||
pointed_object = "short_dig_long_place",
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
for name in pairs(minetest.registered_items) do
|
||||
if name:find("hamburger") then
|
||||
minetest.override_item(name, {
|
||||
touch_controls = {
|
||||
pointed_nothing = "short_dig_long_place",
|
||||
pointed_node = "short_dig_long_place",
|
||||
pointed_object = "short_dig_long_place",
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,82 @@
|
|||
### FOV API
|
||||
|
||||
<!-- TOC -->
|
||||
* [FOV API](#fov-api)
|
||||
* [Description](#description)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
* [Modifier Definition](#modifier-definition-)
|
||||
* [Global MCL_FOVAPI Tables](#global-mclfovapi-tables)
|
||||
* [Namespaces](#namespaces)
|
||||
* [Functions](#functions)
|
||||
<!-- TOC -->
|
||||
|
||||
#### Description
|
||||
This API defines and applies different Field Of View effects to players via MODIFIERS.
|
||||
|
||||
#### Troubleshooting
|
||||
In the `init.lua` file for this module, there is a `DEBUG` variable at the top that will turn on logging.
|
||||
Use it to see what is going on.
|
||||
|
||||
#### Modifier Definition
|
||||
```lua
|
||||
def = {
|
||||
name = name,
|
||||
fov_factor = fov_factor,
|
||||
time = time,
|
||||
reset_time = reset_time,
|
||||
is_multiplier = is_multiplier,
|
||||
exclusive = exclusive,
|
||||
on_start = on_start,
|
||||
on_end = on_end,
|
||||
}
|
||||
```
|
||||
* Name: The name of the Modifier, used to identify the specific modifier. Case sensitive.
|
||||
* FOV Factor: A float value defining the FOV to apply. Can be an absolute or percentage, depending on Exclusive and
|
||||
Is_Multiplier.
|
||||
* Time: A float value defining the number of seconds to take when applying the FOV Factor.
|
||||
Used to smoothly move between FOVs. Use 0 for an immediate FOV Shift. (Transition time.)
|
||||
* Reset Time: A float value defining the number of seconds to take when removing the FOV Factor.
|
||||
Used to smoothly move between FOVs. Use 0 for an immediate FOV Shift. (Reset transition time.)
|
||||
Defaults to `time` if not defined.
|
||||
* Is Multiplier: A bool value used to specify if the FOV Factor is an absolute FOV value or if it should be a percentage
|
||||
of the current FOV. Defaults to `true` if not defined.
|
||||
* Exclusive: A bool value used to specify whether the modifier will override all other FOV modifiers. An example of this
|
||||
is how the spy glass sets the FOV to be a specific value regardless of any other FOV effects applied. Defaults to
|
||||
`false` if not defined.
|
||||
* On Start: the `on_start` is a callback function `on_start(player)` that is called if defined. The parameter `player`
|
||||
is a ref to the player that had the modifier applied. Called from `mcl_fovapi.apply_modifier` immediately after
|
||||
the FOV Modifier has been applied.
|
||||
* On End: the `on_end` is a callback function `on_end(player)` that is called if defined. The parameter `player`
|
||||
is a ref to the player that had the modifier applied. Called from `mcl_fovapi.remove_modifier` immediately after
|
||||
the FOV Modifier has been removed.
|
||||
|
||||
Note: passing incorrect values in the definition will have unintended consequences.
|
||||
|
||||
#### Global MCL_FOVAPI Tables
|
||||
There are three tables that are accessible via the API. They are `registered_modifiers` and `applied_modifiers`.
|
||||
|
||||
`mcl_fovapi.registered_modifiers` has the definitions of all the registered FOV Modifiers. Indexed by Modifier Name.
|
||||
And, `mcl_fovapi.applied_modifiers` is indexed by the Player Name. It contains the names of all the modifiers applied to the
|
||||
player.
|
||||
|
||||
#### Namespaces
|
||||
`mcl_fovapi` is the default API Namespace.
|
||||
|
||||
#### Functions
|
||||
`mcl_fovapi.register_modifier(def)`
|
||||
|
||||
Used to register a new FOV Modifier for use. Must be called before applying said modifier to a player.
|
||||
See Modifier Definition for what the parameters are.
|
||||
|
||||
`mcl_fovapi.apply_modifier(player, modifier_name)`
|
||||
|
||||
Used to apply a registered FOV modifier to a player. Takes a reference to the player and the modifier's name (string).
|
||||
|
||||
`mcl_fovapi.remove_modifier(player, modifier_name)`
|
||||
|
||||
Used to remove a specific FOV modifier from a Player. Takes a reference to the player and the modifier's name (string).
|
||||
Removed immediately.
|
||||
|
||||
`mcl_fovapi.remove_all_modifiers(player)`
|
||||
|
||||
Used to remove all FOV modifiers from a Player. Takes a reference to the Player. FOV change is instantaneous.
|
|
@ -0,0 +1,232 @@
|
|||
---
|
||||
--- Copyright 2023, Michieal.
|
||||
--- License: GPL3. (Default Mineclone2 License)
|
||||
--- Created by michieal.
|
||||
--- DateTime: 12/2/23 5:47 AM
|
||||
---
|
||||
|
||||
-- Locals (and cached)
|
||||
local DEBUG = false -- debug constant for troubleshooting.
|
||||
local pairs = pairs
|
||||
|
||||
-- Globals
|
||||
mcl_fovapi = {}
|
||||
|
||||
mcl_fovapi.registered_modifiers = {}
|
||||
mcl_fovapi.applied_modifiers = {}
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local player_name = player:get_player_name()
|
||||
|
||||
-- initialization
|
||||
mcl_fovapi.applied_modifiers[player_name] = {}
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local player_name = player:get_player_name()
|
||||
|
||||
-- handle clean up
|
||||
mcl_fovapi.applied_modifiers[player_name] = nil
|
||||
end)
|
||||
|
||||
function mcl_fovapi.register_modifier(def)
|
||||
if type(def.name) ~= "string" then
|
||||
error("Modifier name must be a string")
|
||||
end
|
||||
if type(def.fov_factor) ~= "number" then
|
||||
error("FOV factor must be a number")
|
||||
end
|
||||
if type(def.time) ~= "number" then
|
||||
error("Transition time must be a number")
|
||||
end
|
||||
if def.reset_time ~= nil and type(def.reset_time) ~= "number" then
|
||||
error("Reset time, if provided, must be a number")
|
||||
end
|
||||
|
||||
if def.on_start ~= nil and type(def.on_start) ~= "function" then
|
||||
error("Callback on_start must be a function")
|
||||
end
|
||||
if def.on_end ~= nil and type(def.on_end) ~= "function" then
|
||||
error("Callback on_end must be a function")
|
||||
end
|
||||
|
||||
local mdef = {}
|
||||
|
||||
mdef.fov_factor = def.fov_factor
|
||||
mdef.time = def.time
|
||||
mdef.reset_time = def.reset_time or def.time
|
||||
|
||||
if def.is_multiplier == false then mdef.is_multiplier = false
|
||||
else mdef.is_multiplier = true end
|
||||
if def.exclusive == true then mdef.exclusive = true
|
||||
else mdef.exclusive = false end
|
||||
|
||||
mdef.on_start = def.on_start
|
||||
mdef.on_end = def.on_end
|
||||
|
||||
if DEBUG then
|
||||
minetest.log("FOV::Modifier Definition Registered:\n" .. dump(def))
|
||||
end
|
||||
|
||||
mcl_fovapi.registered_modifiers[def.name] = mdef
|
||||
|
||||
end
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
mcl_fovapi.remove_all_modifiers(player)
|
||||
end)
|
||||
|
||||
function mcl_fovapi.apply_modifier(player, modifier_name)
|
||||
if not player or not modifier_name then
|
||||
return
|
||||
end
|
||||
if mcl_fovapi.registered_modifiers[modifier_name] == nil then
|
||||
return
|
||||
end
|
||||
local player_name = player:get_player_name()
|
||||
if mcl_fovapi.applied_modifiers and mcl_fovapi.applied_modifiers[player_name] and mcl_fovapi.applied_modifiers[player_name][modifier_name] then
|
||||
return
|
||||
end
|
||||
|
||||
for k, _ in pairs(mcl_fovapi.applied_modifiers[player_name]) do
|
||||
if mcl_fovapi.registered_modifiers[k].exclusive == true then return end
|
||||
end
|
||||
|
||||
local modifier = mcl_fovapi.registered_modifiers[modifier_name]
|
||||
if modifier.on_start then
|
||||
modifier.on_start(player)
|
||||
end
|
||||
|
||||
mcl_fovapi.applied_modifiers[player_name][modifier_name] = true -- set the applied to be true.
|
||||
|
||||
if DEBUG then
|
||||
minetest.log("FOV::Player Applied Modifiers :" .. dump(mcl_fovapi.applied_modifiers[player_name]))
|
||||
end
|
||||
|
||||
if DEBUG then
|
||||
minetest.log("FOV::Modifier applied to player:" .. player_name .. " modifier: " .. modifier_name)
|
||||
end
|
||||
|
||||
-- modifier apply code.
|
||||
if modifier.exclusive == true then
|
||||
-- if exclusive, reset the player's fov, and apply the new fov.
|
||||
if modifier.is_multiplier then
|
||||
player:set_fov(0, false, 0)
|
||||
end
|
||||
player:set_fov(modifier.fov_factor, modifier.is_multiplier, modifier.time)
|
||||
else
|
||||
-- not exclusive? let's apply it in the mix.
|
||||
local fov_factor, is_mult = player:get_fov()
|
||||
if fov_factor == 0 then
|
||||
fov_factor = 1
|
||||
is_mult = true
|
||||
end
|
||||
if modifier.is_multiplier or is_mult then
|
||||
fov_factor = fov_factor * modifier.fov_factor
|
||||
else
|
||||
fov_factor = (fov_factor + modifier.fov_factor) / 2
|
||||
end
|
||||
if modifier.is_multiplier and is_mult then
|
||||
player:set_fov(fov_factor, true, modifier.time)
|
||||
else
|
||||
player:set_fov(fov_factor, false, modifier.time)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function mcl_fovapi.remove_modifier(player, modifier_name)
|
||||
if not player or not modifier_name then
|
||||
return
|
||||
end
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
if not mcl_fovapi.applied_modifiers[player_name]
|
||||
or not mcl_fovapi.applied_modifiers[player_name][modifier_name] then
|
||||
return
|
||||
end
|
||||
|
||||
if DEBUG then
|
||||
minetest.log("FOV::Player: " .. player_name .. " modifier: " .. modifier_name .. "removed.")
|
||||
end
|
||||
|
||||
mcl_fovapi.applied_modifiers[player_name][modifier_name] = nil
|
||||
local modifier = mcl_fovapi.registered_modifiers[modifier_name]
|
||||
|
||||
-- check for other fov modifiers, and set them up, or reset to default.
|
||||
|
||||
local applied = {}
|
||||
for k, _ in pairs(mcl_fovapi.applied_modifiers[player_name]) do
|
||||
applied[k] = mcl_fovapi.registered_modifiers[k]
|
||||
end
|
||||
|
||||
local elem = next
|
||||
if elem(applied) == nil then
|
||||
player:set_fov(0, false, modifier.reset_time)
|
||||
return
|
||||
end
|
||||
local exc = false
|
||||
for k, _ in pairs(applied) do
|
||||
if applied[k].exclusive == true then
|
||||
exc = applied[k]
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- handle exclusives.
|
||||
if exc ~= false then
|
||||
player:set_fov(exc.fov_factor, exc.is_multiplier, 0) -- we want this to be immediate.
|
||||
else
|
||||
-- handle normal fov modifiers.
|
||||
local fov_factor = 1
|
||||
local non_multiplier_added = false
|
||||
for _, x in pairs(applied) do
|
||||
if not x.is_multiplier then
|
||||
if non_multiplier_added then
|
||||
fov_factor = (fov_factor + x.fov_factor) / 2
|
||||
else
|
||||
non_multiplier_added = true
|
||||
fov_factor = fov_factor * x.fov_factor
|
||||
end
|
||||
else
|
||||
fov_factor = fov_factor * x.fov_factor
|
||||
end
|
||||
end
|
||||
player:set_fov(fov_factor, not non_multiplier_added, modifier.reset_time)
|
||||
end
|
||||
|
||||
if mcl_fovapi.registered_modifiers[modifier_name].on_end then
|
||||
mcl_fovapi.registered_modifiers[modifier_name].on_end(player)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_fovapi.remove_all_modifiers(player)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
if DEBUG then
|
||||
minetest.log("FOV::Player: " .. player_name .. " modifiers have been reset.")
|
||||
end
|
||||
|
||||
for name, x in pairs(mcl_fovapi.applied_modifiers[player_name]) do
|
||||
x = nil
|
||||
if mcl_fovapi.registered_modifiers[name].on_end then
|
||||
mcl_fovapi.registered_modifiers[name].on_end(player)
|
||||
end
|
||||
end
|
||||
|
||||
player:set_fov(0, false, 0)
|
||||
end
|
||||
|
||||
--[[
|
||||
Notes:
|
||||
set_fov(fov, is_multiplier, transition_time): Sets player's FOV
|
||||
|
||||
fov: FOV value.
|
||||
is_multiplier: Set to true if the FOV value is a multiplier. Defaults to false.
|
||||
transition_time: If defined, enables smooth FOV transition. Interpreted as the time (in seconds) to reach target FOV.
|
||||
If set to 0, FOV change is instantaneous. Defaults to 0.
|
||||
Set fov to 0 to clear FOV override.
|
||||
|
||||
--]]
|
|
@ -0,0 +1,4 @@
|
|||
name = mcl_fovapi
|
||||
author = Michieal, Herowl
|
||||
description = An API for handling FOV changes.
|
||||
depends = mcl_player
|
|
@ -177,7 +177,7 @@ minetest.register_on_joinplayer(function(player)
|
|||
player_textures[name] = { "character.png", "blank.png", "blank.png" }
|
||||
|
||||
--player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
player:set_fov(86.1) -- see <https://minecraft.gamepedia.com/Options#Video_settings>>>>
|
||||
-- player:set_fov(86.1) -- see <https://minecraft.gamepedia.com/Options#Video_settings>>>>
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
|
|
|
@ -663,6 +663,8 @@ minetest.register_on_joinplayer(function(player)
|
|||
lastPos = nil,
|
||||
swimDistance = 0,
|
||||
jump_cooldown = -1, -- Cooldown timer for jumping, we need this to prevent the jump exhaustion to increase rapidly
|
||||
last_damage = 0,
|
||||
invul_timestamp = 0,
|
||||
}
|
||||
mcl_playerplus.elytra[player] = {active = false, rocketing = 0, speed = 0}
|
||||
|
||||
|
@ -727,19 +729,35 @@ mcl_damage.register_modifier(function(obj, damage, reason)
|
|||
end
|
||||
end, -200)
|
||||
|
||||
-- damage invulnerability
|
||||
mcl_damage.register_modifier(function(obj, damage, reason)
|
||||
local invul = obj:get_meta():get_int("mcl_damage:invulnerable")
|
||||
if invul > 0 then
|
||||
return 0
|
||||
else
|
||||
obj:get_meta():set_int("mcl_damage:invulnerable", 1)
|
||||
minetest.after(0.5, function()
|
||||
obj:get_meta():set_int("mcl_damage:invulnerable", 0)
|
||||
end)
|
||||
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
||||
-- attack reach limit
|
||||
if hitter and hitter:is_player() then
|
||||
local player_pos = player:get_pos()
|
||||
local hitter_pos = hitter:get_pos()
|
||||
if vector.distance(player_pos, hitter_pos) > 3 then
|
||||
damage = 0
|
||||
return damage
|
||||
end
|
||||
end, -1000)
|
||||
end
|
||||
-- damage invulnerability
|
||||
if hitter then
|
||||
local name = player:get_player_name()
|
||||
local time_now = minetest.get_us_time()
|
||||
local invul_timestamp = mcl_playerplus_internal[name].invul_timestamp
|
||||
local time_diff = time_now - invul_timestamp
|
||||
-- check for invulnerability time in microseconds (0.5 second)
|
||||
if time_diff <= 500000 and time_diff >= 0 then
|
||||
damage = damage - mcl_playerplus_internal[name].last_damage
|
||||
if damage < 0 then
|
||||
damage = 0
|
||||
end
|
||||
return damage
|
||||
else
|
||||
mcl_playerplus_internal[name].last_damage = damage
|
||||
mcl_playerplus_internal[name].invul_timestamp = time_now
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local pos = player:get_pos()
|
||||
|
|
|
@ -64,40 +64,24 @@ local function cancelClientSprinting(name)
|
|||
players[name].clientSprint = false
|
||||
end
|
||||
|
||||
mcl_fovapi.register_modifier({
|
||||
name = "sprint",
|
||||
fov_factor = 1.1,
|
||||
time = 0.15,
|
||||
is_multiplier = true,
|
||||
})
|
||||
|
||||
local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting)
|
||||
if not sprinting and not mcl_sprint.is_sprinting(playerName) then return end
|
||||
local player = minetest.get_player_by_name(playerName)
|
||||
local controls = player:get_player_control()
|
||||
if players[playerName] then
|
||||
players[playerName].sprinting = sprinting
|
||||
local fov_old = players[playerName].fov
|
||||
local fov_new = fov_old
|
||||
local fade_time = .15
|
||||
if sprinting == true
|
||||
or controls.RMB
|
||||
and string.find(player:get_wielded_item():get_name(), "mcl_bows:bow")
|
||||
and player:get_wielded_item():get_name() ~= "mcl_bows:bow" then
|
||||
if sprinting == true then
|
||||
fov_new = math.min(players[playerName].fov + 0.05, 1.2)
|
||||
else
|
||||
fov_new = .7
|
||||
players[playerName].fade_time = .3
|
||||
end
|
||||
if sprinting == true then
|
||||
if sprinting then
|
||||
playerphysics.add_physics_factor(player, "speed", "mcl_sprint:sprint", mcl_sprint.SPEED)
|
||||
end
|
||||
elseif sprinting == false
|
||||
and player:get_wielded_item():get_name() ~= "mcl_bows:bow_0"
|
||||
and player:get_wielded_item():get_name() ~= "mcl_bows:bow_1"
|
||||
and player:get_wielded_item():get_name() ~= "mcl_bows:bow_2" then
|
||||
fov_new = math.max(players[playerName].fov - 0.05, 1.0)
|
||||
if sprinting == false then
|
||||
mcl_fovapi.apply_modifier(player, "sprint")
|
||||
else
|
||||
playerphysics.remove_physics_factor(player, "speed", "mcl_sprint:sprint")
|
||||
end
|
||||
end
|
||||
if fov_new ~= fov_old then
|
||||
players[playerName].fov = fov_new
|
||||
player:set_fov(fov_new, true, fade_time)
|
||||
mcl_fovapi.remove_modifier(player, "sprint")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
name = mcl_sprint
|
||||
author = GunshipPenguin
|
||||
description = Allows the player to sprint by pressing the “Use” key (default: E).
|
||||
depends = mcl_playerinfo, playerphysics, mcl_hunger
|
||||
description = Allows the player to sprint by pressing the “AUX” key (default: E).
|
||||
depends = mcl_playerinfo, playerphysics, mcl_hunger, mcl_fovapi
|
||||
optional = mcl_bows
|
|
@ -214,6 +214,10 @@ mcl_mobs_overworld_threshold (Artificial light threshold to stop monster spawns
|
|||
mcl_mobs_overworld_sky_threshold (Skylight threshold to stop monster spawns in the Overworld) int 7 0 14
|
||||
mcl_mobs_overworld_passive_threshold (Combined light threshold to stop animal and npc spawns in the Overworld) int 7 0 14
|
||||
|
||||
# How far should villagers search for jobs, beds and bell
|
||||
# Larger values will have a larger performance impact (default:20)
|
||||
mcl_mobs_villager_search_radius (Villager job/bed/bell search radius) int 20 0 256
|
||||
|
||||
[Audio]
|
||||
# Enable flame sound.
|
||||
flame_sound (Flame sound) bool true
|
||||
|
|
Loading…
Reference in New Issue