mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-23 16:30:19 +01:00
parent
facc0f4b5a
commit
fa9e1e7a1e
47
mods/peace_areas/init.lua
Normal file
47
mods/peace_areas/init.lua
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
--
|
||||||
|
-- Peaceful areas
|
||||||
|
-- Where hitting is impossible
|
||||||
|
--
|
||||||
|
|
||||||
|
peace_areas = {areas = {}}
|
||||||
|
|
||||||
|
minetest.register_on_punchplayer(function(player, hitter)
|
||||||
|
local pos = player:getpos()
|
||||||
|
for name, positions in pairs(peace_areas.areas) do
|
||||||
|
local pos1 = positions["pos1"]
|
||||||
|
local pos2 = positions["pos2"]
|
||||||
|
local minp = {
|
||||||
|
x = math.min(pos1.x, pos2.x),
|
||||||
|
y = math.min(pos1.y, pos2.y),
|
||||||
|
z = math.min(pos1.z, pos2.z)
|
||||||
|
}
|
||||||
|
local maxp = {
|
||||||
|
x = math.max(pos1.x, pos2.x),
|
||||||
|
y = math.max(pos1.y, pos2.y),
|
||||||
|
z = math.max(pos1.z, pos2.z)
|
||||||
|
}
|
||||||
|
if minp.x < pos.x and pos.x < maxp.x and
|
||||||
|
minp.y < pos.y and pos.y < maxp.y and
|
||||||
|
minp.z < pos.z and pos.z < maxp.z then
|
||||||
|
if hitter:is_player() then
|
||||||
|
minetest.chat_send_player(hitter:get_player_name(), "You cannot punch player " ..
|
||||||
|
player:get_player_name() .. ". They are in area " .. name .. ".")
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
--[[
|
||||||
|
Note:
|
||||||
|
This use of the callback register_on_punchplayer may prevent other
|
||||||
|
instance of it to work correctly. Please take note of it.
|
||||||
|
]]--
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
function peace_areas.register_house(area_name, def)
|
||||||
|
peace_areas.areas[area_name] = def
|
||||||
|
end
|
||||||
|
|
||||||
|
peace_areas.register_area("spawn", {
|
||||||
|
["pos1"] = {x = 16, y = 0, z = 12},
|
||||||
|
["pos2"] = {x = 42, y = 100, z = -14},
|
||||||
|
})
|
@ -8,12 +8,15 @@ Ca y est, les classes Warrior et Hunter sont là ! (Venez les tester et aider no
|
|||||||
Venez visiter notre nouveau site "minetestforfun.com" !
|
Venez visiter notre nouveau site "minetestforfun.com" !
|
||||||
|
|
||||||
---Patch Notes---
|
---Patch Notes---
|
||||||
|
---??/??/????--- (Thanks to : LeMagnesium/Mg)
|
||||||
|
Addition of "peace_areas" (prevent players from punching each other in the spawn area)
|
||||||
|
|
||||||
---24/08/2015--- (Thanks to : crabman77/crabman, LeMagnesium/Mg)
|
---24/08/2015--- (Thanks to : crabman77/crabman, LeMagnesium/Mg)
|
||||||
Update of "mobs" (Minotaur monster isn't anymore damaged by water)
|
Update of "mobs" (Minotaur monster isn't anymore damaged by water)
|
||||||
Update of "biome_lib " (Fix again the sapling growth)
|
Update of "biome_lib " (Fix again the sapling growth)
|
||||||
|
|
||||||
---23/08/2015--- (Thanks to : LeMagnesium/Mg, crabman77/crabman)
|
---23/08/2015--- (Thanks to : LeMagnesium/Mg, crabman77/crabman)
|
||||||
Removed of "3dchest" (too many work to debug/adapt it, we can't work so hard for just an animated 1x1 or 2x1 chest)
|
Removal of "3dchest" (too many work to debug/adapt it, we can't work so hard for just an animated 1x1 or 2x1 chest)
|
||||||
Update of "moretrees" (Fix sapling growth)
|
Update of "moretrees" (Fix sapling growth)
|
||||||
Update of "moreblocks" (Fix the bricks nodes drops from the moreblocks circulsaw)
|
Update of "moreblocks" (Fix the bricks nodes drops from the moreblocks circulsaw)
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ load_mod_automappercolors = true
|
|||||||
load_mod_mapfix = true
|
load_mod_mapfix = true
|
||||||
load_mod_worldedge = true
|
load_mod_worldedge = true
|
||||||
load_mod_maze = true
|
load_mod_maze = true
|
||||||
|
load_mod_peace_areas = true
|
||||||
|
|
||||||
load_mod_watershed = true
|
load_mod_watershed = true
|
||||||
load_mod_bushes_classic = true
|
load_mod_bushes_classic = true
|
||||||
|
Loading…
Reference in New Issue
Block a user