2024-07-23 12:18:41 +03:00
|
|
|
su = {}
|
2024-07-24 09:17:26 +03:00
|
|
|
surface_effect = {
|
|
|
|
nplayer = {}
|
|
|
|
}
|
2024-07-23 12:18:41 +03:00
|
|
|
local timer = 0
|
|
|
|
|
2024-07-24 09:17:26 +03:00
|
|
|
dofile(minetest.get_modpath("surface_effect") .. "/function.lua")
|
2024-07-23 12:18:41 +03:00
|
|
|
|
|
|
|
minetest.register_globalstep(function(dtime)
|
|
|
|
-- every 5 seconds
|
|
|
|
if timer > os.time() then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
timer = os.time() + 10
|
|
|
|
|
|
|
|
|
|
|
|
for k, player in ipairs(minetest.get_connected_players()) do
|
|
|
|
local name = player:get_player_name()
|
|
|
|
local object = minetest.env:get_player_by_name(name)
|
|
|
|
surface_effect.setHud(player)
|
|
|
|
|
|
|
|
if object then
|
|
|
|
local pos = object:get_pos()
|
|
|
|
su.rediationDomage(player, pos)
|
|
|
|
--minetest.chat_send_all(dump(areas:getAreasAtPos(pos)))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
--Новый игрок
|
|
|
|
minetest.register_on_newplayer(function(player)
|
|
|
|
surface_effect.setHud(player)
|
|
|
|
|
2024-07-24 09:17:26 +03:00
|
|
|
surface_effect.showLogo(player)
|
|
|
|
|
2024-07-23 12:18:41 +03:00
|
|
|
if minetest.get_modpath("hazmat_suit") then
|
|
|
|
player:get_inventory():add_item("main", 'hazmat_suit:suit_hazmat 1')
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.get_modpath("farming") then
|
|
|
|
player:get_inventory():add_item("main", 'farming:bread 99')
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_joinplayer(function(player, last_login)
|
|
|
|
surface_effect.setHud(player)
|
2024-07-24 09:17:26 +03:00
|
|
|
surface_effect.showLogo(player)
|
|
|
|
|
2024-07-23 12:18:41 +03:00
|
|
|
local name = player:get_player_name()
|
|
|
|
local pos = player:get_pos()
|
|
|
|
|
2024-07-24 09:17:26 +03:00
|
|
|
surface_effect.nplayer[name]['logo'] = 'off'
|
2024-07-23 12:18:41 +03:00
|
|
|
end )
|
|
|
|
|
|
|
|
minetest.register_on_prejoinplayer(function(name, ip)
|
|
|
|
local player = minetest.get_player_by_name(name)
|
|
|
|
|
|
|
|
--Защита игрока отсмерти на спавне
|
|
|
|
--[[if object then
|
|
|
|
local pos = object:get_pos()
|
|
|
|
su.rediationDomage(player, pos)
|
|
|
|
end]]
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
|
|
|
--minetest.chat_send_all(dump(areas:getAreasAtPos(pos)))
|
|
|
|
local pos = player:get_pos()
|
|
|
|
local arAtr = areas:getAreasAtPos(pos)
|
|
|
|
|
|
|
|
if minetest.get_modpath("areas") then
|
|
|
|
if type(arAtr[1]) ~= 'nil' then
|
|
|
|
if arAtr[1]['name'] == 'spawn' then return true end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end )
|
|
|
|
|
|
|
|
--Вызывается, когда игрок покидает игру
|
|
|
|
--[[minetest.register_on_leaveplayer(function(player, timed_out)
|
|
|
|
|
|
|
|
end)]]
|
|
|
|
|
|
|
|
local mobs_monster = {
|
|
|
|
{name = "mobs_monster:sand_monster"},
|
|
|
|
{name = "mobs_monster:dirt_monster"},
|
|
|
|
{name = "mobs_monster:dungeon_master"},
|
|
|
|
{name = "mobs_monster:fire_spirit"},
|
|
|
|
{name = "mobs_monster:land_guard"},
|
|
|
|
{name = "mobs_monster:lava_flan"},
|
|
|
|
{name = "mobs_monster:mese_monster"},
|
|
|
|
{name = "mobs_monster:oerkki"},
|
|
|
|
{name = "mobs_monster:stone_monster"},
|
|
|
|
{name = "mobs_monster:tree_monster"},
|
|
|
|
}
|
|
|
|
|
|
|
|
for akey, v in ipairs(mobs_monster) do
|
|
|
|
local def = minetest.registered_entities[v.name]
|
|
|
|
def["on_die"] = function(self, pos)
|
|
|
|
minetest.add_item(pos, 'bonemeal:bone 5')
|
|
|
|
end
|
|
|
|
end
|