generator and clockgen balancing
This commit is contained in:
parent
8f00e294cc
commit
346253b922
@ -39,6 +39,8 @@ 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", "power_block", "power_cell", "coal_lump",
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local constructor_process = function(pos)
|
||||
|
4
init.lua
4
init.lua
@ -20,6 +20,10 @@ basic_machines = {};
|
||||
|
||||
-- define your maxstacksize here !
|
||||
basic_machines.maxstack = 99
|
||||
basic_machines.activeblocks = minetest.settings:get("active_block_range") or 2
|
||||
basic_machines.activeblocks = math.floor((vector.distance({x=0,y=0,z=0}, {x=basic_machines.activeblocks,y=basic_machines.activeblocks,z=basic_machines.activeblocks})*16))
|
||||
basic_machines.maxgen = 4 -- max number of allowed generators per active mapblock
|
||||
basic_machines.maxclock = 2 -- max number of allowed clockgens per active mapblock
|
||||
|
||||
|
||||
dofile(minetest.get_modpath("basic_machines").."/mark.lua") -- used for markings, borrowed and adapted from worldedit mod
|
||||
|
26
mover.lua
26
mover.lua
@ -8,6 +8,7 @@
|
||||
-- *** SETTINGS *** --
|
||||
basic_machines.timer = 5 -- main timestep
|
||||
basic_machines.machines_minstep = 1 -- minimal allowed activation timestep, if faster machines overheat
|
||||
local machines_clockradius = math.floor(basic_machines.activeblocks / basic_machines.maxclock)
|
||||
|
||||
basic_machines.max_range = 10 -- machines normal range of operation
|
||||
basic_machines.machines_operations = 10 -- 1 coal will provide 10 mover basic operations ( moving dirt 1 block distance)
|
||||
@ -1492,13 +1493,26 @@ minetest.register_node("basic_machines:clockgen", {
|
||||
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);
|
||||
local owner = placer:get_player_name() or "";
|
||||
local privs = minetest.get_player_privs(owner);
|
||||
if privs.machines then meta:set_int("machines",1) end
|
||||
|
||||
|
||||
meta:set_string("owner",owner);
|
||||
meta:set_string("infotext","clock generator (owned by " .. owner .. "): place machine to be activated on top of generator");
|
||||
local name = placer:get_player_name()
|
||||
local pinv = placer:get_inventory()
|
||||
local match = minetest.find_node_near(pos, machines_clockradius, {"basic_machines:clockgen"})
|
||||
if match then
|
||||
|
||||
local distance = math.floor(vector.distance(pos, match))
|
||||
minetest.chat_send_player(name,core.colorize('#FF0000',"##### Clockgens disturb each other. Place next one at least "..machines_clockradius.." nodes away #####"))
|
||||
minetest.set_node(pos,{name="air"})
|
||||
minetest.spawn_item(pos, "basic_machines:clockgen 1")
|
||||
else
|
||||
local meta = minetest.get_meta(pos);
|
||||
local owner = placer:get_player_name() or "";
|
||||
local privs = minetest.get_player_privs(owner);
|
||||
if privs.machines then meta:set_int("machines",1) end
|
||||
|
||||
meta:set_string("owner",owner);
|
||||
meta:set_string("infotext","clock generator (owned by " .. owner .. "): place machine to be activated on top of generator");
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
local machines_timer = basic_machines.machines_timer or 5
|
||||
local machines_minstep = basic_machines.machines_minstep or 1
|
||||
local machines_genradius = math.floor(basic_machines.activeblocks / basic_machines.maxgen)
|
||||
|
||||
|
||||
-- BATTERY
|
||||
|
||||
@ -369,14 +371,27 @@ minetest.register_node("basic_machines:generator", {
|
||||
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);
|
||||
meta:set_string("infotext","generator - generates power crystals that provide power. Upgrade with up to 50 generators.");
|
||||
meta:set_string("owner",placer:get_player_name());
|
||||
local inv = meta:get_inventory();
|
||||
inv:set_size("fuel", 1*1); -- here generated power crystals are placed
|
||||
inv:set_size("upgrade", 2*1);
|
||||
meta:set_int("upgrade",0); -- upgrade level determines quality of produced crystals
|
||||
|
||||
local name = placer:get_player_name()
|
||||
local pinv = placer:get_inventory()
|
||||
local match = minetest.find_node_near(pos, machines_genradius, {"basic_machines:generator"})
|
||||
if match then
|
||||
|
||||
local distance = math.floor(vector.distance(pos, match))
|
||||
minetest.chat_send_player(name,core.colorize('#FF0000',"##### Magnetic field problem. Distance to next generator must be at least "..machines_genradius.." nodes #####"))
|
||||
minetest.set_node(pos,{name="air"})
|
||||
minetest.spawn_item(pos, "basic_machines:generator 1")
|
||||
else
|
||||
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("infotext","generator - generates power crystals that provide power. Upgrade with up to 50 generators.");
|
||||
meta:set_string("owner",placer:get_player_name());
|
||||
local inv = meta:get_inventory();
|
||||
inv:set_size("fuel", 1*1); -- here generated power crystals are placed
|
||||
inv:set_size("upgrade", 2*1);
|
||||
meta:set_int("upgrade",0); -- upgrade level determines quality of produced crystals
|
||||
|
||||
end
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
@ -451,7 +466,7 @@ local genstat = {}; -- generator statistics for each player
|
||||
minetest.register_abm({
|
||||
nodenames = {"basic_machines:generator"},
|
||||
neighbors = {""},
|
||||
interval = 19,
|
||||
interval = 30,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
Loading…
x
Reference in New Issue
Block a user