mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
Copying code of cactus' check in sprint
- Sprint mod now check if the player is near a cactus. If yes, it hurts him. However, the duration between two checking is about 0.1 seconds.
This commit is contained in:
parent
c1f5523d9e
commit
3c10469c03
@ -1,18 +1,18 @@
|
||||
# Reduces the amount of resources and fps used by snowfall.
|
||||
lighter_snowfall = false
|
||||
# Enables smooth transition of biomes
|
||||
smooth_biomes = true
|
||||
# The minumum height a snow biome will generate.
|
||||
min_height = 3
|
||||
# Disable this to prevent sleds from being riden.
|
||||
sleds = true
|
||||
# Whether you are running a legacy minetest version (auto-detected).
|
||||
legacy = false
|
||||
# Enables falling snow.
|
||||
enable_snowfall = true
|
||||
# Disable this to stop snow from being smoothed.
|
||||
smooth_snow = true
|
||||
# Disable this to remove christmas saplings from being found.
|
||||
christmas_content = true
|
||||
# Whether you are running a legacy minetest version (auto-detected).
|
||||
legacy = false
|
||||
# The minumum height a snow biome will generate.
|
||||
min_height = 3
|
||||
# Disable this to prevent sleds from being riden.
|
||||
sleds = true
|
||||
# Enables debug output.
|
||||
debug = false
|
||||
# Enables falling snow.
|
||||
enable_snowfall = true
|
||||
# Reduces the amount of resources and fps used by snowfall.
|
||||
lighter_snowfall = false
|
||||
# Enables smooth transition of biomes
|
||||
smooth_biomes = true
|
||||
|
@ -40,7 +40,23 @@ minetest.register_globalstep(function(dtime)
|
||||
--Loop through all connected players
|
||||
for playerName,playerInfo in pairs(players) do
|
||||
local player = minetest.get_player_by_name(playerName)
|
||||
local pos = player:getpos()
|
||||
if player ~= nil then
|
||||
-- From playerplus :
|
||||
-- am I near a cactus?
|
||||
pos.y = pos.y + 0.1
|
||||
local near = minetest.find_node_near(pos, 1, "default:cactus")
|
||||
if near then
|
||||
pos = near
|
||||
|
||||
-- am I touching the cactus? if so it hurts
|
||||
for _,player in ipairs(minetest.get_objects_inside_radius(pos, 1.0)) do
|
||||
if player:get_hp() > 0 then
|
||||
player:set_hp(player:get_hp()-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Check if they are pressing the e key
|
||||
players[playerName]["epressed"] = player:get_player_control()["aux1"]
|
||||
|
||||
|
@ -40,7 +40,23 @@ minetest.register_globalstep(function(dtime)
|
||||
--Loop through all connected players
|
||||
for playerName,playerInfo in pairs(players) do
|
||||
local player = minetest.get_player_by_name(playerName)
|
||||
local pos = player:getpos()
|
||||
if player ~= nil then
|
||||
-- From playerplus :
|
||||
-- am I near a cactus?
|
||||
pos.y = pos.y + 0.1
|
||||
local near = minetest.find_node_near(pos, 1, "default:cactus")
|
||||
if near then
|
||||
pos = near
|
||||
|
||||
-- am I touching the cactus? if so it hurts
|
||||
for _,player in ipairs(minetest.get_objects_inside_radius(pos, 1.0)) do
|
||||
if player:get_hp() > 0 then
|
||||
player:set_hp(player:get_hp()-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Check if they are moving or not
|
||||
players[playerName]["moving"] = player:get_player_control()["up"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user