forked from VoxeLibre/VoxeLibre
Merge branch 'master' into api-cauldrons
This commit is contained in:
commit
890b95bb49
|
@ -33,10 +33,10 @@ mgvalleys_spflags = noaltitude_chill,noaltitude_dry,nohumid_rivers,vary_river_de
|
||||||
keepInventory = false
|
keepInventory = false
|
||||||
|
|
||||||
# Performance settings
|
# Performance settings
|
||||||
dedicated_server_step = 0.001
|
# dedicated_server_step = 0.001
|
||||||
abm_interval = 0.25
|
# abm_interval = 0.25
|
||||||
max_objects_per_block = 4096
|
# max_objects_per_block = 4096
|
||||||
max_packets_per_iteration = 10096
|
# max_packets_per_iteration = 10096
|
||||||
|
|
||||||
# Clientmodding to support official client
|
# Clientmodding to support official client
|
||||||
enable_client_modding = true
|
enable_client_modding = true
|
||||||
|
|
|
@ -117,6 +117,10 @@ function mcl_burning.damage(obj)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_burning.set_on_fire(obj, burn_time, reason)
|
function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
|
if obj:get_hp() < 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local luaentity = obj:get_luaentity()
|
local luaentity = obj:get_luaentity()
|
||||||
if luaentity and luaentity.fire_resistant then
|
if luaentity and luaentity.fire_resistant then
|
||||||
return
|
return
|
||||||
|
@ -145,7 +149,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
end
|
end
|
||||||
|
|
||||||
if old_burn_time <= burn_time then
|
if old_burn_time <= burn_time then
|
||||||
local sound_id = mcl_burning.get(obj, "int", "sound_id")
|
--[[local sound_id = mcl_burning.get(obj, "int", "sound_id")
|
||||||
if sound_id == 0 then
|
if sound_id == 0 then
|
||||||
sound_id = minetest.sound_play("fire_fire", {
|
sound_id = minetest.sound_play("fire_fire", {
|
||||||
object = obj,
|
object = obj,
|
||||||
|
@ -153,7 +157,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
max_hear_distance = 16,
|
max_hear_distance = 16,
|
||||||
loop = true,
|
loop = true,
|
||||||
}) + 1
|
}) + 1
|
||||||
end
|
end]]--
|
||||||
|
|
||||||
local hud_id
|
local hud_id
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
|
@ -163,7 +167,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
hud_elem_type = "image",
|
hud_elem_type = "image",
|
||||||
position = {x = 0.5, y = 0.5},
|
position = {x = 0.5, y = 0.5},
|
||||||
scale = {x = -100, y = -100},
|
scale = {x = -100, y = -100},
|
||||||
text = "fire_basic_flame.png",
|
text = "mcl_burning_hud_flame_animated.png",
|
||||||
z_index = 1000,
|
z_index = 1000,
|
||||||
}) + 1
|
}) + 1
|
||||||
end
|
end
|
||||||
|
@ -171,7 +175,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
||||||
mcl_burning.set(obj, "string", "reason", reason)
|
mcl_burning.set(obj, "string", "reason", reason)
|
||||||
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
||||||
mcl_burning.set(obj, "int", "sound_id", sound_id)
|
--mcl_burning.set(obj, "int", "sound_id", sound_id)
|
||||||
|
|
||||||
local fire_entity = minetest.add_entity(obj:get_pos(), "mcl_burning:fire")
|
local fire_entity = minetest.add_entity(obj:get_pos(), "mcl_burning:fire")
|
||||||
local minp, maxp = mcl_burning.get_collisionbox(obj)
|
local minp, maxp = mcl_burning.get_collisionbox(obj)
|
||||||
|
@ -194,8 +198,8 @@ end
|
||||||
|
|
||||||
function mcl_burning.extinguish(obj)
|
function mcl_burning.extinguish(obj)
|
||||||
if mcl_burning.is_burning(obj) then
|
if mcl_burning.is_burning(obj) then
|
||||||
local sound_id = mcl_burning.get(obj, "int", "sound_id") - 1
|
--local sound_id = mcl_burning.get(obj, "int", "sound_id") - 1
|
||||||
minetest.sound_stop(sound_id)
|
--minetest.sound_stop(sound_id)
|
||||||
|
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
local hud_id = mcl_burning.get(obj, "int", "hud_id") - 1
|
local hud_id = mcl_burning.get(obj, "int", "hud_id") - 1
|
||||||
|
@ -206,7 +210,7 @@ function mcl_burning.extinguish(obj)
|
||||||
mcl_burning.set(obj, "float", "burn_time")
|
mcl_burning.set(obj, "float", "burn_time")
|
||||||
mcl_burning.set(obj, "float", "damage_timer")
|
mcl_burning.set(obj, "float", "damage_timer")
|
||||||
mcl_burning.set(obj, "int", "hud_id")
|
mcl_burning.set(obj, "int", "hud_id")
|
||||||
mcl_burning.set(obj, "int", "sound_id")
|
--mcl_burning.set(obj, "int", "sound_id")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -337,8 +337,8 @@ ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
minetest.sound_play({name="mcl_bows_hit_other", gain=0.3}, {pos=self.object:get_pos(), max_hear_distance=16}, true)
|
minetest.sound_play({name="mcl_bows_hit_other", gain=0.3}, {pos=self.object:get_pos(), max_hear_distance=16}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mcl_burning.extinguish(self.object)
|
|
||||||
if not obj:is_player() then
|
if not obj:is_player() then
|
||||||
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
|
|
|
@ -85,14 +85,15 @@ minetest.register_craftitem("mcl_end:crystal", {
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
local node = minetest.get_node(pos).name
|
local node = minetest.get_node(pos)
|
||||||
|
local node_name = node.name
|
||||||
if placer and not placer:get_player_control().sneak then
|
if placer and not placer:get_player_control().sneak then
|
||||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
if minetest.registered_nodes[node_name] and minetest.registered_nodes[node_name].on_rightclick then
|
||||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
return minetest.registered_nodes[node_name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if find_crystal(pos) then return itemstack end
|
if find_crystal(pos) then return itemstack end
|
||||||
if node == "mcl_core:obsidian" or node == "mcl_core:bedrock" then
|
if node_name == "mcl_core:obsidian" or node_name == "mcl_core:bedrock" then
|
||||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,6 +33,53 @@ local dir_to_pitch = function(dir)
|
||||||
return -math.atan2(-dir.y, xz)
|
return -math.atan2(-dir.y, xz)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local player_vel_yaws = {}
|
||||||
|
|
||||||
|
function limit_vel_yaw(player_vel_yaw, yaw)
|
||||||
|
if player_vel_yaw < 0 then
|
||||||
|
player_vel_yaw = player_vel_yaw + 360
|
||||||
|
end
|
||||||
|
|
||||||
|
if yaw < 0 then
|
||||||
|
yaw = yaw + 360
|
||||||
|
end
|
||||||
|
|
||||||
|
if math.abs(player_vel_yaw - yaw) > 40 then
|
||||||
|
local player_vel_yaw_nm, yaw_nm = player_vel_yaw, yaw
|
||||||
|
if player_vel_yaw > yaw then
|
||||||
|
player_vel_yaw_nm = player_vel_yaw - 360
|
||||||
|
else
|
||||||
|
yaw_nm = yaw - 360
|
||||||
|
end
|
||||||
|
if math.abs(player_vel_yaw_nm - yaw_nm) > 40 then
|
||||||
|
local diff = math.abs(player_vel_yaw - yaw)
|
||||||
|
if diff > 180 and diff < 185 or diff < 180 and diff > 175 then
|
||||||
|
player_vel_yaw = yaw
|
||||||
|
elseif diff < 180 then
|
||||||
|
if player_vel_yaw < yaw then
|
||||||
|
player_vel_yaw = yaw - 40
|
||||||
|
else
|
||||||
|
player_vel_yaw = yaw + 40
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if player_vel_yaw < yaw then
|
||||||
|
player_vel_yaw = yaw + 40
|
||||||
|
else
|
||||||
|
player_vel_yaw = yaw - 40
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if player_vel_yaw < 0 then
|
||||||
|
player_vel_yaw = player_vel_yaw + 360
|
||||||
|
elseif player_vel_yaw > 360 then
|
||||||
|
player_vel_yaw = player_vel_yaw - 360
|
||||||
|
end
|
||||||
|
|
||||||
|
return player_vel_yaw
|
||||||
|
end
|
||||||
|
|
||||||
local pitch, name, node_stand, node_stand_below, node_head, node_feet, pos
|
local pitch, name, node_stand, node_stand_below, node_head, node_feet, pos
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
|
@ -45,19 +92,20 @@ minetest.register_globalstep(function(dtime)
|
||||||
local controls = player:get_player_control()
|
local controls = player:get_player_control()
|
||||||
name = player:get_player_name()
|
name = player:get_player_name()
|
||||||
|
|
||||||
|
local meta = player:get_meta()
|
||||||
|
|
||||||
local player_velocity = player:get_velocity() or player:get_player_velocity()
|
local player_velocity = player:get_velocity() or player:get_player_velocity()
|
||||||
|
|
||||||
-- controls head bone
|
-- controls head bone
|
||||||
local pitch = degrees(player:get_look_vertical()) * -1
|
local pitch = - degrees(player:get_look_vertical())
|
||||||
local yaw = degrees(player:get_look_horizontal()) * -1
|
local yaw = degrees(player:get_look_horizontal())
|
||||||
|
|
||||||
local player_vel_yaw = 0
|
local player_vel_yaw = degrees(dir_to_yaw(player_velocity))
|
||||||
|
if player_vel_yaw == 0 then
|
||||||
if degrees(dir_to_yaw(player_velocity)) == 0 then
|
player_vel_yaw = player_vel_yaws[name] or yaw
|
||||||
yaw = 0
|
|
||||||
else
|
|
||||||
player_vel_yaw = degrees(dir_to_yaw(player_velocity))
|
|
||||||
end
|
end
|
||||||
|
player_vel_yaw = limit_vel_yaw(player_vel_yaw, yaw)
|
||||||
|
player_vel_yaws[name] = player_vel_yaw
|
||||||
|
|
||||||
-- controls right and left arms pitch when shooting a bow or punching
|
-- controls right and left arms pitch when shooting a bow or punching
|
||||||
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
||||||
|
@ -80,42 +128,30 @@ minetest.register_globalstep(function(dtime)
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
elseif get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and is_sprinting(name) == true then
|
elseif get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and is_sprinting(name) == true then
|
||||||
-- set head pitch and yaw when swimming
|
-- set head pitch and yaw when swimming
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),yaw - player_vel_yaw * -1,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),player_vel_yaw - yaw,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
-- control body bone when swimming
|
-- control body bone when swimming
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,player_vel_yaw * -1 - yaw + 180,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,-player_vel_yaw + yaw + 180,0))
|
||||||
|
|
||||||
elseif player:get_attach() == nil then
|
elseif player:get_attach() == nil then
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
|
|
||||||
if player_velocity.x > 0.35 or player_velocity.z > 0.35 or player_velocity.x < -0.35 or player_velocity.z < -0.35 then
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch, player_vel_yaw - yaw, 0))
|
||||||
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0, -player_vel_yaw + yaw, 0))
|
||||||
-- controls head and Body_Control bones while moving backwards
|
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1,0))
|
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw,0))
|
|
||||||
else
|
|
||||||
-- controls head and Body_Control bones while moving forwards
|
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1 + 180,0))
|
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw + 180,0))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
local attached = player:get_attach(parent)
|
local attached = player:get_attach(parent)
|
||||||
local attached_yaw = degrees(attached:get_yaw())
|
local attached_yaw = degrees(attached:get_yaw())
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,degrees(player:get_look_horizontal()) * -1 + attached_yaw,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch, -limit_vel_yaw(yaw, attached_yaw) + attached_yaw, 0))
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
end
|
end
|
||||||
|
|
||||||
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
||||||
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
|
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
|
||||||
end
|
end
|
||||||
if player:get_player_control().jump and mcl_playerplus_internal[name].jump_cooldown <= 0 then
|
if controls.jump and mcl_playerplus_internal[name].jump_cooldown <= 0 then
|
||||||
|
|
||||||
pos = player:get_pos()
|
pos = player:get_pos()
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ minetest.register_on_joinplayer(function(player)
|
||||||
minetest.after(0, function(player)
|
minetest.after(0, function(player)
|
||||||
wieldview:update_wielded_item(player)
|
wieldview:update_wielded_item(player)
|
||||||
local itementity = minetest.add_entity(player:get_pos(), "wieldview:wieldnode")
|
local itementity = minetest.add_entity(player:get_pos(), "wieldview:wieldnode")
|
||||||
itementity:set_attach(player, "Hand_Right", vector.new(0, 1, 0), vector.new(-90, 0, 45))
|
itementity:set_attach(player, "Hand_Right", vector.new(0, 1, 0), vector.new(90, 0, 45))
|
||||||
itementity:get_luaentity().wielder = name
|
itementity:get_luaentity().wielder = name
|
||||||
end, player)
|
end, player)
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue