skyblock: protector place fix, helloip paths fix
parent
5b55926cdb
commit
06b60536db
|
@ -102,7 +102,9 @@ battery_recharge = function(pos)
|
|||
minetest.sound_play("electric_zap", {pos=pos,gain=0.05,max_hear_distance = 8,})
|
||||
end
|
||||
|
||||
local full_coef = math.floor(energy/capacity*3); if full_coef > 2 then full_coef = 2 end
|
||||
local full_coef = math.floor(energy/capacity*3);
|
||||
if capacity == 0 then full_coef = 0 end
|
||||
if full_coef > 2 then full_coef = 2 end
|
||||
minetest.swap_node(pos,{name = "basic_machines:battery_".. full_coef}) -- graphic energy
|
||||
|
||||
return energy; -- new battery energy level
|
||||
|
@ -215,6 +217,7 @@ minetest.register_node("basic_machines:battery_0", {
|
|||
|
||||
if energy>=1 then -- no need to recharge yet, will still work next time
|
||||
local full_coef_new = math.floor(energy/capacity*3); if full_coef_new>2 then full_coef_new = 2 end
|
||||
if capacity == 0 then full_coef_new = 0 end
|
||||
pos.y = pos.y-1;
|
||||
if full_coef_new ~= full_coef then minetest.swap_node(pos,{name = "basic_machines:battery_".. full_coef_new}) end
|
||||
return
|
||||
|
|
|
@ -156,7 +156,7 @@ basic_protect.protect_new = function(p,name)
|
|||
local skyid = skyblock.players[name].id;
|
||||
local skypos = skyblock.get_island_pos(skyid);
|
||||
local dist = math.max(math.abs(p.x-skypos.x),math.abs(p.z-skypos.z));
|
||||
if dist>=skyblock.islands_gap then
|
||||
if dist>=skyblock.islands_gap and p.y<500 then
|
||||
local privs = minetest.get_player_privs(name);
|
||||
if not privs.kick then
|
||||
minetest.chat_send_player(name, "#PROTECTOR: you can only protect empty space or your island or above it")
|
||||
|
|
|
@ -15,6 +15,7 @@ basic_robot.maxoperations = 10; -- how many operations (dig, place,move,...,gene
|
|||
basic_robot.dig_require_energy = true; -- does robot require energy to dig stone?
|
||||
|
||||
basic_robot.bad_inventory_blocks = { -- disallow taking from these nodes inventories to prevent player abuses
|
||||
["moreblocks:circular_saw"] = true,
|
||||
["craft_guide:sign_wall"] = true,
|
||||
["basic_machines:battery_0"] = true,
|
||||
["basic_machines:battery_1"] = true,
|
||||
|
@ -25,7 +26,7 @@ basic_robot.bad_inventory_blocks = { -- disallow taking from these nodes invento
|
|||
|
||||
basic_robot.http_api = minetest.request_http_api();
|
||||
|
||||
basic_robot.version = "2019/10/01a";
|
||||
basic_robot.version = "2019/12/03a";
|
||||
|
||||
basic_robot.gui = {}; local robogui = basic_robot.gui -- gui management
|
||||
basic_robot.data = {}; -- stores all robot related data
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
--rnd music robot v12/10/2019, 22:00
|
||||
--tuning by Jozet
|
||||
|
||||
--@F2 E D C G3 G F2 E D C G3 G F2 A A F E G G E D E F D C3 C
|
||||
|
||||
if not init then
|
||||
_G.minetest.forceload_block(self.pos(),true)
|
||||
song = nil
|
||||
self.listen(1)
|
||||
local ent = _G.basic_robot.data[self.name()].obj:get_luaentity();
|
||||
dt = 0.001
|
||||
ent.timestep = dt -- time step
|
||||
|
||||
pitches = { -- definitions of note pitches
|
||||
0.59,
|
||||
0.62,
|
||||
0.67,
|
||||
0.7,
|
||||
0.74,
|
||||
0.79,
|
||||
0.845,
|
||||
0.89,
|
||||
0.945,
|
||||
1,
|
||||
1.05,
|
||||
1.12,
|
||||
1.19,
|
||||
1.25,
|
||||
1.34,
|
||||
1.41,
|
||||
1.48,
|
||||
1.58,
|
||||
1.68,
|
||||
1.78,
|
||||
1.88,
|
||||
2.0,
|
||||
2.15,
|
||||
2.28
|
||||
}
|
||||
|
||||
notenames = { -- definition of note names
|
||||
C = 1,
|
||||
Db = 2,
|
||||
D = 3,
|
||||
Eb = 4,
|
||||
E = 5,
|
||||
F = 6,
|
||||
Gb = 7,
|
||||
G = 8,
|
||||
Ab = 9,
|
||||
A = 10,
|
||||
Bb = 11,
|
||||
B = 12,
|
||||
["2C"] = 13,
|
||||
["2Db"] = 14,
|
||||
["2D"] = 15,
|
||||
["2Eb"] = 16,
|
||||
["2E"] = 17,
|
||||
["2F"] = 18,
|
||||
["2Gb"] = 19,
|
||||
["2G"] = 20,
|
||||
["2Ab"] = 21,
|
||||
["2A"] = 22,
|
||||
["2Bb"] = 23,
|
||||
["2B"] = 24
|
||||
}
|
||||
|
||||
say("available notes : C Db D Eb E F Gb G Ab A Bb B 2C 2Db 2D 2Eb 2E 2F 2Gb 2G 2Ab 2A 2Bb 2B . example: @A5 A A A A10 A A A , number after note name denotes change of tempo. To replay last song do @R")
|
||||
|
||||
|
||||
songdata = {}
|
||||
t=0 -- current timer
|
||||
idx = 0 -- current note to play
|
||||
tempo = 1 -- default pause
|
||||
|
||||
parse_song = function()
|
||||
songdata = {} -- reset song data
|
||||
for notepart in string.gmatch(song,"([^ ]+)") do -- parse song
|
||||
if notepart then
|
||||
local note,duration;
|
||||
note,duration = _G.string.match(notepart,"(%d*%a+)(%d*)")
|
||||
if not duration or duration == "" then duration = 0 end
|
||||
songdata[#songdata+1] = {notenames[note], tonumber(duration)}
|
||||
end
|
||||
end
|
||||
tempo = 3; -- default tempo
|
||||
t=0
|
||||
idx = 0 -- reset current idx
|
||||
end
|
||||
|
||||
init = true
|
||||
|
||||
end
|
||||
|
||||
if not song then
|
||||
speaker,msg = self.listen_msg()
|
||||
if msg and string.find(msg,"@") then
|
||||
song = string.sub(msg,2)
|
||||
if song ~= "R" then -- R for replay
|
||||
parse_song()
|
||||
self.label("playing song by " .. speaker.. ", " .. song )
|
||||
else
|
||||
idx = 0; t = 0; -- try play again!
|
||||
end
|
||||
end
|
||||
elseif t<=1 then -- play next note!
|
||||
idx = idx+1
|
||||
if idx>#songdata then
|
||||
self.label("song " .. song .. ". ended.")
|
||||
song = nil
|
||||
else
|
||||
if songdata[idx][2]>0 then tempo = songdata[idx][2] end
|
||||
t = tempo;
|
||||
self.sound( "piano",{
|
||||
pos = self.pos(), gain = 1000.0, pitch = pitches[ songdata[idx][1] ],
|
||||
max_hear_distance = 1000000
|
||||
})
|
||||
end
|
||||
else
|
||||
t=t-1
|
||||
end
|
|
@ -328,7 +328,7 @@ mt.register_on_player_receive_fields(function(player, formname, fields)
|
|||
data.items = progressive_mode and data.init_filter_items or datas.init_items
|
||||
craftguide:get_formspec(player_name)
|
||||
|
||||
elseif fields.alternate then
|
||||
elseif fields.alternate and data.recipes_item then
|
||||
local recipe = data.recipes_item[data.recipe_num + 1]
|
||||
data.recipe_num = recipe and data.recipe_num + 1 or 1
|
||||
craftguide:get_formspec(player_name)
|
||||
|
|
|
@ -80,7 +80,7 @@ print("#helloip: ".. step .. " ip range entries loaded.")
|
|||
-- load country codelist from ccode.txt
|
||||
-- copied as text from https://en.wikipedia.org/wiki/ISO_3166-1
|
||||
|
||||
local f = assert(io.open(modpath .. "\\ccode.txt", "r"))
|
||||
local f = assert(io.open(modpath .. "/ccode.txt", "r"))
|
||||
local cc = f:read("*all");f:close()
|
||||
local ccodes = {}
|
||||
|
||||
|
@ -155,4 +155,4 @@ minetest.register_chatcommand("ls", {
|
|||
end
|
||||
minetest.chat_send_player(name, out)
|
||||
end
|
||||
});
|
||||
});
|
|
@ -20,4 +20,4 @@ dofile(modpath..'/skyblock.lua') -- handles quest tracking, load/save player dat
|
|||
|
||||
dofile(modpath..'/tutorial.lua') -- display hints for new player
|
||||
|
||||
print('[MOD]'.. " SKY BLOCK v2 loaded , version 11/03/2018a.")
|
||||
print('[MOD]'.. " SKY BLOCK v2 loaded , version 12/13/2019a.")
|
|
@ -94,7 +94,7 @@ function(pos, newnode, placer, oldnode) track_quest(pos,newnode.name, placer, "o
|
|||
|
||||
-- track craft item
|
||||
minetest.register_on_craft(
|
||||
function(itemstack, player, old_craft_grid, craft_inv) track_quest(nil, itemstack:get_name(), player, "on_craft") end
|
||||
function(itemstack, player, old_craft_grid, craft_inv) track_quest(player:getpos(), itemstack:get_name(), player, "on_craft") end
|
||||
)
|
||||
|
||||
-- SAVING/LOADING DATA: player data, skyblock data
|
||||
|
@ -118,7 +118,7 @@ function load_player_data(name)
|
|||
file:close()
|
||||
pdata = minetest.deserialize(pdatastring) or {};
|
||||
else
|
||||
minetest.chat_send_all("#skyblock: problem loading player data for " .. name .. " from file")
|
||||
print("#skyblock: problem loading player data for " .. name .. " from file")
|
||||
end
|
||||
|
||||
pdata.stats = pdata.stats or {}; -- init
|
||||
|
|
Loading…
Reference in New Issue