forked from VoxeLibre/VoxeLibre
Remove remaining ENVIRONMENT mods
This commit is contained in:
parent
bb9b9f303b
commit
d3320bd20a
|
@ -1,15 +0,0 @@
|
||||||
# `mcl_moon` API
|
|
||||||
This API has one function:
|
|
||||||
|
|
||||||
## `mcl_moon.get_moon_phase()`
|
|
||||||
|
|
||||||
Returns current moon phase (0-7).
|
|
||||||
|
|
||||||
* 0 = Full Moon
|
|
||||||
* 1 = Waning Gibbous
|
|
||||||
* 2 = Last Quarter
|
|
||||||
* 3 = Waning Crescent
|
|
||||||
* 4 = New Moon
|
|
||||||
* 5 = Waxing Crescent
|
|
||||||
* 6 = First Quarter
|
|
||||||
* 7 = Waxing Gibbous
|
|
|
@ -1,62 +0,0 @@
|
||||||
local MOON_PHASES = 8
|
|
||||||
local MOON_PHASES_HALF = MOON_PHASES / 2
|
|
||||||
local SHEET_W = 4
|
|
||||||
local SHEET_H = 2
|
|
||||||
|
|
||||||
-- Randomize initial moon phase, based on map seed
|
|
||||||
local mg_seed = minetest.get_mapgen_setting("seed")
|
|
||||||
local rand = PseudoRandom(mg_seed)
|
|
||||||
local phase_offset = rand:next(0, MOON_PHASES - 1)
|
|
||||||
|
|
||||||
minetest.log("info", "[mcl_moon] Moon phase offset of this world: "..phase_offset)
|
|
||||||
|
|
||||||
mcl_moon = {}
|
|
||||||
mcl_moon.MOON_PHASES = MOON_PHASES
|
|
||||||
|
|
||||||
function mcl_moon.get_moon_phase()
|
|
||||||
local after_midday = 0
|
|
||||||
-- Moon phase changes after midday
|
|
||||||
local tod = minetest.get_timeofday()
|
|
||||||
if tod > 0.5 then
|
|
||||||
after_midday = 1
|
|
||||||
end
|
|
||||||
return (minetest.get_day_count() + phase_offset + after_midday) % MOON_PHASES
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_moon_texture()
|
|
||||||
local phase = mcl_moon.get_moon_phase()
|
|
||||||
local x = phase % MOON_PHASES_HALF
|
|
||||||
local y
|
|
||||||
if phase >= MOON_PHASES_HALF then
|
|
||||||
y = 1
|
|
||||||
else
|
|
||||||
y = 0
|
|
||||||
end
|
|
||||||
return "mcl_moon_moon_phases.png^[sheet:"..SHEET_W.."x"..SHEET_H..":"..x..","..y
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
local last_reported_phase = nil
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer + dtime
|
|
||||||
if timer < 8 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
timer = 0
|
|
||||||
local phase = mcl_moon.get_moon_phase()
|
|
||||||
-- No-op when moon phase didn't change yet
|
|
||||||
if last_reported_phase == phase then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
minetest.log("info", "[mcl_moon] New moon phase: "..phase)
|
|
||||||
last_reported_phase = phase
|
|
||||||
local moon_arg = {texture = get_moon_texture()}
|
|
||||||
local players = minetest.get_connected_players()
|
|
||||||
for p=1, #players do
|
|
||||||
players[p]:set_moon(moon_arg)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
player:set_moon({texture = get_moon_texture(), scale=3.75})
|
|
||||||
end)
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_moon
|
|
||||||
author = Wuzzy
|
|
||||||
description = Adds moon phases to the game
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
|
@ -1,87 +0,0 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
|
||||||
--local enable_damage = minetest.settings:get_bool("enable_damage")
|
|
||||||
|
|
||||||
local pos_to_dim = mcl_worlds.pos_to_dimension
|
|
||||||
local dim_change = mcl_worlds.dimension_change
|
|
||||||
local is_in_void = mcl_worlds.is_in_void
|
|
||||||
local get_spawn_pos = mcl_spawn.get_player_spawn_pos
|
|
||||||
local send_chat = minetest.chat_send_player
|
|
||||||
local get_connected = minetest.get_connected_players
|
|
||||||
|
|
||||||
local voidtimer = 0
|
|
||||||
local VOID_DAMAGE_FREQ = 0.5
|
|
||||||
local VOID_DAMAGE = 4
|
|
||||||
|
|
||||||
-- Remove entities that fall too deep into the void
|
|
||||||
minetest.register_on_mods_loaded(function()
|
|
||||||
-- We do this by overwriting on_step of all entities
|
|
||||||
for entitystring, def in pairs(minetest.registered_entities) do
|
|
||||||
local on_step_old = def.on_step
|
|
||||||
if not on_step_old then
|
|
||||||
on_step_old = function() end
|
|
||||||
end
|
|
||||||
local on_step = function(self, dtime, moveresult)
|
|
||||||
on_step_old(self, dtime, moveresult)
|
|
||||||
local obj = self.object
|
|
||||||
local pos = obj:get_pos()
|
|
||||||
-- Old on_step function might have deleted object,
|
|
||||||
-- so we delete it
|
|
||||||
if not pos then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not self._void_timer then
|
|
||||||
self._void_timer = 0
|
|
||||||
end
|
|
||||||
self._void_timer = self._void_timer + dtime
|
|
||||||
if self._void_timer <= VOID_DAMAGE_FREQ then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
self._void_timer = 0
|
|
||||||
|
|
||||||
local _, void_deadly = is_in_void(pos)
|
|
||||||
if void_deadly then
|
|
||||||
--local ent = obj:get_luaentity()
|
|
||||||
obj:remove()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
def.on_step = on_step
|
|
||||||
minetest.register_entity(":"..entitystring, def)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Hurt players or teleport them back to spawn if they are too deep in the void
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
voidtimer = voidtimer + dtime
|
|
||||||
if voidtimer > VOID_DAMAGE_FREQ then
|
|
||||||
voidtimer = 0
|
|
||||||
local enable_damage = minetest.settings:get_bool("enable_damage")
|
|
||||||
local players = get_connected()
|
|
||||||
for p=1, #players do
|
|
||||||
local player = players[p]
|
|
||||||
local pos = player:get_pos()
|
|
||||||
local _, void_deadly = is_in_void(pos)
|
|
||||||
if void_deadly then
|
|
||||||
local immortal_val = player:get_armor_groups().immortal
|
|
||||||
local is_immortal = false
|
|
||||||
if immortal_val and immortal_val > 0 then
|
|
||||||
is_immortal = true
|
|
||||||
end
|
|
||||||
if is_immortal or not enable_damage then
|
|
||||||
-- If damage is disabled, we can't kill players.
|
|
||||||
-- So we just teleport the player back to spawn.
|
|
||||||
local spawn = get_spawn_pos(player)
|
|
||||||
player:set_pos(spawn)
|
|
||||||
dim_change(player, pos_to_dim(spawn))
|
|
||||||
send_chat(player:get_player_name(), S("The void is off-limits to you!"))
|
|
||||||
elseif enable_damage and not is_immortal then
|
|
||||||
-- Damage enabled, not immortal: Deal void damage (4 HP / 0.5 seconds)
|
|
||||||
if player:get_hp() > 0 then
|
|
||||||
mcl_util.deal_damage(player, VOID_DAMAGE, {type = "out_of_world"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
|
@ -1,3 +0,0 @@
|
||||||
# textdomain: mcl_void_damage
|
|
||||||
The void is off-limits to you!=Die Leere ist für Sie tabu!
|
|
||||||
@1 fell into the endless void.=@1 fiel in die endlose Leere.
|
|
|
@ -1,3 +0,0 @@
|
||||||
# textdomain: mcl_void_damage
|
|
||||||
The void is off-limits to you!=¡El vacío está fuera de tus límites!
|
|
||||||
@1 fell into the endless void.=@1 cayó en el vacío infinito.
|
|
|
@ -1,3 +0,0 @@
|
||||||
# textdomain: mcl_void_damage
|
|
||||||
The void is off-limits to you!=Le vide vous est interdit!
|
|
||||||
@1 fell into the endless void.=@1 est tombé dans le vide sans fin.
|
|
|
@ -1,3 +0,0 @@
|
||||||
# textdomain: mcl_void_damage
|
|
||||||
The void is off-limits to you!=Otchłań jest poza twoim zasięgiem!
|
|
||||||
@1 fell into the endless void.=@1 spadła w bezkresną otchłań.
|
|
|
@ -1,3 +0,0 @@
|
||||||
# textdomain: mcl_void_damage
|
|
||||||
The void is off-limits to you!=Пустота запрещена для вас!
|
|
||||||
@1 fell into the endless void.=@1 упал(а) в бесконечную пустоту.
|
|
|
@ -1,3 +0,0 @@
|
||||||
# textdomain: mcl_void_damage
|
|
||||||
The void is off-limits to you!=你不可以進入虛空!
|
|
||||||
@1 fell into the endless void.=@1 掉到世界外面了。
|
|
|
@ -1,3 +0,0 @@
|
||||||
# textdomain: mcl_void_damage
|
|
||||||
The void is off-limits to you!=
|
|
||||||
@1 fell into the endless void.=
|
|
|
@ -1,4 +0,0 @@
|
||||||
name = mcl_void_damage
|
|
||||||
author = Wuzzy
|
|
||||||
description = Deal damage to entities stuck in the deep void
|
|
||||||
depends = mcl_worlds
|
|
Loading…
Reference in New Issue