Remplissage du dépôt.
72
dagger.lua
Executable file
@ -0,0 +1,72 @@
|
||||
-- Based on compass mod by Echo
|
||||
|
||||
local function tick()
|
||||
minetest.after(1, tick)
|
||||
local players = minetest.get_connected_players()
|
||||
for i,player in ipairs(players) do
|
||||
local target = lavatemple.mapgen_data.pos;
|
||||
if not target then return end
|
||||
local pos = player:getpos()
|
||||
local dir = player:get_look_yaw()
|
||||
local angle_north = math.deg(math.atan2(target.x - pos.x, target.z - pos.z))
|
||||
if angle_north < 0 then angle_north = angle_north + 360 end
|
||||
local angle_dir = 90 - math.deg(dir)
|
||||
local angle_relative = (angle_north - angle_dir) % 360
|
||||
local compass_image = math.floor((angle_relative/30) + 0.5)%12
|
||||
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if string.sub(wielded_item, 0, 18) == "lavatemple:dagger_" then
|
||||
player:set_wielded_item("lavatemple:dagger_"..compass_image)
|
||||
else
|
||||
if player:get_inventory() then
|
||||
for i,stack in ipairs(player:get_inventory():get_list("main")) do
|
||||
if string.sub(stack:get_name(), 0, 18) == "lavatemple:dagger_" and
|
||||
stack:get_name() ~= "lavatemple:dagger_"..compass_image then
|
||||
player:get_inventory():set_stack("main", i, ItemStack("lavatemple:dagger_"..compass_image))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
tick()
|
||||
|
||||
local images = {
|
||||
"lavatemple_dagger_0.png",
|
||||
"lavatemple_dagger_1.png",
|
||||
"lavatemple_dagger_2.png",
|
||||
"lavatemple_dagger_3.png",
|
||||
"lavatemple_dagger_4.png",
|
||||
"lavatemple_dagger_5.png",
|
||||
"lavatemple_dagger_6.png",
|
||||
"lavatemple_dagger_5.png",
|
||||
"lavatemple_dagger_4.png",
|
||||
"lavatemple_dagger_3.png",
|
||||
"lavatemple_dagger_2.png",
|
||||
"lavatemple_dagger_1.png",
|
||||
}
|
||||
|
||||
local i
|
||||
for i,img in ipairs(images) do
|
||||
local inv = 1
|
||||
if i == 1 then
|
||||
inv = 0
|
||||
end
|
||||
minetest.register_tool("lavatemple:dagger_"..(i-1), {
|
||||
description = "Lava dagger",
|
||||
inventory_image = img,
|
||||
wield_image = img,
|
||||
groups = {not_in_creative_inventory=inv},
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'lavatemple:dagger_1',
|
||||
recipe = {
|
||||
{'zmobs:lava_orb', 'default:steel_ingot', 'zmobs:lava_orb'},
|
||||
{'zmobs:lava_orb', 'default:steel_ingot', 'zmobs:lava_orb'},
|
||||
{'zmobs:lava_orb', 'default:stick', 'zmobs:lava_orb'}
|
||||
}
|
||||
})
|
||||
|
5
depends.txt
Executable file
@ -0,0 +1,5 @@
|
||||
default
|
||||
stairs
|
||||
mobs
|
||||
worldedit
|
||||
watershed?
|
7
init.lua
Executable file
@ -0,0 +1,7 @@
|
||||
lavatemple = {}
|
||||
local MODPATH = minetest.get_modpath("lavatemple")
|
||||
dofile(MODPATH.."/nodes.lua")
|
||||
dofile(MODPATH.."/items.lua")
|
||||
dofile(MODPATH.."/mapgen.lua")
|
||||
dofile(MODPATH.."/dagger.lua")
|
||||
|
31
items.lua
Executable file
@ -0,0 +1,31 @@
|
||||
|
||||
minetest.register_tool("lavatemple:darkpick", {
|
||||
description = "Dark Pickaxe",
|
||||
inventory_image = "lavatemple_tool_darkpick.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
dark = {times={[1]=0.25}, uses=0, maxlevel=1},
|
||||
},
|
||||
damage_groups = {},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("lavatemple:teleport_orb", {
|
||||
description = "Teleport'orb (does nothing yet)",
|
||||
inventory_image = "lavatemple_teleport_orb.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- MODIFICATION MADE FOR MFF
|
||||
minetest.register_craft({
|
||||
output = "lavatemple:ladder 4",
|
||||
recipe = {
|
||||
{"default:obsidianbrick", "dye:red", "default:obsidianbrick"},
|
||||
{"default:obsidianbrick", "default:obsidianbrick", "default:obsidianbrick"},
|
||||
{"default:obsidianbrick", "", "default:obsidianbrick"}
|
||||
}
|
||||
})
|
57
mapgen.lua
Executable file
@ -0,0 +1,57 @@
|
||||
lavatemple.mapgen_data = {}
|
||||
lavatemple.file = minetest.get_worldpath()..'/lavatemple.mt'
|
||||
|
||||
-- try to load the data from file
|
||||
local f = io.open(lavatemple.file, "r")
|
||||
if f then
|
||||
local contents = f:read()
|
||||
io.close(f)
|
||||
if contents ~= nil then
|
||||
lavatemple.mapgen_data = minetest.deserialize(contents)
|
||||
end
|
||||
end
|
||||
|
||||
-- generate position of the temple (if not done already)
|
||||
if type (lavatemple.mapgen_data) ~= "table" or
|
||||
lavatemple.mapgen_data.pos == nil or
|
||||
lavatemple.mapgen_data.pos.x == nil or
|
||||
lavatemple.mapgen_data.pos.y == nil or
|
||||
lavatemple.mapgen_data.pos.z == nil then
|
||||
|
||||
-- generate the temple position
|
||||
math.randomseed(os.time())
|
||||
lavatemple.mapgen_data.pos = {
|
||||
x=math.random(-2000,2000),
|
||||
y=math.random(-500,-50),
|
||||
z=math.random(-2000,2000)
|
||||
}
|
||||
|
||||
-- save data
|
||||
local f = io.open(lavatemple.file, "w")
|
||||
f:write(minetest.serialize(lavatemple.mapgen_data))
|
||||
io.close(f)
|
||||
end
|
||||
|
||||
minetest.register_on_generated(function(minp,maxp,seed)
|
||||
local ltp = lavatemple.mapgen_data.pos
|
||||
if ltp.x > minp.x and ltp.x < maxp.x and
|
||||
ltp.y > minp.y and ltp.y < maxp.y and
|
||||
ltp.z > minp.z and ltp.z < maxp.z then
|
||||
local f = io.open(minetest.get_modpath("lavatemple").."/schems/lavatemple.we", "r")
|
||||
if not f then return end
|
||||
local contents = f:read()
|
||||
io.close(f)
|
||||
if not contents then return end
|
||||
-- Clear the area since worldedit doesn't save "air" nodes
|
||||
pos1, pos2, count = worldedit.allocate(ltp, contents)
|
||||
for x=pos1.x,pos2.x do
|
||||
for y=pos1.y,pos2.y do
|
||||
for z=pos1.z,pos2.z do
|
||||
minetest.remove_node({x=x,y=y,z=z})
|
||||
end end end
|
||||
-- Deserialize the temple
|
||||
--worldedit.deserialize(ltp, contents, minetest|.env)
|
||||
worldedit.deserialize(ltp, contents, minetest)
|
||||
end
|
||||
end)
|
||||
|
49
nodes.lua
Executable file
@ -0,0 +1,49 @@
|
||||
|
||||
minetest.register_node("lavatemple:brick", {
|
||||
description = "Darkbrick",
|
||||
tiles = {"lavatemple_brick.png"},
|
||||
groups = {dark=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
stairs.register_stair_and_slab(
|
||||
"lavatemple_brick",
|
||||
"lavatemple:brick",
|
||||
{dark=1},
|
||||
{"lavatemple_brick.png"},
|
||||
"Darkbrick Stair",
|
||||
"Darkbrick Slab",
|
||||
default.node_sound_stone_defaults()
|
||||
)
|
||||
|
||||
minetest.register_node("lavatemple:ladder", {
|
||||
description = "Darkbrick Ladder",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"lavatemple_ladder.png"},
|
||||
inventory_image = "lavatemple_ladder_inv.png",
|
||||
wield_image = "lavatemple_ladder_inv.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
climbable = true,
|
||||
walkable = true,
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
wall_top = {-0.375, 0.4375, -0.5, 0.375, 0.5, 0.5},
|
||||
wall_bottom = {-0.375, -0.5, -0.5, 0.375, -0.4375, 0.5},
|
||||
wall_side = {-0.5, -0.5, -0.375, -0.4375, 0.5, 0.375},
|
||||
},
|
||||
selection_box = {type = "wallmounted"},
|
||||
legacy_wallmounted = true,
|
||||
groups = {dark=1, cracky = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("lavatemple:fence_brick", {
|
||||
description = "Darkbrick fence",
|
||||
drawtype = "fencelike",
|
||||
paramtype = "light",
|
||||
tiles = {"lavatemple_brick.png"},
|
||||
groups = {dark=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
1
schems/lavatemple.we
Executable file
BIN
sounds/default_dig_dark.ogg
Executable file
BIN
textures/lavatemple_brick.png
Executable file
After Width: | Height: | Size: 239 B |
BIN
textures/lavatemple_dagger_0.png
Executable file
After Width: | Height: | Size: 365 B |
BIN
textures/lavatemple_dagger_1.png
Executable file
After Width: | Height: | Size: 365 B |
BIN
textures/lavatemple_dagger_2.png
Executable file
After Width: | Height: | Size: 365 B |
BIN
textures/lavatemple_dagger_3.png
Executable file
After Width: | Height: | Size: 365 B |
BIN
textures/lavatemple_dagger_4.png
Executable file
After Width: | Height: | Size: 365 B |
BIN
textures/lavatemple_dagger_5.png
Executable file
After Width: | Height: | Size: 361 B |
BIN
textures/lavatemple_dagger_6.png
Executable file
After Width: | Height: | Size: 156 B |
BIN
textures/lavatemple_ladder.png
Executable file
After Width: | Height: | Size: 429 B |
BIN
textures/lavatemple_ladder_inv.png
Executable file
After Width: | Height: | Size: 372 B |
BIN
textures/lavatemple_teleport_orb.png
Executable file
After Width: | Height: | Size: 524 B |
BIN
textures/lavatemple_tool_darkpick.png
Executable file
After Width: | Height: | Size: 204 B |