Compare commits
34 Commits
master
...
beacons_si
Author | SHA1 | Date |
---|---|---|
cora | c6185338eb | |
cora | 6b746ec6a5 | |
cora | bcfd664e9b | |
cora | 2f868afedb | |
cora | 3723870c11 | |
cora | 8e95ba85a0 | |
cora | c56e84489d | |
chmodsayshello | 0a0e85ba53 | |
chmodsayshello | 3fae0baa81 | |
chmodsayshello | c1f9685381 | |
chmodsayshello | d61c93c429 | |
chmodsayshello | 335c09b1df | |
chmodsayshello | 066fa1fcbe | |
chmodsayshello | 6bf905ad46 | |
chmodsayshello | b71a8364c8 | |
chmodsayshello | 0868d73c33 | |
chmodsayshello | 4276fabf7a | |
chmodsayshello | ef568323c2 | |
chmodsayshello | cb303353a9 | |
chmodsayshello | ead50562cc | |
chmodsayshello | 0833f3417b | |
chmodsayshello | 99174f0fb4 | |
chmodsayshello | fd65be17a0 | |
chmodsayshello | dd37fe03b0 | |
chmodsayshello | 974b0f2810 | |
chmodsayshello | a8b2e99ec9 | |
chmodsayshello | 870d2ac9e6 | |
chmodsayshello | 5ed495aa41 | |
chmodsayshello | 3e8835cf5f | |
chmodsayshello | 614c4a41e2 | |
chmodsayshello | 6cca4ca805 | |
chmodsayshello | d4324bb1a9 | |
chmodsayshello | 143def257e | |
chmodsayshello | c7225a1715 |
|
@ -266,6 +266,19 @@ awards.register_achievement("mcl:enchanter", {
|
||||||
icon = "mcl_enchanting_book_enchanted.png",
|
icon = "mcl_enchanting_book_enchanted.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--Triggered in mcl_beacons
|
||||||
|
awards.register_achievement("mcl:beacon", {
|
||||||
|
title = S("Bring Home the Beacon"),
|
||||||
|
description = S("Use a beacon."),
|
||||||
|
icon = "beacon_achievement_icon.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
awards.register_achievement("mcl:maxed_beacon", {
|
||||||
|
title = S("Beaconator"),
|
||||||
|
description = S("Use a fully powered beacon."),
|
||||||
|
icon = "beacon_achievement_icon.png",
|
||||||
|
})
|
||||||
|
|
||||||
-- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.)
|
-- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.)
|
||||||
|
|
||||||
if non_pc_achievements then
|
if non_pc_achievements then
|
||||||
|
|
|
@ -47,3 +47,7 @@ Use a crafting table to craft a wooden hoe from wooden planks and sticks.=Benutz
|
||||||
Use a crafting table to craft a wooden pickaxe from wooden planks and sticks.=Benutzen Sie eine Werkbank, um eine Holzspitzhacke aus Holzplanken und Stöcken zu fertigen.
|
Use a crafting table to craft a wooden pickaxe from wooden planks and sticks.=Benutzen Sie eine Werkbank, um eine Holzspitzhacke aus Holzplanken und Stöcken zu fertigen.
|
||||||
Use obsidian and a fire starter to construct a Nether portal.=Benutzen Sie Obsidian und ein Feuerzeug, um ein Netherportal zu errichten.
|
Use obsidian and a fire starter to construct a Nether portal.=Benutzen Sie Obsidian und ein Feuerzeug, um ein Netherportal zu errichten.
|
||||||
Use wheat to craft a bread.=Benutzen Sie Weizen, um ein Brot zu machen.
|
Use wheat to craft a bread.=Benutzen Sie Weizen, um ein Brot zu machen.
|
||||||
|
Bring Home the Beacon=Den Nachbarn heimleuchten
|
||||||
|
Use a beacon.=Benutzen Sie ein Leuchtfeuer.
|
||||||
|
Beaconator=Leuchtturmwärter
|
||||||
|
Use a fully powered beacon.=Benutzen Sie ein vollständiges Leuchtfeuer.
|
||||||
|
|
|
@ -73,3 +73,7 @@ Local Brewery=
|
||||||
Brew a Potion.@nHint: Take a potion or glass bottle out of the brewing stand.=
|
Brew a Potion.@nHint: Take a potion or glass bottle out of the brewing stand.=
|
||||||
Enchanter=
|
Enchanter=
|
||||||
Enchant an item using an Enchantment Table.=
|
Enchant an item using an Enchantment Table.=
|
||||||
|
Bring Home the Beacon=
|
||||||
|
Use a beacon.=
|
||||||
|
Beaconator=
|
||||||
|
Use a fully powered beacon.=
|
||||||
|
|
|
@ -0,0 +1,344 @@
|
||||||
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
mcl_beacons = {
|
||||||
|
blocks ={"mcl_core:diamondblock","mcl_core:ironblock","mcl_core:goldblock","mcl_core:emeraldblock","mcl_nether:netheriteblock"},
|
||||||
|
fuel = {"mcl_core:diamond","mcl_core:emerald","mcl_core:iron_ingot","mcl_core:gold_ingot","mcl_nether:netherite_ingot"}
|
||||||
|
}
|
||||||
|
local beacon_blocklist = mcl_beacons.blocks
|
||||||
|
local beacon_fuellist = mcl_beacons.fuel
|
||||||
|
--[[
|
||||||
|
there are strings in meta, which are being used to see which effect will be given to the player(s)
|
||||||
|
Valid strings:
|
||||||
|
swiftness
|
||||||
|
leaping
|
||||||
|
strenght
|
||||||
|
regeneration
|
||||||
|
]]--
|
||||||
|
local colors = {
|
||||||
|
"white",
|
||||||
|
"silver",
|
||||||
|
"gray",
|
||||||
|
"black",
|
||||||
|
"brown",
|
||||||
|
"red",
|
||||||
|
"orange",
|
||||||
|
"yellow",
|
||||||
|
"lime",
|
||||||
|
"green",
|
||||||
|
"cyan",
|
||||||
|
"light_blue",
|
||||||
|
"blue",
|
||||||
|
"magenta",
|
||||||
|
"purple",
|
||||||
|
"pink",
|
||||||
|
} -- the order of this array determines the index of the palette - do not change it
|
||||||
|
|
||||||
|
local function glass_to_p2(glass_itemstring)
|
||||||
|
if not glass_itemstring or glass_itemstring == "air" then return 0 end
|
||||||
|
local c = glass_itemstring:split(":")[2]:gsub("glass_","")
|
||||||
|
if c then
|
||||||
|
local p2 = table.indexof(colors,c) - 1
|
||||||
|
if p2 == -1 then p2 = 0 end
|
||||||
|
return p2
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("mcl_beacons:beam",{
|
||||||
|
tiles = {"^[colorize:white"},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "mcl_beacons_palette.png",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.1250, -0.5000, -0.1250, 0.1250, 0.5000, 0.1250}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
light_source = 15,
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
floodable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = {not_in_creative_inventory=1},
|
||||||
|
_mcl_blast_resistance = 1200,
|
||||||
|
})
|
||||||
|
mesecon.register_mvps_stopper("mcl_beacons:beam")
|
||||||
|
|
||||||
|
local formspec_string=
|
||||||
|
"size[11,14]"..
|
||||||
|
|
||||||
|
"label[4.5,0.5;"..minetest.formspec_escape(S("Beacon:")).."]"..
|
||||||
|
"label[0.5,1;"..minetest.formspec_escape(S("Primary Power:")).."]"..
|
||||||
|
"label[0.5,8.25;"..minetest.formspec_escape( S("Inventory:")).."]"..
|
||||||
|
|
||||||
|
"image[1,1.5;1,1;custom_beacom_symbol_4.png]"..
|
||||||
|
"image[1,3;1,1;custom_beacom_symbol_3.png]"..
|
||||||
|
"image[1,4.5;1,1;custom_beacom_symbol_2.png]"..
|
||||||
|
"image[1,6;1,1;custom_beacom_symbol_1.png]"..
|
||||||
|
|
||||||
|
"image_button[5.2,1.5;1,1;mcl_potions_effect_swift.png;swiftness;]"..
|
||||||
|
"image_button[5.2,3;1,1;mcl_potions_effect_leaping.png;leaping;]"..
|
||||||
|
"image_button[5.2,4.5;1,1;mcl_potions_effect_strong.png;strenght;]"..
|
||||||
|
"image_button[5.2,6;1,1;mcl_potions_effect_regenerating.png;regeneration;]"..
|
||||||
|
|
||||||
|
"item_image[1,7;1,1;mcl_core:diamond]"..
|
||||||
|
"item_image[2.2,7;1,1;mcl_core:emerald]"..
|
||||||
|
"item_image[3.4,7;1,1;mcl_core:iron_ingot]"..
|
||||||
|
"item_image[4.6,7;1,1;mcl_core:gold_ingot]"..
|
||||||
|
"item_image[5.8,7;1,1;mcl_nether:netherite_ingot]"..
|
||||||
|
|
||||||
|
mcl_formspec.get_itemslot_bg(7.2,7,1,1)..
|
||||||
|
"list[context;input;7.2,7;1,1;]"..
|
||||||
|
mcl_formspec.get_itemslot_bg(1,9,9,3)..
|
||||||
|
"list[current_player;main;1,9;9,3;9]"..
|
||||||
|
mcl_formspec.get_itemslot_bg(1,12.5,9,1)..
|
||||||
|
"list[current_player;main;1,12.5;9,1;]"
|
||||||
|
|
||||||
|
local function beacon_blockcheck(pos)
|
||||||
|
for y_offset = 1,4 do
|
||||||
|
local block_y = pos.y - y_offset
|
||||||
|
for block_x = (pos.x-y_offset),(pos.x+y_offset) do
|
||||||
|
for block_z = (pos.z-y_offset),(pos.z+y_offset) do
|
||||||
|
local valid_block = false --boolean which stores if block is valid or not
|
||||||
|
for _, beacon_block in pairs(beacon_blocklist) do
|
||||||
|
if beacon_block == minetest.get_node({x=block_x,y=block_y,z=block_z}).name and not valid_block then --is the block in the pyramid a valid beacon block
|
||||||
|
valid_block =true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not valid_block then
|
||||||
|
return y_offset -1 --the last layer is complete, this one is missing or incomplete
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if y_offset == 4 then --all checks are done, beacon is maxed
|
||||||
|
return y_offset
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function effect_player(effect,pos,power_level, effect_level,player)
|
||||||
|
local distance = vector.distance(player:get_pos(), pos)
|
||||||
|
if distance > (power_level+1)*10 then return end
|
||||||
|
if effect == "swiftness" then
|
||||||
|
mcl_potions.swiftness_func(player,effect_level,16)
|
||||||
|
elseif effect == "leaping" then
|
||||||
|
mcl_potions.leaping_func(player, effect_level, 16)
|
||||||
|
elseif effect == "strenght" then
|
||||||
|
mcl_potions.strength_func(player, effect_level, 16)
|
||||||
|
elseif effect == "regeneration" then
|
||||||
|
mcl_potions.regeneration_func(player, effect_level, 16)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_obstructed(pos)
|
||||||
|
for y=pos.y+1, pos.y+301 do
|
||||||
|
local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name
|
||||||
|
if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "ignore" and nodename ~= "mcl_core:void" then --ignore means not loaded, let's just assume that's air
|
||||||
|
if nodename ~= "mcl_beacons:beam" then
|
||||||
|
if minetest.get_item_group(nodename,"glass") == 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function globalstep_function(pos,player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local power_level = beacon_blockcheck(pos)
|
||||||
|
local effect_string = meta:get_string("effect")
|
||||||
|
if meta:get_int("effect_level") == 2 and power_level < 4 then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
if is_obstructed(pos) then return end
|
||||||
|
effect_player(effect_string,pos,power_level,meta:get_int("effect_level"),player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_beam_column(p,n,h)
|
||||||
|
if is_obstructed(p) then
|
||||||
|
minetest.set_node(p,n) -- pos itsself is already checked for air
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local p2 = vector.offset(p,0,h,0)
|
||||||
|
local column = minetest.find_nodes_in_area(p,p2,{"air","mcl_beacons:beam"})
|
||||||
|
if column then
|
||||||
|
minetest.bulk_set_node(column,n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("mcl_beacons:beacon", {
|
||||||
|
description = S"Beacon",
|
||||||
|
drawtype = "mesh",
|
||||||
|
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
mesh = "mcl_beacon.b3d",
|
||||||
|
tiles = {"beacon_UV.png"},
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("input", 1)
|
||||||
|
local form = formspec_string
|
||||||
|
meta:set_string("formspec", form)
|
||||||
|
end,
|
||||||
|
on_destruct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local input = meta:get_inventory():get_stack("input",1)
|
||||||
|
if not input:is_empty() then
|
||||||
|
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} --from mcl_anvils
|
||||||
|
minetest.add_item(p, input)
|
||||||
|
end
|
||||||
|
set_beam_column(pos,{name="air"},500)
|
||||||
|
end,
|
||||||
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
|
if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then
|
||||||
|
local sender_name = sender:get_player_name()
|
||||||
|
local power_level = beacon_blockcheck(pos)
|
||||||
|
if minetest.is_protected(pos, sender_name) then
|
||||||
|
minetest.record_protection_violation(pos, sender_name)
|
||||||
|
return
|
||||||
|
elseif power_level == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local input = inv:get_stack("input",1)
|
||||||
|
|
||||||
|
if input:is_empty() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local valid_item = false
|
||||||
|
|
||||||
|
for _, item in ipairs(beacon_fuellist) do
|
||||||
|
if input:get_name() == item then
|
||||||
|
valid_item = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not valid_item then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local successful = false
|
||||||
|
if fields.swiftness then
|
||||||
|
if power_level == 4 then
|
||||||
|
minetest.get_meta(pos):set_int("effect_level",2)
|
||||||
|
else
|
||||||
|
minetest.get_meta(pos):set_int("effect_level",1)
|
||||||
|
end
|
||||||
|
minetest.get_meta(pos):set_string("effect","swiftness")
|
||||||
|
successful = true
|
||||||
|
elseif fields.leaping and power_level >= 2 then
|
||||||
|
if power_level == 4 then
|
||||||
|
minetest.get_meta(pos):set_int("effect_level",2)
|
||||||
|
else
|
||||||
|
minetest.get_meta(pos):set_int("effect_level",1)
|
||||||
|
end
|
||||||
|
minetest.get_meta(pos):set_string("effect","leaping")
|
||||||
|
successful = true
|
||||||
|
elseif fields.strenght and power_level >= 3 then
|
||||||
|
if power_level == 4 then
|
||||||
|
minetest.get_meta(pos):set_int("effect_level",2)
|
||||||
|
else
|
||||||
|
minetest.get_meta(pos):set_int("effect_level",1)
|
||||||
|
end
|
||||||
|
minetest.get_meta(pos):set_string("effect","strenght")
|
||||||
|
successful = true
|
||||||
|
elseif fields.regeneration and power_level == 4 then
|
||||||
|
minetest.get_meta(pos):set_int("effect_level",2)
|
||||||
|
minetest.get_meta(pos):set_string("effect","regeneration")
|
||||||
|
successful = true
|
||||||
|
end
|
||||||
|
if successful then
|
||||||
|
if power_level == 4 then
|
||||||
|
awards.unlock(sender:get_player_name(),"mcl:maxed_beacon")
|
||||||
|
end
|
||||||
|
awards.unlock(sender:get_player_name(),"mcl:beacon")
|
||||||
|
input:take_item()
|
||||||
|
inv:set_stack("input",1,input)
|
||||||
|
|
||||||
|
local above = vector.offset(pos,0,1,0)
|
||||||
|
local node = minetest.get_node(above)
|
||||||
|
local p2 = 0
|
||||||
|
if minetest.get_item_group(node.name, "glass") > 0 then
|
||||||
|
p2 = glass_to_p2(node.name)
|
||||||
|
above.y = above.y + 1
|
||||||
|
node = minetest.get_node(above)
|
||||||
|
end
|
||||||
|
if node.name == "air" then
|
||||||
|
set_beam_column(above,{name="mcl_beacons:beam",param2=p2},50)
|
||||||
|
end
|
||||||
|
globalstep_function(pos,sender)--call it once outside the globalstep so the player gets the effect right after selecting it
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
light_source = 15,
|
||||||
|
groups = {handy=1},
|
||||||
|
drop = "mcl_beacons:beacon",
|
||||||
|
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||||
|
_mcl_hardness = 3,
|
||||||
|
})
|
||||||
|
|
||||||
|
mesecon.register_mvps_stopper("mcl_beacons:beacon")
|
||||||
|
mcl_wip.register_wip_item("mcl_beacons:beacon")
|
||||||
|
|
||||||
|
function register_beaconblock (itemstring)--API function for other mods
|
||||||
|
table.insert(beacon_blocklist, itemstring)
|
||||||
|
end
|
||||||
|
|
||||||
|
function register_beaconfuel(itemstring)
|
||||||
|
table.insert(beacon_fuellist, itemstring)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
label = "Beacon beams propagation",
|
||||||
|
nodenames ={ "mcl_beacons:beam" },
|
||||||
|
interval = 5,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos,node)
|
||||||
|
local p1 = vector.offset(pos,0,-1,0)
|
||||||
|
local p2 = vector.offset(pos,0,1,0)
|
||||||
|
local n1 = minetest.get_node_or_nil(p1)
|
||||||
|
local n2 = minetest.get_node_or_nil(p2)
|
||||||
|
local is_glass = minetest.get_item_group(n1.name,"glass") > 0
|
||||||
|
if not n1 or not n2 then return end
|
||||||
|
if n1.name == "air" then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
set_beam_column(pos,{name="air"},500)
|
||||||
|
elseif is_glass and node.param2 ~= glass_to_p2(n1.name) then
|
||||||
|
node.param2 = glass_to_p2(n1.name)
|
||||||
|
set_beam_column(pos,node,500)
|
||||||
|
elseif n1.name == "mcl_beacons:beam" and node.param2 ~= n1.param2 then
|
||||||
|
set_beam_column(pos,n1,500)
|
||||||
|
elseif n2.name == "air" then
|
||||||
|
set_beam_column(p2,node,500)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local timer = 0
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
timer = timer + dtime
|
||||||
|
if timer >= 3 then
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
local player_pos = player:get_pos()
|
||||||
|
local pos_list = minetest.find_nodes_in_area({x=player_pos.x-50, y=player_pos.y-50, z=player_pos.z-50}, {x=player_pos.x+50, y=player_pos.y+50, z=player_pos.z+50},"mcl_beacons:beacon")
|
||||||
|
for _, pos in ipairs(pos_list) do
|
||||||
|
globalstep_function(pos,player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
timer = 0
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mcl_beacons:beacon",
|
||||||
|
recipe = {
|
||||||
|
{"mcl_core:glass", "mcl_core:glass", "mcl_core:glass"},
|
||||||
|
{"mcl_core:glass", "mcl_mobitems:nether_star", "mcl_core:glass"},
|
||||||
|
{"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"}
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,5 @@
|
||||||
|
# textdomain: mcl_beacons
|
||||||
|
Beacon=Leuchtfeuer
|
||||||
|
Beacon:=Leuchtfeuer:
|
||||||
|
Primary Power:=Primäre Kraft:
|
||||||
|
Inventory:=Inventar:
|
|
@ -0,0 +1,6 @@
|
||||||
|
# textdomain: mcl_beacons
|
||||||
|
Beacon=
|
||||||
|
Beacon:=
|
||||||
|
Primary Power:=
|
||||||
|
Inventory:=
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
author=chmodsayshello
|
||||||
|
depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements, mcl_mobitems, mcl_nether
|
After Width: | Height: | Size: 1014 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 635 B |
After Width: | Height: | Size: 635 B |
After Width: | Height: | Size: 641 B |
After Width: | Height: | Size: 635 B |
After Width: | Height: | Size: 196 B |