Use correct gravity everywhere

master
Wuzzy 2021-07-08 22:12:44 +02:00
parent 7688980c3f
commit e8fdee1bfd
3 changed files with 9 additions and 5 deletions

View File

@ -5,6 +5,8 @@
--Drop entities
local GRAVITY = -(tonumber(minetest.settings:get("movement_gravity")) or 10)
minetest.register_entity("drippingwater:drop_water", {
hp_max = 2,
physical = true,
@ -28,11 +30,11 @@ minetest.register_entity("drippingwater:drop_water", {
local ownpos = self.object:get_pos()
if k==1 then
self.object:set_acceleration({x=0, y=-5, z=0})
self.object:set_acceleration({x=0, y=GRAVITY, z=0})
end
if minetest.get_node({x=ownpos.x, y=ownpos.y+0.5, z=ownpos.z}).name == "air" then
self.object:set_acceleration({x=0, y=-5, z=0})
self.object:set_acceleration({x=0, y=GRAVITY, z=0})
end
if minetest.get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then

View File

@ -60,6 +60,7 @@ local mob_nospawn_range = tonumber(settings:get("mob_nospawn_range") or 12)
local active_limit = tonumber(settings:get("mob_active_limit") or 0)
local mob_chance_multiplier = tonumber(settings:get("mob_chance_multiplier") or 1)
local active_mobs = 0
local GRAVITY = -(tonumber(minetest.settings:get("movement_gravity")) or 10)
-- Peaceful mode message so players will know there are no monsters
@ -669,7 +670,7 @@ local effect = function(pos, amount, texture, min_size, max_size,
radius = radius or 2
min_size = min_size or 0.5
max_size = max_size or 1
gravity = gravity or -10
gravity = gravity or GRAVITY
glow = glow or 0
if fall == true then
@ -2620,7 +2621,7 @@ function mob_class:falling(pos)
-- sanity check
if not v then return end
local fall_speed = -10 -- gravity
local fall_speed = GRAVITY
-- don't exceed mob fall speed
if v.y < self.fall_speed then

View File

@ -3,6 +3,7 @@
local enable_crash = false
local crash_threshold = 6.5 -- ignored if enable_crash=false
local GRAVITY = -(tonumber(minetest.settings:get("movement_gravity")) or 10)
------------------------------------------------------------------------------
@ -300,7 +301,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
-- Set position, velocity and acceleration
local p = entity.object:get_pos()
local new_velo
local new_acce = {x = 0, y = -9.8, z = 0}
local new_acce = {x = 0, y = GRAVITY, z = 0}
p.y = p.y - 0.5