2017
parent
55eafde324
commit
bde6493637
|
@ -245,7 +245,7 @@ minetest.register_node("basic_machines:autocrafter", {
|
|||
description = "Autocrafter",
|
||||
drawtype = "normal",
|
||||
tiles = {"pipeworks_autocrafter.png"},
|
||||
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
|
26
ball.lua
26
ball.lua
|
@ -159,7 +159,7 @@ minetest.register_entity("basic_machines:ball",{
|
|||
if not walkable then
|
||||
self.lastpos = pos
|
||||
if self.hurt~=0 then -- check for coliding nearby objects
|
||||
local objects = minetest.get_objects_inside_radius(pos,1);
|
||||
local objects = minetest.get_objects_inside_radius(pos,2);
|
||||
if #objects>1 then
|
||||
for _, obj in pairs(objects) do
|
||||
local p = obj:getpos();
|
||||
|
@ -169,11 +169,27 @@ minetest.register_entity("basic_machines:ball",{
|
|||
--if minetest.is_protected(p,self.owner) then return end
|
||||
if math.abs(p.x)<32 and math.abs(p.y)<32 and math.abs(p.z)<32 then return end -- no damage around spawn
|
||||
|
||||
if obj:is_player() then -- dont hurt owner
|
||||
if obj:get_player_name()==self.owner then break end
|
||||
if obj:is_player() then --player
|
||||
if obj:get_player_name()==self.owner then break end -- dont hurt owner
|
||||
|
||||
local hp = obj:get_hp()
|
||||
local newhp = hp-self.hurt;
|
||||
if newhp<=0 and boneworld and boneworld.killxp then
|
||||
local killxp = boneworld.killxp[self.owner];
|
||||
if killxp then
|
||||
boneworld.killxp[self.owner] = killxp + 0.01;
|
||||
end
|
||||
end
|
||||
obj:set_hp(newhp)
|
||||
else -- non player
|
||||
local hp = obj:get_hp()
|
||||
local newhp = hp-self.hurt;
|
||||
obj:set_hp(newhp)
|
||||
end
|
||||
|
||||
obj:set_hp(obj:get_hp()-self.hurt)
|
||||
|
||||
|
||||
|
||||
local count = ballcount[self.owner] or 1; count=count-1; ballcount[self.owner] = count;
|
||||
self.object:remove();
|
||||
return
|
||||
|
@ -314,7 +330,7 @@ minetest.register_entity("basic_machines:ball",{
|
|||
minetest.register_node("basic_machines:ball_spawner", {
|
||||
description = "Spawns energy ball one block above",
|
||||
tiles = {"basic_machines_ball.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
drawtype = "allfaces",
|
||||
paramtype = "light",
|
||||
param1=1,
|
||||
|
|
|
@ -26,10 +26,17 @@ basic_machines.craft_recipes = {
|
|||
["autocrafter"] = {item = "basic_machines:autocrafter", description = "Automate crafting", craft = { "default:steel_ingot 5", "default:mese_crystal 2", "default:diamondblock 2"}, tex = "pipeworks_autocrafter"},
|
||||
|
||||
["grinder"] = {item = "basic_machines:grinder", description = "Makes dusts and grinds materials", craft = {"default:diamond 13","default:mese 4"}, tex = "grinder"},
|
||||
|
||||
["power_block"] = {item = "basic_machines:power_block 5", description = "Energy cell, contains 11 energy units", craft = {"basic_machines:power_rod"}, tex = "power_block"},
|
||||
|
||||
["power_cell"] = {item = "basic_machines:power_cell 5", description = "Energy cell, contains 1 energy unit", craft = {"basic_machines:power_block"}, tex = "power_cell"},
|
||||
|
||||
["coal_lump"] = {item = "default:coal_lump", description = "Coal lump, contains 1 energy unit", craft = {"basic_machines:power_cell 2"}, tex = "default_coal_lump"},
|
||||
|
||||
}
|
||||
|
||||
basic_machines.craft_recipe_order = { -- order in which nodes appear
|
||||
"keypad","light","grinder","mover", "battery","generator","detector", "distributor", "clock_generator","recycler","autocrafter","ball_spawner", "enviroment"
|
||||
"keypad","light","grinder","mover", "battery","generator","detector", "distributor", "clock_generator","recycler","autocrafter","ball_spawner", "enviroment", "power_block", "power_cell", "coal_lump",
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,7 +60,7 @@ local constructor_process = function(pos)
|
|||
for _,v in pairs(craftlist) do
|
||||
inv:remove_item("main", ItemStack(v));
|
||||
end
|
||||
inv:add_item("dst", ItemStack(item));
|
||||
inv:add_item("main", ItemStack(item));
|
||||
|
||||
end
|
||||
|
||||
|
@ -97,17 +104,17 @@ local constructor_update_meta = function(pos)
|
|||
end
|
||||
|
||||
local form =
|
||||
"size[8,11]"..
|
||||
"size[8,10]"..
|
||||
"textlist[0,0;3,1.5;craft;" .. textlist .. ";" .. selected .."]"..
|
||||
"button[3.5,1;1.25,0.75;CRAFT;CRAFT]"..
|
||||
"image[3.65,0;1,1;".. tex .. ".png]"..
|
||||
"label[0,1.85;".. description .. "]"..
|
||||
"list[context;recipe;0,2.35;8,1;]"..
|
||||
"label[0,3.3;Put crafting materials here]"..
|
||||
"list[context;main;0,3.7;8,3;]"..
|
||||
"list[context;dst;5,0;3,2;]"..
|
||||
"label[0,6.5;player inventory]"..
|
||||
"list[current_player;main;0,7;8,4;]"..
|
||||
"list[context;recipe;5,0;3,2;]"..
|
||||
"label[0,2.3;Put crafting materials here]"..
|
||||
"list[context;main;0,2.7;8,3;]"..
|
||||
--"list[context;dst;5,0;3,2;]"..
|
||||
"label[0,5.5;player inventory]"..
|
||||
"list[current_player;main;0,6;8,4;]"..
|
||||
"listring[context;main]"..
|
||||
"listring[current_player;main]";
|
||||
meta:set_string("formspec", form);
|
||||
|
@ -117,7 +124,7 @@ end
|
|||
minetest.register_node("basic_machines:constructor", {
|
||||
description = "Constructor: used to make machines",
|
||||
tiles = {"grinder.png","default_furnace_top.png", "basic_machine_side.png","basic_machine_side.png","basic_machine_side.png","basic_machine_side.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
@ -125,7 +132,7 @@ minetest.register_node("basic_machines:constructor", {
|
|||
meta:set_string("owner", placer:get_player_name());
|
||||
meta:set_string("craft","keypad")
|
||||
meta:set_int("selected",1);
|
||||
local inv = meta:get_inventory();inv:set_size("main", 24);inv:set_size("dst",6);
|
||||
local inv = meta:get_inventory();inv:set_size("main", 24);--inv:set_size("dst",6);
|
||||
inv:set_size("recipe",8);
|
||||
end,
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
default
|
||||
protector?
|
||||
areas?
|
||||
areas?
|
||||
boneworld?
|
||||
moreores?
|
58
enviro.lua
58
enviro.lua
|
@ -6,10 +6,11 @@
|
|||
local enviro = {};
|
||||
enviro.skyboxes = {
|
||||
["default"]={type = "regular", tex = {}},
|
||||
["space"]={type="skybox", tex={"sky_pos_y.png","sky_neg_y.png","sky_pos_z.png","sky_neg_z.png","sky_neg_x.png","sky_pos_x.png",}}, -- need textures installed!
|
||||
["caves"]={type = "cavebox", tex = {"black.png","black.png","black.png","black.png","black.png","black.png",}}};
|
||||
["space"]=={type = "cavebox", tex = {"black.png","black.png","black.png","black.png","black.png","black.png",}},--{type="skybox", tex={"sky_pos_y.png","sky_neg_y.png","sky_pos_z.png","sky_neg_z.png","sky_neg_x.png","sky_pos_x.png",}}, -- need textures installed!
|
||||
["caves"]={type = "cavebox", tex = {"black.png","black.png","black.png","black.png","black.png","black.png",}},
|
||||
};
|
||||
|
||||
local space_start = 1500;
|
||||
local space_start = 1100;
|
||||
|
||||
|
||||
local enviro_update_form = function (pos)
|
||||
|
@ -57,7 +58,7 @@ end
|
|||
minetest.register_node("basic_machines:enviro", {
|
||||
description = "Changes enviroment for players around target location",
|
||||
tiles = {"enviro.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
|
@ -205,7 +206,7 @@ minetest.register_node("basic_machines:enviro", {
|
|||
|
||||
local reset_player_physics = function(player)
|
||||
if player then
|
||||
player:set_physics_override({speed=1,jump=1,gravity=1,sneak=true}) -- value set for extreme test space spawn
|
||||
player:set_physics_override({speed=1,jump=1,gravity=1}) -- value set for extreme test space spawn
|
||||
local skybox = enviro.skyboxes["default"]; -- default skybox is "default"
|
||||
player:set_sky(0,skybox["type"],skybox["tex"]);
|
||||
end
|
||||
|
@ -217,11 +218,11 @@ enviro_adjust_physics = function(player) -- adjust players physics/skybox 1 seco
|
|||
if player then
|
||||
local pos = player:getpos(); if not pos then return end
|
||||
if pos.y > space_start then -- is player in space or not?
|
||||
player:set_physics_override({speed=1,jump=0.6,gravity=0.2,sneak=true}) -- value set for extreme test space spawn
|
||||
player:set_physics_override({speed=1,jump=0.5,gravity=0.1}) -- value set for extreme test space spawn
|
||||
local skybox = enviro.skyboxes["space"];
|
||||
player:set_sky(0,skybox["type"],skybox["tex"]);
|
||||
else
|
||||
player:set_physics_override({speed=1,jump=1,gravity=1,sneak=true}) -- value set for extreme test space spawn
|
||||
player:set_physics_override({speed=1,jump=1,gravity=1}) -- value set for extreme test space spawn
|
||||
local skybox = enviro.skyboxes["default"];
|
||||
player:set_sky(0,skybox["type"],skybox["tex"]);
|
||||
end
|
||||
|
@ -239,6 +240,13 @@ minetest.register_on_joinplayer(enviro_adjust_physics)
|
|||
|
||||
-- SERVER GLOBAL SPACE CODE: uncomment to enable it
|
||||
|
||||
local round = math.floor;
|
||||
local protector_position = function(pos)
|
||||
local r = 20;
|
||||
local ry = 2*r;
|
||||
return {x=round(pos.x/r+0.5)*r,y=round(pos.y/ry+0.5)*ry,z=round(pos.z/r+0.5)*r};
|
||||
end
|
||||
|
||||
local stimer = 0
|
||||
local enviro_space = {};
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
@ -257,19 +265,33 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
|
||||
if inspace==1 then -- special space code
|
||||
local dist = math.abs(pos.x)+math.abs(pos.z);
|
||||
if dist > 50 then -- close to spawn normal
|
||||
local populated = minetest.find_node_near(pos, 5, "protector:protect");
|
||||
if not populated then -- do damage if player found not close to protectors
|
||||
|
||||
|
||||
if pos.y<1500 and pos.y>1120 then
|
||||
local hp = player:get_hp();
|
||||
local privs = minetest.get_player_privs(name);
|
||||
if hp>0 and not privs.kick then
|
||||
player:set_hp(hp-10); -- dead in 20/10 = 2 events
|
||||
minetest.chat_send_player(name,"WARNING: in space you must stay close to spawn or protected areas");
|
||||
if hp>0 then
|
||||
minetest.chat_send_player(name,"WARNING: you entered DEADLY RADIATION ZONE");
|
||||
player:set_hp(hp-15);
|
||||
end
|
||||
return
|
||||
else
|
||||
|
||||
local ppos = protector_position(pos);
|
||||
local populated = (minetest.get_node(ppos).name=="basic_protect:protector");
|
||||
if populated then
|
||||
if minetest.get_meta(ppos):get_int("space") == 1 then populated = false end
|
||||
end
|
||||
|
||||
if not populated then -- do damage if player found not close to protectors
|
||||
local hp = player:get_hp();
|
||||
local privs = minetest.get_player_privs(name);
|
||||
if hp>0 and not privs.kick then
|
||||
player:set_hp(hp-10); -- dead in 20/10 = 2 events
|
||||
minetest.chat_send_player(name,"WARNING: in space you must stay close to spawn or protected areas");
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -325,6 +347,8 @@ minetest.register_on_punchplayer( -- bring gravity closer to normal with each pu
|
|||
function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
||||
|
||||
if player:get_physics_override() == nil then return end
|
||||
local pos = player:getpos(); if pos.y>= space_start then return end
|
||||
|
||||
local gravity = player:get_physics_override().gravity;
|
||||
if gravity<1 then
|
||||
gravity = 0.5*gravity+0.5;
|
||||
|
|
72
grinder.lua
72
grinder.lua
|
@ -15,6 +15,8 @@ basic_machines.grinder_recipes = {
|
|||
["es:purpellium_lump"] = {16,"es:purpellium_dust 2",1},
|
||||
["default:obsidian_shard"] = {199,"default:lava_source",1},
|
||||
["gloopblocks:basalt"] = {1, "default:cobble",1}, -- enable coble farms with gloopblocks mod
|
||||
["default:ice"] = {1, "default:snow 4",1},
|
||||
["darkage:silt_lump"]={1,"darkage:chalk_powder",1},
|
||||
};
|
||||
|
||||
-- es gems dust cooking
|
||||
|
@ -135,7 +137,7 @@ local grinder_update_meta = function(pos)
|
|||
"list["..list_name..";fuel;0.,2.5;1,1;]"..
|
||||
"list[current_player;main;0,4;8,4;]"..
|
||||
"button[6.5,0.5;1,1;OK;OK]"..
|
||||
|
||||
"button[6.5,1.5;1,1;help;help]"..
|
||||
"listring[" .. inv_name .. ";dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[" .. inv_name .. ";src]";
|
||||
|
@ -147,7 +149,7 @@ end
|
|||
minetest.register_node("basic_machines:grinder", {
|
||||
description = "Grinder",
|
||||
tiles = {"grinder.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
@ -199,6 +201,19 @@ minetest.register_node("basic_machines:grinder", {
|
|||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
if fields.quit then return end
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
||||
if fields.help then
|
||||
--recipe list: [in] ={fuel cost, out, quantity of material required for processing}
|
||||
--basic_machines.grinder_recipes
|
||||
text = "RECIPES\n\n";
|
||||
for key,v in pairs(basic_machines.grinder_recipes) do
|
||||
text = text .. "INPUT ".. key .. " " .. v[3] .. " OUTPUT " .. v[2] .. "\n"
|
||||
end
|
||||
|
||||
local form = "size [6,7] textarea[0,0;6.5,8.5;grinderhelp;GRINDER RECIPES;".. text.."]"
|
||||
minetest.show_formspec(sender:get_player_name(), "grinderhelp", form)
|
||||
|
||||
end
|
||||
grinder_update_meta(pos);
|
||||
end,
|
||||
|
||||
|
@ -272,7 +287,8 @@ basic_machines.grinder_recipes["default:copper_ingot"] = {4,"basic_machines:copp
|
|||
basic_machines.grinder_recipes["default:gold_ingot"] = {6,"basic_machines:gold_dust_33 2",1};
|
||||
|
||||
-- are moreores (tin, silver, mithril) present?
|
||||
local table = minetest.registered_nodes["moreores:tin_lump"]; if table then
|
||||
|
||||
local table = minetest.registered_items["moreores:tin_lump"]; if table then
|
||||
register_dust("tin","moreores:tin_lump","moreores:tin_ingot",4,8,"FF","FF","FF")
|
||||
register_dust("silver","moreores:silver_lump","moreores:silver_ingot",5,15,"BB","BB","BB")
|
||||
register_dust("mithril","moreores:mithril_lump","moreores:mithril_ingot",16,750,"00","00","FF")
|
||||
|
@ -282,5 +298,53 @@ local table = minetest.registered_nodes["moreores:tin_lump"]; if table then
|
|||
basic_machines.grinder_recipes["moreores:mithril_ingot"] = {16,"basic_machines:mithril_dust_33 2",1};
|
||||
end
|
||||
|
||||
|
||||
register_dust("mese","default:mese_crystal","default:mese_crystal",8,250,"CC","CC","00")
|
||||
register_dust("diamond","default:diamond","default:diamond",16,500,"00","EE","FF") -- 0.3hr cooking time to make diamond!
|
||||
register_dust("diamond","default:diamond","default:diamond",16,500,"00","EE","FF") -- 0.3hr cooking time to make diamond!
|
||||
|
||||
-- darkage recipes and ice
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
recipe = "default:ice",
|
||||
output = "default:water_flowing",
|
||||
cooktime = 4
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
recipe = "default:stone",
|
||||
output = "darkage:basalt",
|
||||
cooktime = 60
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
recipe = "darkage:slate",
|
||||
output = "darkage:schist",
|
||||
cooktime = 20
|
||||
})
|
||||
|
||||
-- dark age recipe: cook schist to get gneiss
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
recipe = "darkage:gneiss",
|
||||
output = "darkage:marble",
|
||||
cooktime = 20
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "darkage:serpentine",
|
||||
recipe = {
|
||||
{"darkage:marble","default:cactus"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "darkage:mud",
|
||||
recipe = {
|
||||
{"default:dirt","default:water_flowing"}
|
||||
}
|
||||
})
|
76
mover.lua
76
mover.lua
|
@ -25,12 +25,15 @@ basic_machines.hardness["basic_machines:distributor"]=0.;
|
|||
basic_machines.hardness["basic_machines:battery"]=0.;
|
||||
basic_machines.hardness["basic_machines:detector"]=0.;
|
||||
basic_machines.hardness["basic_machines:generator"]=0.;
|
||||
basic_machines.hardness["basic_machines:clockgen"]=0.;
|
||||
basic_machines.hardness["basic_machines:ball_spawner"]=0.;
|
||||
basic_machines.hardness["basic_machines:light_on"]=0.;
|
||||
basic_machines.hardness["basic_machines:light_off"]=0.;
|
||||
|
||||
-- grief potential items need highest possible upgrades
|
||||
basic_machines.hardness["boneworld:acid_source_active"]=21890.;
|
||||
basic_machines.hardness["darkage:mud"]=21890.;
|
||||
|
||||
basic_machines.hardness["es:toxic_water_source"]=21890.;basic_machines.hardness["es:toxic_water_flowing"]=11000;
|
||||
basic_machines.hardness["default:river_water_source"]=21890.;
|
||||
|
||||
|
@ -107,7 +110,7 @@ end)
|
|||
minetest.register_node("basic_machines:mover", {
|
||||
description = "Mover - universal digging/harvesting/teleporting/transporting machine, its upgradeable.",
|
||||
tiles = {"compass_top.png","default_furnace_top.png", "basic_machine_mover_side.png","basic_machine_mover_side.png","basic_machine_mover_side.png","basic_machine_mover_side.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
|
@ -726,7 +729,7 @@ minetest.register_node("basic_machines:mover", {
|
|||
|
||||
-- KEYPAD --
|
||||
|
||||
local function use_keypad(pos,ttl, again) -- position, time to live ( how many times can signal travel before vanishing to prevent infinite recursion )
|
||||
local function use_keypad(pos,ttl, manual) -- position, time to live ( how many times can signal travel before vanishing to prevent infinite recursion ), was it manual activation?
|
||||
|
||||
if ttl<0 then return end;
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
@ -756,11 +759,25 @@ local function use_keypad(pos,ttl, again) -- position, time to live ( how many t
|
|||
local name = meta:get_string("owner");
|
||||
if minetest.is_protected(pos,name) then meta:set_string("infotext", "Protection fail. reset."); meta:set_int("count",0); return end
|
||||
local count = meta:get_int("count") or 0; -- counts how many repeats left
|
||||
local active_repeats = meta:get_int("active_repeats") or 0;
|
||||
|
||||
if again or count>0 then -- this is keypad repeating its activation
|
||||
if count < 0 then return end
|
||||
|
||||
if manual then
|
||||
if meta:get_int("repeat")==1 then -- stop it
|
||||
meta:set_int("repeat",0);
|
||||
meta:set_int("count", 0)
|
||||
meta:set_int("T",4);
|
||||
meta:set_string("infotext", "#KEYPAD: reseting. Punch again after 5s to activate")
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
if count>0 then -- this is keypad repeating its activation
|
||||
count = count - 1; meta:set_int("count",count);
|
||||
else
|
||||
meta:set_int("repeat",0);
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
if count>=0 then
|
||||
|
@ -770,14 +787,12 @@ local function use_keypad(pos,ttl, again) -- position, time to live ( how many t
|
|||
end
|
||||
|
||||
if count>0 then -- only trigger repeat if count on
|
||||
if active_repeats == 0 then -- cant add new repeats quickly to prevent abuse
|
||||
meta:set_int("active_repeats",1);
|
||||
meta:set_int("repeat",1); -- its repeating now
|
||||
if basic_machines.clockgen==0 then return end
|
||||
minetest.after(machines_timer, function()
|
||||
meta:set_int("active_repeats",0);
|
||||
use_keypad(pos,machines_TTL,1) -- third parameter means repeat mode
|
||||
end ) -- repeat operation as many times as set with "iter"
|
||||
end
|
||||
use_keypad(pos,machines_TTL)
|
||||
end )
|
||||
|
||||
end
|
||||
|
||||
local x0,y0,z0,mode;
|
||||
|
@ -879,6 +894,18 @@ local function use_keypad(pos,ttl, again) -- position, time to live ( how many t
|
|||
return
|
||||
end
|
||||
|
||||
if node.name == "basic_machines:distributor" then
|
||||
local i = string.find(text," ");
|
||||
if i then
|
||||
local ti = tonumber(string.sub(text,1,i-1)) or 1;
|
||||
local tm = tonumber(string.sub(text,i+1)) or 1;
|
||||
if ti>=1 and ti<=16 and tm>=-2 and tm<=2 then
|
||||
tmeta:set_int("active"..ti,tm)
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local table = minetest.registered_nodes[node.name];
|
||||
|
@ -910,7 +937,7 @@ local function check_keypad(pos,name,ttl) -- called only when manually activated
|
|||
local iter = meta:get_int("iter");
|
||||
local count = meta:get_int("count");
|
||||
if count<iter-1 or iter<2 then meta:set_int("active_repeats",0) end -- so that keypad can work again, at least one operation must have occured though
|
||||
meta:set_int("count",iter); use_keypad(pos,machines_TTL) -- time to live set when punched
|
||||
meta:set_int("count",iter); use_keypad(pos,machines_TTL,true) -- time to live set when punched
|
||||
return
|
||||
end
|
||||
if name == "" then return end
|
||||
|
@ -934,7 +961,7 @@ end
|
|||
minetest.register_node("basic_machines:keypad", {
|
||||
description = "Keypad - basic way to activate machines by sending signal",
|
||||
tiles = {"keypad.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
|
@ -995,7 +1022,7 @@ minetest.register_node("basic_machines:keypad", {
|
|||
minetest.register_node("basic_machines:detector", {
|
||||
description = "Detector - can detect blocks/players/objects and activate machines",
|
||||
tiles = {"detector.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
|
@ -1318,7 +1345,7 @@ minetest.register_abm({
|
|||
minetest.register_node("basic_machines:clockgen", {
|
||||
description = "Clock generator - use sparingly, continually activates top block",
|
||||
tiles = {"basic_machine_clock_generator.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
@ -1338,7 +1365,7 @@ minetest.register_node("basic_machines:clockgen", {
|
|||
minetest.register_node("basic_machines:distributor", {
|
||||
description = "Distributor - can forward signal up to 16 different targets",
|
||||
tiles = {"distributor.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
|
@ -1526,7 +1553,7 @@ minetest.register_node("basic_machines:distributor", {
|
|||
minetest.register_node("basic_machines:light_off", {
|
||||
description = "Light off",
|
||||
tiles = {"light_off.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
mesecons = {effector = {
|
||||
action_on = function (pos, node,ttl)
|
||||
minetest.swap_node(pos,{name = "basic_machines:light_on"});
|
||||
|
@ -1553,7 +1580,7 @@ minetest.register_node("basic_machines:light_off", {
|
|||
minetest.register_node("basic_machines:light_on", {
|
||||
description = "Light on",
|
||||
tiles = {"light.png"},
|
||||
groups = {oddly_breakable_by_hand=2},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
light_source = LIGHT_MAX,
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
@ -2049,7 +2076,7 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
|
|||
"\n**************************************************\nusage\n"..
|
||||
|
||||
"\nJust punch ( left click ) keypad, then the target block will be activated."..
|
||||
"\nTo set text on other nodes ( text shows when you look at node ) just target the node and set nonempty text. Upon activation text will be set. When target node is another keypad, its \"text\" field will be set. When targets is mover/detector, its \"filter\" field will be set. To clear \"filter\" set text to \"@\"."..
|
||||
"\nTo set text on other nodes ( text shows when you look at node ) just target the node and set nonempty text. Upon activation text will be set. When target node is another keypad, its \"text\" field will be set. When targets is mover/detector, its \"filter\" field will be set. To clear \"filter\" set text to \"@\". When target is distributor, you can change i-th target of distributor to mode mode with \"i mode\""..
|
||||
|
||||
"\n\nkeyboard : to use keypad as keyboard for text input write \"@\" in \"text\" field and set any password. Next time keypad is used it will work as text input device."..
|
||||
|
||||
|
@ -2119,7 +2146,8 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
|
|||
|
||||
if meta:get_string("text")=="@" then -- keyboard mode
|
||||
meta:set_string("input", pass);
|
||||
use_keypad(pos,machines_TTL);
|
||||
meta:set_int("count",1);
|
||||
use_keypad(pos,machines_TTL,false);
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -2135,8 +2163,10 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
|
|||
if meta:get_int("count")<=0 then -- only accept new operation requests if idle
|
||||
meta:set_int("count",meta:get_int("iter"));
|
||||
meta:set_int("active_repeats",0);
|
||||
use_keypad(pos,machines_TTL)
|
||||
else meta:set_int("count",0); meta:set_string("infotext","operation aborted by user. punch to activate.") -- reset
|
||||
use_keypad(pos,machines_TTL,true)
|
||||
else
|
||||
meta:set_int("count",0);
|
||||
meta:set_string("infotext","operation aborted by user. punch to activate.") -- reset
|
||||
end
|
||||
|
||||
return
|
||||
|
|
|
@ -159,7 +159,7 @@ end
|
|||
minetest.register_node("basic_machines:recycler", {
|
||||
description = "Recycler - use to get some ingredients back from crafted things",
|
||||
tiles = {"recycler.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
|
|
@ -39,7 +39,9 @@ battery_recharge = function(pos)
|
|||
|
||||
local add_energy=0;
|
||||
add_energy = basic_machines.energy_crystals[item] or 0;
|
||||
|
||||
if add_energy>0 then
|
||||
if pos.y>1500 then add_energy=2*add_energy end -- in space recharge is more efficient
|
||||
crystal = true;
|
||||
if energy+add_energy<=capacity then
|
||||
stack:take_item(1);
|
||||
|
@ -85,6 +87,9 @@ battery_upgrade = function(pos)
|
|||
end
|
||||
end
|
||||
if count1<count2 then count =count1 else count=count2 end
|
||||
|
||||
if pos.y>1500 then count = 2*count end -- space increases efficiency
|
||||
|
||||
meta:set_int("upgrade",count);
|
||||
-- adjust capacity
|
||||
local capacity = 10+20*count;
|
||||
|
@ -103,7 +108,7 @@ local machines_activate_furnace = minetest.registered_nodes["default:furnace"].o
|
|||
minetest.register_node("basic_machines:battery", {
|
||||
description = "battery - stores energy, generates energy from fuel, can power nearby machines, or accelerate/run furnace above it. Its upgradeable.",
|
||||
tiles = {"basic_machine_outlet.png","basic_machine_side.png","basic_machine_battery.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
@ -142,9 +147,11 @@ minetest.register_node("basic_machines:battery", {
|
|||
meta:set_int("ftime",t1);
|
||||
|
||||
local upgrade = meta:get_int("upgrade");upgrade=upgrade*0.1;
|
||||
|
||||
--if fuel_time>4 then -- accelerated cooking
|
||||
local src_time = fmeta:get_float("src_time") or 0
|
||||
energy = energy - 0.25*upgrade; -- use energy to accelerate burning
|
||||
|
||||
fmeta:set_float("src_time",src_time+machines_timer*upgrade); -- with max 99 upgrades battery furnace works 6x faster
|
||||
--end
|
||||
|
||||
|
@ -284,7 +291,7 @@ end
|
|||
minetest.register_node("basic_machines:generator", {
|
||||
description = "Generator - very expensive, generates power crystals that provide power. Its upgradeable.",
|
||||
tiles = {"basic_machine_side.png","basic_machine_side.png","basic_machine_generator.png"},
|
||||
groups = {oddly_breakable_by_hand=2,mesecon_effector_on = 1},
|
||||
groups = {cracky=3, mesecon_effector_on = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
|
Loading…
Reference in New Issue