mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-25 02:00: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.
|
# Whether you are running a legacy minetest version (auto-detected).
|
||||||
lighter_snowfall = false
|
legacy = false
|
||||||
# Enables smooth transition of biomes
|
# Enables falling snow.
|
||||||
smooth_biomes = true
|
enable_snowfall = true
|
||||||
# The minumum height a snow biome will generate.
|
|
||||||
min_height = 3
|
|
||||||
# Disable this to prevent sleds from being riden.
|
|
||||||
sleds = true
|
|
||||||
# Disable this to stop snow from being smoothed.
|
# Disable this to stop snow from being smoothed.
|
||||||
smooth_snow = true
|
smooth_snow = true
|
||||||
# Disable this to remove christmas saplings from being found.
|
# Disable this to remove christmas saplings from being found.
|
||||||
christmas_content = true
|
christmas_content = true
|
||||||
# Whether you are running a legacy minetest version (auto-detected).
|
# The minumum height a snow biome will generate.
|
||||||
legacy = false
|
min_height = 3
|
||||||
|
# Disable this to prevent sleds from being riden.
|
||||||
|
sleds = true
|
||||||
# Enables debug output.
|
# Enables debug output.
|
||||||
debug = false
|
debug = false
|
||||||
# Enables falling snow.
|
# Reduces the amount of resources and fps used by snowfall.
|
||||||
enable_snowfall = true
|
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
|
--Loop through all connected players
|
||||||
for playerName,playerInfo in pairs(players) do
|
for playerName,playerInfo in pairs(players) do
|
||||||
local player = minetest.get_player_by_name(playerName)
|
local player = minetest.get_player_by_name(playerName)
|
||||||
|
local pos = player:getpos()
|
||||||
if player ~= nil then
|
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
|
--Check if they are pressing the e key
|
||||||
players[playerName]["epressed"] = player:get_player_control()["aux1"]
|
players[playerName]["epressed"] = player:get_player_control()["aux1"]
|
||||||
|
|
||||||
|
@ -40,7 +40,23 @@ minetest.register_globalstep(function(dtime)
|
|||||||
--Loop through all connected players
|
--Loop through all connected players
|
||||||
for playerName,playerInfo in pairs(players) do
|
for playerName,playerInfo in pairs(players) do
|
||||||
local player = minetest.get_player_by_name(playerName)
|
local player = minetest.get_player_by_name(playerName)
|
||||||
|
local pos = player:getpos()
|
||||||
if player ~= nil then
|
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
|
--Check if they are moving or not
|
||||||
players[playerName]["moving"] = player:get_player_control()["up"]
|
players[playerName]["moving"] = player:get_player_control()["up"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user