Use per-player camera height

This commit is contained in:
stujones11 2019-04-02 15:38:23 +01:00
parent 2a5674e67d
commit 2a68881248
6 changed files with 4 additions and 12 deletions

View file

@ -11,7 +11,6 @@ shooter_allow_nodes (Allow node destruction) bool true
shooter_allow_entities (Allow damage to active objects in multiplayer mode) bool false
shooter_allow_players (Allow damage to players in multiplayer mode) bool true
shooter_rounds_update_time (Round update time, should be >= dedicated server step) float 0.4
shooter_camera_height (Camera height used for raycasting) float 1.5
[shooter_crossbow]

View file

@ -88,12 +88,6 @@ Maximum round 'step' processing interval, will inversely effect the long-range v
`shooter_rounds_update_time = 0.4`
### Camera Height
Player eye offset used for rayasting and particle effects
`shooter_camera_height = 1.5`
API Documentation
-----------------

View file

@ -34,7 +34,6 @@ shooter.config = {
allow_entities = false,
allow_players = true,
rounds_update_time = 0.4,
camera_height = 1.5,
}
shooter.default_particles = {
@ -364,7 +363,7 @@ local function fire_weapon(player, itemstack, spec, extended)
if not dir or not pos then
return
end
pos.y = pos.y + config.camera_height
pos.y = pos.y + player:get_properties().eye_height
spec.origin = v3d.add(pos, dir)
local interval = spec.tool_caps.full_punch_interval
shots[spec.user] = minetest.get_us_time() / 1000000 + interval

View file

@ -225,7 +225,7 @@ for _, color in pairs(dye_basecolors) do
local dir = user:get_look_dir()
local yaw = user:get_look_horizontal()
if pos and dir and yaw then
pos.y = pos.y + shooter.config.camera_height
pos.y = pos.y + user:get_properties().eye_height
local obj = minetest.add_entity(pos,
"shooter_crossbow:arrow_entity")
local ent = nil

View file

@ -77,7 +77,7 @@ minetest.register_tool("shooter_grenade:grenade", {
local dir = user:get_look_dir()
local yaw = user:get_look_horizontal()
if pos and dir then
pos.y = pos.y + shooter.config.camera_height
pos.y = pos.y + user:get_properties().eye_height
local obj = minetest.add_entity(pos, "shooter_grenade:grenade_entity")
if obj then
minetest.sound_play("shooter_throw", {object=obj})

View file

@ -85,7 +85,7 @@ minetest.register_tool("shooter_rocket:rocket_gun_loaded", {
local dir = user:get_look_dir()
local yaw = user:get_look_horizontal()
if pos and dir and yaw then
pos.y = pos.y + shooter.config.camera_height
pos.y = pos.y + user:get_properties().eye_height
local obj = minetest.add_entity(pos, "shooter_rocket:rocket_entity")
if obj then
minetest.sound_play("shooter_rocket_fire", {object=obj})