mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-14 06:20:32 +01:00
Merge branch 'NALC2' into NALC
This commit is contained in:
commit
23e114d609
7
.gitmodules
vendored
7
.gitmodules
vendored
|
@ -84,3 +84,10 @@
|
|||
path = mods/moreflowers
|
||||
url = https://github.com/sys4-fr/moreflowers.git
|
||||
branch = master
|
||||
[submodule "mods/claycrafter"]
|
||||
path = mods/claycrafter
|
||||
url = https://github.com/Dragonop/claycrafter.git
|
||||
[submodule "mods/camera"]
|
||||
path = mods/camera
|
||||
url = https://github.com/sys4-fr/camera.git
|
||||
branch = dev
|
||||
|
|
|
@ -249,6 +249,7 @@ armor.set_player_armor = function(self, player)
|
|||
player:set_armor_groups(armor_groups)
|
||||
--player:set_physics_override(physics_o)
|
||||
player_physics.set_stats(player, "3d_armor", {speed=physics_o.speed-1, jump=physics_o.jump-1, gravity=physics_o.gravity-1})
|
||||
pclasses.api.util.on_update(name)
|
||||
self.textures[name].armor = armor_texture
|
||||
self.textures[name].preview = preview
|
||||
self.def[name].state = state
|
||||
|
|
1
mods/camera
Submodule
1
mods/camera
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 71924a4d0747064338f593f53856a3cc1e1c5007
|
1
mods/claycrafter
Submodule
1
mods/claycrafter
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit c8c4e41cae63b6e0837ccfe246eea1deaabe4ec5
|
|
@ -14,6 +14,9 @@ pclasses.api.register_class("admin", {
|
|||
end,
|
||||
on_unassigned = function(pname)
|
||||
end,
|
||||
on_update = function(pname)
|
||||
-- No specific armor changes, no code
|
||||
end,
|
||||
switch_params = {
|
||||
color = {r = 255, g = 00, b = 224},
|
||||
holo_item = "maptools:pick_admin"
|
||||
|
|
|
@ -6,22 +6,37 @@
|
|||
-- See https://github.com/Ombridride/minetest-minetestforfun-server/issues/114
|
||||
--
|
||||
|
||||
local tmp = {}
|
||||
|
||||
pclasses.api.register_class("hunter", {
|
||||
on_assigned = function(pname, inform)
|
||||
if inform then
|
||||
minetest.chat_send_player(pname, "You are now a hunter")
|
||||
minetest.sound_play("pclasses_full_hunter", {to_player=pname, gain=1})
|
||||
end
|
||||
local reinforced = pclasses.api.util.does_wear_full_armor(pname, "reinforcedleather", true)
|
||||
if reinforced then
|
||||
sprint.increase_maxstamina(pname, 40)
|
||||
else
|
||||
sprint.increase_maxstamina(pname, 30)
|
||||
end
|
||||
sprint.increase_maxstamina(pname, 20)
|
||||
minetest.log("action", "[PClasses] Player " .. pname .. " become a hunter")
|
||||
end,
|
||||
on_unassigned = function(pname)
|
||||
sprint.set_default_maxstamina(pname)
|
||||
sprint.decrease_maxstamina(pname, 20)
|
||||
if tmp[pname] then
|
||||
sprint.decrease_maxstamina(pname, 10)
|
||||
tmp[pname] = nil
|
||||
end
|
||||
end,
|
||||
on_update = function(pname)
|
||||
local reinforced = pclasses.api.util.does_wear_full_armor(pname, "reinforcedleather", true)
|
||||
if reinforced then
|
||||
if not tmp[pname] then
|
||||
tmp[pname] = true
|
||||
sprint.increase_maxstamina(pname, 10) -- 10 more
|
||||
end
|
||||
else
|
||||
if tmp[pname] then
|
||||
tmp[pname] = false
|
||||
sprint.decrease_maxstamina(pname, 10)
|
||||
end
|
||||
end
|
||||
end,
|
||||
switch_params = {
|
||||
color = {r = 30, g = 170, b = 00},
|
||||
|
@ -43,6 +58,9 @@ pclasses.api.register_class("hunter", {
|
|||
"you need to fight a super strong mob, but it's just details...)") .. "image[2.4,5.6;6,4;pclasses_showcase_hunter.png]"
|
||||
})
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
tmp[player:get_player_name()] = false
|
||||
end)
|
||||
|
||||
pclasses.api.reserve_item("hunter", "throwing:bow_minotaur_horn")
|
||||
pclasses.api.reserve_item("hunter", "throwing:bow_minotaur_horn_loaded")
|
||||
|
|
|
@ -12,11 +12,14 @@ pclasses.api.register_class("warrior", {
|
|||
minetest.sound_play("pclasses_full_warrior", {to_player=pname, gain=1})
|
||||
minetest.chat_send_player(pname, "You are now a warrior")
|
||||
end
|
||||
sprint.set_maxstamina(pname, 20)
|
||||
sprint.increase_maxstamina(pname, 10)
|
||||
minetest.log("action", "[PClasses] Player " .. pname .. " becomes a warrior")
|
||||
end,
|
||||
on_unassigned = function(pname)
|
||||
sprint.set_default_maxstamina(pname)
|
||||
sprint.decrease_maxstamina(pname, 10)
|
||||
end,
|
||||
on_update = function(pname)
|
||||
-- No specific armor changes, no code
|
||||
end,
|
||||
switch_params = {
|
||||
color = {r = 06, g = 06, b = 30},
|
||||
|
|
|
@ -14,10 +14,15 @@ pclasses.api.register_class("wizard", {
|
|||
end
|
||||
-- Add specs here
|
||||
mana.setmax(pname, mana.getmax(pname)+100)
|
||||
sprint.increase_maxstamina(pname, 10)
|
||||
minetest.log("action", "[PClasses] Player " .. pname .. " becomes a wizard")
|
||||
end,
|
||||
on_unassigned = function(pname)
|
||||
mana.setmax(pname, mana.getmax(pname)-100)
|
||||
sprint.decrease_maxstamina(pname, 10)
|
||||
end,
|
||||
on_update = function(pname)
|
||||
-- No armor, no update needed
|
||||
end,
|
||||
switch_params = {
|
||||
color = {r = 230, g = 230, b = 0},
|
||||
|
|
|
@ -42,6 +42,7 @@ Yet another class mod for Minetest.
|
|||
- Def is a definition table that can contain many functions/values :
|
||||
- `on_assigned` which is a function, receiving as argument the player name
|
||||
- `on_unassigned` which is a function, receiving as argument the player name
|
||||
- `on_update` which is a function, receiving as argument the player name
|
||||
- `switch_params`, which is a table, containing parameters for the switch pedestal :
|
||||
- `holo_item` is mandatory. It's the itemstring of the item to be put over the pedestal
|
||||
- `color` is optional. Default is white. It's a RGB table.
|
||||
|
@ -78,6 +79,10 @@ Yet another class mod for Minetest.
|
|||
- Arguments : pname, itemname
|
||||
- Returns true if player `pname` can have items `itemstring` in his main inventory, according to his class
|
||||
|
||||
### pclasses.api.util.on_update
|
||||
- Arguments : pname
|
||||
- Update player's stats
|
||||
|
||||
### pclasses.api.reserve_item
|
||||
- Arguments : cname, itemstring
|
||||
- Adds an entry in the reserved items' table. Players will need to belong to class `cname` in order to have items `itemstring` in their main inventory
|
||||
|
|
|
@ -15,6 +15,8 @@ pclasses.api.register_class("adventurer", {
|
|||
end,
|
||||
on_unassigned = function(pname)
|
||||
end,
|
||||
on_update = function(pname)
|
||||
end,
|
||||
informations = pclasses.api.textify("Adventurer, the casual players, or hardcore players. Whatever end of the spectrum\n" ..
|
||||
"you're in, adventurer will bring you what you want : no advantages, no help. Maybe you\n" ..
|
||||
"don't want that if you just began playing. If that's the case.. just pick another tab and\n" ..
|
||||
|
|
|
@ -55,10 +55,18 @@ end
|
|||
function pclasses.api.set_player_class(pname, cname, inform)
|
||||
if pclasses.api.get_class_by_name(cname) then
|
||||
if pclasses.api.get_player_class(pname) then
|
||||
pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_unassigned(pname)
|
||||
pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_update(pname)
|
||||
pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_unassigned(pname)
|
||||
end
|
||||
pclasses.data.players[pname] = cname
|
||||
pclasses.api.get_class_by_name(cname).on_assigned(pname, inform)
|
||||
local newclass = pclasses.api.get_class_by_name(cname)
|
||||
newclass.on_assigned(pname, inform)
|
||||
-- Implicit call to on_update because we don't wanna repeat it
|
||||
if newclass.on_update then
|
||||
newclass.on_update(pname)
|
||||
else
|
||||
newclass.on_update = function(pname) end -- So that it won't annoy us later
|
||||
end
|
||||
|
||||
local ref = minetest.get_player_by_name(pname)
|
||||
local armor_inv = minetest.get_inventory({type = "detached", name = pname .. "_armor"})
|
||||
|
@ -100,6 +108,13 @@ function pclasses.api.util.can_have_item(pname, itemname)
|
|||
return false
|
||||
end
|
||||
|
||||
function pclasses.api.util.on_update(pname)
|
||||
local cname = pclasses.api.get_player_class(pname)
|
||||
if cname ~= nil and pclasses.api.get_class_by_name(cname) and pclasses.api.get_class_by_name(cname).on_update then
|
||||
pclasses.api.get_class_by_name(cname).on_update(pname)
|
||||
end
|
||||
end
|
||||
|
||||
-- TEMPORARY CLASS SHIFT SYSTEM
|
||||
-- Used to test on local servers
|
||||
--
|
||||
|
|
|
@ -61,21 +61,34 @@ minetest.register_node("runes:black_magic_block", {
|
|||
})
|
||||
|
||||
-- Globalstep checking for the amulets
|
||||
minetest.register_globalstep(function(dtime)
|
||||
tmpdata = {}
|
||||
loop = function()
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local inv = player:get_inventory()
|
||||
local basemana = mana.settings.default_max
|
||||
local pname = player:get_player_name()
|
||||
local basemana = mana.getmax(pname) - (tmpdata[pname] or 0) -- Baseline mana, without any amulets
|
||||
local addons = 0
|
||||
for index, item in pairs(inv:get_list("main")) do
|
||||
local itemname = item:get_name()
|
||||
local itemcount = item:get_count()
|
||||
for name, manadiff in pairs(runes.datas.amulets) do
|
||||
if itemname == "runes:" .. name .. "_amulet" then
|
||||
basemana = basemana + (manadiff * itemcount)
|
||||
addons = addons + (manadiff * itemcount)
|
||||
--print("Detected " .. name)
|
||||
end
|
||||
end
|
||||
end
|
||||
if basemana ~= mana.settings.default_max then
|
||||
mana.setmax(player:get_player_name(), basemana)
|
||||
end
|
||||
mana.setmax(pname, basemana + addons)
|
||||
tmpdata[pname] = addons
|
||||
end
|
||||
minetest.after(1, loop)
|
||||
end
|
||||
|
||||
minetest.after(0, loop)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local pname = player:get_player_name()
|
||||
mana.setmax(pname, mana.getmax(pname) - tmpdata[pname]) -- Reset
|
||||
tmpdata[pname] = nil
|
||||
mana.save_to_file(pname) -- Double class since we aren't sure mana hasn't already saved (it probably did)
|
||||
end)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
default
|
||||
mobs
|
||||
maptools
|
||||
farming?
|
||||
treasurer?
|
||||
watershed?
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
pyramids = {}
|
||||
pyramids.max_time = 30*60
|
||||
|
||||
dofile(minetest.get_modpath("tsm_pyramids").."/mummy.lua")
|
||||
dofile(minetest.get_modpath("tsm_pyramids").."/nodes.lua")
|
||||
|
@ -16,37 +17,34 @@ local chest_stuff = {
|
|||
}
|
||||
|
||||
function pyramids.fill_chest(pos)
|
||||
minetest.after(2, function()
|
||||
local n = minetest.get_node(pos)
|
||||
if n and n.name and n.name == "maptools:chest" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_list("main",
|
||||
{
|
||||
[1] = "",
|
||||
[32] = ""
|
||||
}
|
||||
)
|
||||
if math.random(1,10) < 7 then return end
|
||||
local stacks = {}
|
||||
if minetest.get_modpath("treasurer") ~= nil then
|
||||
stacks = treasurer.select_random_treasures()
|
||||
else
|
||||
for i=0,2,1 do
|
||||
local stuff = chest_stuff[math.random(1,#chest_stuff)]
|
||||
if stuff.name == "farming:bread" and not minetest.get_modpath("farming") then stuff = chest_stuff[1] end
|
||||
table.insert(stacks, {name=stuff.name, count = math.random(1,stuff.max)})
|
||||
end
|
||||
local n = minetest.get_node_or_nil(pos)
|
||||
if n and n.name and n.name == "tsm_pyramids:chest" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_list("main",
|
||||
{
|
||||
[1] = "",
|
||||
[32] = ""
|
||||
}
|
||||
)
|
||||
if math.random(1,10) < 7 then return end
|
||||
local stacks = {}
|
||||
if minetest.get_modpath("treasurer") ~= nil then
|
||||
stacks = treasurer.select_random_treasures()
|
||||
else
|
||||
for i=0,2,1 do
|
||||
local stuff = chest_stuff[math.random(1,#chest_stuff)]
|
||||
if stuff.name == "farming:bread" and not minetest.get_modpath("farming") then stuff = chest_stuff[1] end
|
||||
table.insert(stacks, {name=stuff.name, count = math.random(1,stuff.max)})
|
||||
end
|
||||
for s=1,#stacks do
|
||||
if not inv:contains_item("main", stacks[s]) then
|
||||
inv:set_stack("main", math.random(1,32), stacks[s])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
for s=1,#stacks do
|
||||
if not inv:contains_item("main", stacks[s]) then
|
||||
inv:set_stack("main", math.random(1,32), stacks[s])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function add_spawner(pos)
|
||||
|
@ -73,45 +71,45 @@ local function underground(pos)
|
|||
while can_replace(p2)==true do
|
||||
cnt = cnt+1
|
||||
if cnt > 25 then break end
|
||||
if cnt>math.random(2,4) then mat = "desert_stone"end
|
||||
if cnt>math.random(2,4) then mat = "desert_stone" end
|
||||
minetest.set_node(p2, {name="default:"..mat})
|
||||
p2.y = p2.y-1
|
||||
end
|
||||
end
|
||||
|
||||
local function make_entrance(pos)
|
||||
local gang = {x=pos.x+10,y=pos.y, z=pos.z}
|
||||
for iy=2,3,1 do
|
||||
for iz=0,6,1 do
|
||||
minetest.remove_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz})
|
||||
if iz >=3 and iy == 3 then
|
||||
minetest.set_node({x=gang.x,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
minetest.set_node({x=gang.x+1,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
minetest.set_node({x=gang.x+2,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
local gang = {x=pos.x+10,y=pos.y, z=pos.z}
|
||||
for iy=2,3,1 do
|
||||
for iz=0,6,1 do
|
||||
minetest.remove_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz})
|
||||
if iz >=3 and iy == 3 then
|
||||
minetest.set_node({x=gang.x,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
minetest.set_node({x=gang.x+1,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
minetest.set_node({x=gang.x+2,y=gang.y+iy+1,z=gang.z+iz}, {name="maptools:sandstone_brick"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function make(pos)
|
||||
minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")")
|
||||
for iy=0,10,1 do
|
||||
for ix=iy,22-iy,1 do
|
||||
for iz=iy,22-iy,1 do
|
||||
if iy <1 then underground({x=pos.x+ix,y=pos.y,z=pos.z+iz}) end
|
||||
minetest.set_node({x=pos.x+ix,y=pos.y+iy,z=pos.z+iz}, {name="maptools:sandstone_brick"})
|
||||
for yy=1,10-iy,1 do
|
||||
local n = minetest.get_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz})
|
||||
if n and n.name and n.name == "default:desert_stone" then minetest.set_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz},{name="default:desert_sand"}) end
|
||||
end
|
||||
function pyramids.make(pos)
|
||||
minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")")
|
||||
for iy=0,10,1 do
|
||||
for ix=iy,22-iy,1 do
|
||||
for iz=iy,22-iy,1 do
|
||||
if iy <1 then underground({x=pos.x+ix,y=pos.y,z=pos.z+iz}) end
|
||||
minetest.set_node({x=pos.x+ix,y=pos.y+iy,z=pos.z+iz}, {name="maptools:sandstone_brick"})
|
||||
for yy=1,10-iy,1 do
|
||||
local n = minetest.get_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz})
|
||||
if n and n.name and n.name == "default:desert_stone" then minetest.set_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz},{name="default:desert_sand"}) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pyramids.make_room(pos)
|
||||
minetest.after(2, pyramids.make_traps, pos)
|
||||
add_spawner({x=pos.x+11,y=pos.y+2, z=pos.z+17})
|
||||
make_entrance({x=pos.x,y=pos.y, z=pos.z})
|
||||
pyramids.make_room(pos)
|
||||
minetest.after(2, pyramids.make_traps, pos)
|
||||
add_spawner({x=pos.x+11,y=pos.y+2, z=pos.z+17})
|
||||
make_entrance({x=pos.x,y=pos.y, z=pos.z})
|
||||
end
|
||||
|
||||
local perl1 = {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise.
|
||||
|
@ -124,6 +122,7 @@ local function hlp_fnct(pos, name)
|
|||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local function ground(pos, old)
|
||||
local p2 = pos
|
||||
while hlp_fnct(p2, "air") do
|
||||
|
@ -140,48 +139,49 @@ end
|
|||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
minetest.after(3, function(minp, maxp, seed)
|
||||
|
||||
if maxp.y < 0 then return end
|
||||
math.randomseed(seed)
|
||||
local cnt = 0
|
||||
if maxp.y < 0 then return end
|
||||
math.randomseed(seed)
|
||||
local cnt = 0
|
||||
|
||||
local perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
|
||||
local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z})
|
||||
local perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
|
||||
local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z})
|
||||
|
||||
if noise1 > 0.25 or noise1 < -0.26 and math.random(1,100) % 2 == 0 then -- Coward attempt to divide per 2 the spawn rate
|
||||
local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||
if noise1 > 0.25 or noise1 < -0.26 and math.random(1,100) % 2 == 0 then -- Coward attempt to divide per 2 the spawn rate
|
||||
local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||
|
||||
local p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
|
||||
while p2 == nil and cnt < 5 do
|
||||
cnt = cnt+1
|
||||
mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||
p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
|
||||
local p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
|
||||
while p2 == nil and cnt < 5 do
|
||||
cnt = cnt+1
|
||||
mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||
p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
|
||||
end
|
||||
if p2 == nil then return end
|
||||
if p2.y < 0 then return end
|
||||
|
||||
local off = 0
|
||||
local opos1 = {x=p2.x+22,y=p2.y-1,z=p2.z+22}
|
||||
local opos2 = {x=p2.x+22,y=p2.y-1,z=p2.z}
|
||||
local opos3 = {x=p2.x,y=p2.y-1,z=p2.z+22}
|
||||
local opos1_n = minetest.get_node_or_nil(opos1)
|
||||
local opos2_n = minetest.get_node_or_nil(opos2)
|
||||
local opos3_n = minetest.get_node_or_nil(opos3)
|
||||
if opos1_n and opos1_n.name and opos1_n.name == "air" then
|
||||
p2 = ground(opos1, p2)
|
||||
end
|
||||
if opos2_n and opos2_n.name and opos2_n.name == "air" then
|
||||
p2 = ground(opos2, p2)
|
||||
end
|
||||
if opos3_n and opos3_n.name and opos3_n.name == "air" then
|
||||
p2 = ground(opos3, p2)
|
||||
end
|
||||
p2.y = p2.y - 3
|
||||
if p2.y < 0 then p2.y = 0 end
|
||||
if minetest.find_node_near(p2, 25, {"default:water_source"}) ~= nil
|
||||
or minetest.find_node_near(p2, 22, {"default:dirt_with_grass"}) ~= nil
|
||||
or minetest.find_node_near(p2, 52, {"maptools:sandstone_brick"}) ~= nil then return end
|
||||
|
||||
if math.random(0,10) > 7 then return end
|
||||
pyramids.make(p2)
|
||||
end
|
||||
if p2 == nil then return end
|
||||
if p2.y < 0 then return end
|
||||
|
||||
local off = 0
|
||||
local opos1 = {x=p2.x+22,y=p2.y-1,z=p2.z+22}
|
||||
local opos2 = {x=p2.x+22,y=p2.y-1,z=p2.z}
|
||||
local opos3 = {x=p2.x,y=p2.y-1,z=p2.z+22}
|
||||
local opos1_n = minetest.get_node_or_nil(opos1)
|
||||
local opos2_n = minetest.get_node_or_nil(opos2)
|
||||
local opos3_n = minetest.get_node_or_nil(opos3)
|
||||
if opos1_n and opos1_n.name and opos1_n.name == "air" then
|
||||
p2 = ground(opos1, p2)
|
||||
end
|
||||
if opos2_n and opos2_n.name and opos2_n.name == "air" then
|
||||
p2 = ground(opos2, p2)
|
||||
end
|
||||
if opos3_n and opos3_n.name and opos3_n.name == "air" then
|
||||
p2 = ground(opos3, p2)
|
||||
end
|
||||
p2.y = p2.y - 3
|
||||
if p2.y < 0 then p2.y = 0 end
|
||||
if minetest.find_node_near(p2, 25, {"default:water_source"}) ~= nil or minetest.find_node_near(p2, 22, {"default:dirt_with_grass"}) ~= nil or minetest.find_node_near(p2, 52, {"maptools:sandstone_brick"}) ~= nil then return end
|
||||
|
||||
if math.random(0,10) > 7 then return end
|
||||
make(p2)
|
||||
end
|
||||
|
||||
end, minp, maxp, seed)
|
||||
end)
|
||||
|
|
|
@ -52,10 +52,31 @@ mobs:register_mob("tsm_pyramids:mummy", {
|
|||
sit_start = 81, sit_end = 160,
|
||||
lay_start = 162, lay_end = 166,
|
||||
mine_start = 74, mine_end = 105,
|
||||
walk_mine_start = 74, walk_mine_end = 105,
|
||||
walk_mine_start = 74, walk_mine_end = 105,
|
||||
},
|
||||
})
|
||||
|
||||
--MFF ABM to replace old maptools:chest
|
||||
minetest.register_abm({
|
||||
nodenames = {"tsm_pyramids:spawner_mummy"},
|
||||
interval = 10.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local chests = minetest.find_nodes_in_area(
|
||||
{x=pos.x-4, y=pos.y-3, z=pos.z-10},
|
||||
{x=pos.x+4, y=pos.y, z=pos.z},
|
||||
"maptools:chest"
|
||||
)
|
||||
for _, cpos in ipairs(chests) do
|
||||
local p2 = 0
|
||||
local n = minetest.get_node_or_nil(cpos)
|
||||
if n and n.param2 then
|
||||
p2 = n.param2
|
||||
end
|
||||
minetest.set_node(cpos, {name="tsm_pyramids:chest", param2=p2})
|
||||
end
|
||||
end
|
||||
})
|
||||
-- spawner (spawn in pyramids, near the spawner)
|
||||
if not minetest.setting_getbool("only_peaceful_mobs") then
|
||||
minetest.register_abm({
|
||||
|
@ -101,10 +122,10 @@ minetest.register_node("tsm_pyramids:spawner_mummy", {
|
|||
drop = "",
|
||||
on_construct = function(pos)
|
||||
pos.y = pos.y - 0.28
|
||||
minetest.env:add_entity(pos,"tsm_pyramids:mummy_spawner")
|
||||
minetest.add_entity(pos,"tsm_pyramids:mummy_spawner")
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
for _,obj in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
|
||||
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||
if not obj:is_player() then
|
||||
if obj ~= nil and obj:get_luaentity().m_name == "dummy" then
|
||||
obj:remove()
|
||||
|
@ -122,7 +143,7 @@ minetest.register_craftitem("tsm_pyramids:spawn_egg", {
|
|||
stack_max = 99,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
minetest.env:add_entity(pointed_thing.above,"tsm_pyramids:mummy")
|
||||
minetest.add_entity(pointed_thing.above,"tsm_pyramids:mummy")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
return itemstack
|
||||
end
|
||||
|
|
|
@ -4,14 +4,14 @@ for i=1,3 do
|
|||
minetest.register_node("tsm_pyramids:deco_stone"..i, {
|
||||
description = "Sandstone with "..img[i],
|
||||
tiles = {"default_sandstone.png^tsm_pyramids_"..img[i]..".png"},
|
||||
is_ground_content = true,
|
||||
is_ground_content = false,
|
||||
groups = {unbreakable=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
trap_on_timer = function (pos, elapsed)
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 2)
|
||||
local trap_on_timer = function (pos, elapsed)
|
||||
local objs = minetest.get_objects_inside_radius(pos, 2)
|
||||
for i, obj in pairs(objs) do
|
||||
if obj:is_player() then
|
||||
local n = minetest.get_node(pos)
|
||||
|
@ -27,11 +27,11 @@ end
|
|||
minetest.register_node("tsm_pyramids:trap", {
|
||||
description = "Cracked sandstone brick",
|
||||
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack.png"},
|
||||
is_ground_content = true,
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=2,cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
minetest.env:get_node_timer(pos):start(0.1)
|
||||
minetest.get_node_timer(pos):start(0.1)
|
||||
end,
|
||||
crack = 1,
|
||||
on_timer = trap_on_timer,
|
||||
|
@ -41,8 +41,31 @@ minetest.register_node("tsm_pyramids:trap", {
|
|||
minetest.register_node("tsm_pyramids:trap_2", {
|
||||
description = "trapstone",
|
||||
tiles = {"default_sandstone_brick.png^tsm_pyramids_crack.png^[transformR90"},
|
||||
is_ground_content = true,
|
||||
is_ground_content = false,
|
||||
groups = {crumbly=2,cracky=3,falling_node=1,not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "",
|
||||
})
|
||||
|
||||
local chestdef = minetest.registered_nodes["default:chest"]
|
||||
minetest.register_node("tsm_pyramids:chest",{
|
||||
description = "tsm_pyramids Chest auto refilled",
|
||||
tiles = chestdef.tiles,
|
||||
stack_max = 1000,
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
on_construct = function(pos)
|
||||
chestdef.on_construct(pos)
|
||||
minetest.get_node_timer(pos):start(pyramids.max_time)
|
||||
pyramids.fill_chest(pos)
|
||||
end,
|
||||
on_metadata_inventory_move = chestdef.on_metadata_inventory_move,
|
||||
on_metadata_inventory_put = chestdef.on_metadata_inventory_put,
|
||||
on_metadata_inventory_take = chestdef.on_metadata_inventory_take,
|
||||
groups = {unbreakable = 1, not_in_creative_inventory = 1},
|
||||
on_timer = function (pos, elapsed)
|
||||
pyramids.fill_chest(pos)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
pyramids.saved_chests = {}
|
||||
pyramids.max_time = 30*60
|
||||
|
||||
|
||||
local room = {"a","a","a","a","a","a","a","a","a",
|
||||
"a","c","a","c","a","c","a","c","a",
|
||||
|
@ -33,56 +30,14 @@ code["a"] = "air"
|
|||
code["l"] = "lava_source"
|
||||
code["t"] = "trap"
|
||||
|
||||
function loadchests()
|
||||
local file = io.open(minetest.get_worldpath().."/pyramids_chests.txt","r")
|
||||
if file then
|
||||
local saved_chests = minetest.deserialize(file:read())
|
||||
io.close(file)
|
||||
if saved_chests and type(saved_chests) == "table" then
|
||||
minetest.log("action","[tsm_pyramids] Chest loaded")
|
||||
return saved_chests
|
||||
else
|
||||
minetest.log("error","[tsm_pyramids] Loading Chest failed")
|
||||
end
|
||||
end
|
||||
return {}
|
||||
end
|
||||
|
||||
|
||||
function savechests()
|
||||
local file = io.open(minetest.get_worldpath().."/pyramids_chests.txt","w")
|
||||
if not file then return end -- should not happen
|
||||
file:write(minetest.serialize(pyramids.saved_chests))
|
||||
io.close(file)
|
||||
minetest.log("action","[tsm_pyramids] Chests saved")
|
||||
end
|
||||
|
||||
pyramids.saved_chests = loadchests()
|
||||
minetest.register_on_shutdown(function()
|
||||
savechests()
|
||||
end)
|
||||
|
||||
local function chests_reload()
|
||||
-- It might happen that chests are not loaded
|
||||
if pyramids.saved_chests then
|
||||
for _,k in ipairs(pyramids.saved_chests) do
|
||||
pyramids.fill_chest(k)
|
||||
end
|
||||
else
|
||||
pyramids.saved_chests = loadchests() or {}
|
||||
end
|
||||
minetest.log("action","[tsm_pyramids] Chests reloaded")
|
||||
minetest.after(pyramids.max_time, chests_reload)
|
||||
end
|
||||
minetest.after(0, chests_reload)
|
||||
|
||||
local function replace(str,iy)
|
||||
local out = "default:"
|
||||
if iy < 4 and str == "c" then str = "a" end
|
||||
if iy == 0 and str == "s" then out = "tsm_pyramids:" str = "sun" end
|
||||
if iy == 3 and str == "s" then out = "tsm_pyramids:" str = "men" end
|
||||
if str == "a" then out = "" end
|
||||
if str == "c" or str == "s" or str == "b" then out = "maptools:" end
|
||||
if str == "c" then out = "tsm_pyramids:" end --MFF newchest
|
||||
if str == "s" or str == "b" then out = "maptools:" end
|
||||
return out..code[str]
|
||||
end
|
||||
|
||||
|
@ -96,35 +51,30 @@ local function replace2(str,iy)
|
|||
end
|
||||
|
||||
function pyramids.make_room(pos)
|
||||
local loch = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
|
||||
for iy=0,4,1 do
|
||||
for ix=0,8,1 do
|
||||
for iz=0,8,1 do
|
||||
local n_str = room[tonumber(ix*9+iz+1)]
|
||||
local p2 = 0
|
||||
if n_str == "c" then
|
||||
if ix < 3 then p2 = 1 else p2 = 3 end
|
||||
pyramids.fill_chest({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz})
|
||||
end
|
||||
local node_name = replace(n_str,iy)
|
||||
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=node_name, param2=p2})
|
||||
if node_name == "maptools:chest" then
|
||||
table.insert(pyramids.saved_chests,1,{x=loch.x+ix,y=loch.y-iy,z=loch.z+iz})
|
||||
local loch = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
|
||||
for iy=0,4,1 do
|
||||
for ix=0,8,1 do
|
||||
for iz=0,8,1 do
|
||||
local n_str = room[tonumber(ix*9+iz+1)]
|
||||
local p2 = 0
|
||||
if n_str == "c" then
|
||||
if ix < 3 then p2 = 1 else p2 = 3 end
|
||||
end
|
||||
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace(n_str,iy), param2=p2})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pyramids.make_traps(pos)
|
||||
local loch = {x=pos.x+7,y=pos.y, z=pos.z+7}
|
||||
for iy=0,4,1 do
|
||||
for ix=0,8,1 do
|
||||
for iz=0,8,1 do
|
||||
local n_str = trap[tonumber(ix*9+iz+1)]
|
||||
local p2 = 0
|
||||
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace2(n_str,iy), param2=p2})
|
||||
local loch = {x=pos.x+7,y=pos.y, z=pos.z+7}
|
||||
for iy=0,4,1 do
|
||||
for ix=0,8,1 do
|
||||
for iz=0,8,1 do
|
||||
local n_str = trap[tonumber(ix*9+iz+1)]
|
||||
local p2 = 0
|
||||
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace2(n_str,iy), param2=p2})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -264,3 +264,6 @@ load_mod_moreplants = true
|
|||
load_mod_nalc = true
|
||||
|
||||
load_mod_cotton = true
|
||||
|
||||
load_mod_camera = true
|
||||
load_mod_claycrafter = true
|
||||
|
|
Loading…
Reference in New Issue
Block a user