bugfixing
This commit is contained in:
parent
60477a6baa
commit
9ec86aa254
@ -11,7 +11,7 @@ minetest.register_chatcommand("area_effect_set", {
|
||||
params = "<ID> <key> <value>",
|
||||
description = "Sets an area attribute",
|
||||
func = function(playername, param)
|
||||
local _, _, id_str, key, value = string.find(param, "^([^%s]+)%s+([^%s])%s+(.*)$")
|
||||
local _, _, id_str, key, value = string.find(param, "^([^%s]+)%s+([^%s]+)%s+(.*)$")
|
||||
if id_str == nil or not key then
|
||||
return true, "Invalid syntax!"
|
||||
end
|
||||
@ -53,9 +53,13 @@ minetest.register_chatcommand("area_effect_get", {
|
||||
return true, "area-id is not numeric: " .. param
|
||||
end
|
||||
|
||||
local data = epic.data_area.get(id)
|
||||
local data = area_effects.get(id)
|
||||
if not data then
|
||||
return true, "No effects"
|
||||
else
|
||||
return true, "Area " .. id .. "\n" .. format_data(data)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("area_effects", {
|
||||
|
1
init.lua
1
init.lua
@ -16,6 +16,7 @@ dofile(MP.."/accessors.lua")
|
||||
dofile(MP.."/transition.lua")
|
||||
dofile(MP.."/hooks.lua")
|
||||
dofile(MP.."/log.lua")
|
||||
dofile(MP.."/chatcommands.lua")
|
||||
|
||||
if minetest.get_modpath("epic_skybox") then
|
||||
dofile(MP.."/integrations/epic_skybox.lua")
|
||||
|
@ -4,7 +4,7 @@ area_effects.register_effect("day_night", "float value from 0.0 to 1.0")
|
||||
area_effects.register_hook({
|
||||
enter = function(player, id)
|
||||
local data = area_effects.get(id)
|
||||
if data.day_night then
|
||||
if data and data.day_night then
|
||||
local num = tonumber(data.day_night)
|
||||
player:override_day_night_ratio(num)
|
||||
end
|
||||
@ -12,7 +12,7 @@ area_effects.register_hook({
|
||||
|
||||
leave = function(player, id)
|
||||
local data = area_effects.get(id)
|
||||
if data.day_night then
|
||||
if data and data.day_night then
|
||||
player:override_day_night_ratio(nil)
|
||||
end
|
||||
end
|
||||
|
@ -4,9 +4,9 @@ area_effects.register_effect("skybox", "names from /skybox_list")
|
||||
area_effects.register_hook({
|
||||
enter = function(player, id)
|
||||
local data = area_effects.get(id)
|
||||
if data.skybox then
|
||||
if data and data.skybox then
|
||||
for _, skyboxdef in ipairs(epic_skybox.list) do
|
||||
if skyboxdef == data.skybox then
|
||||
if skyboxdef.name == data.skybox then
|
||||
epic_skybox.set_skybox(player, skyboxdef)
|
||||
break
|
||||
end
|
||||
@ -16,8 +16,8 @@ area_effects.register_hook({
|
||||
|
||||
leave = function(player, id)
|
||||
local data = area_effects.get(id)
|
||||
if data.skybox then
|
||||
epic_skybox.set_skybox(player)
|
||||
if data and data.skybox then
|
||||
epic_skybox.set_skybox(player, {})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -4,14 +4,14 @@ area_effects.register_effect("weather", "weather definitions")
|
||||
area_effects.register_hook({
|
||||
enter = function(player, id)
|
||||
local data = area_effects.get(id)
|
||||
if data.weather then
|
||||
if data and data.weather then
|
||||
epic_weather.current_weather[player:get_player_name()] = data.weather
|
||||
end
|
||||
end,
|
||||
|
||||
leave = function(player, id)
|
||||
local data = area_effects.get(id)
|
||||
if data.weather then
|
||||
if data and data.weather then
|
||||
epic_weather.current_weather[player:get_player_name()] = nil
|
||||
end
|
||||
end
|
||||
|
@ -4,14 +4,14 @@ area_effects.register_effect("no_clouds", "disables the clouds")
|
||||
area_effects.register_hook({
|
||||
enter = function(player, id)
|
||||
local data = area_effects.get(id)
|
||||
if data.no_clouds then
|
||||
if data and data.no_clouds then
|
||||
player:set_clouds({density=0,speed=0})
|
||||
end
|
||||
end,
|
||||
|
||||
leave = function(player, id)
|
||||
local data = area_effects.get(id)
|
||||
if data.no_clouds then
|
||||
if data and data.no_clouds then
|
||||
player:set_clouds({
|
||||
thickness=16,
|
||||
color={r=243, g=214, b=255, a=229},
|
||||
|
@ -32,6 +32,7 @@ local function check()
|
||||
if not active_entry[id] then
|
||||
-- player entered
|
||||
area_effects.run_hook("enter", { player, id })
|
||||
active_entry[id] = true
|
||||
end
|
||||
end
|
||||
|
||||
@ -40,6 +41,7 @@ local function check()
|
||||
if not current_ids[id] then
|
||||
-- player left
|
||||
area_effects.run_hook("leave", { player, id })
|
||||
active_entry[id] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user