Compare commits
2 Commits
48a01f324c
...
237585f605
Author | SHA1 | Date |
---|---|---|
ThePython | 237585f605 | |
ThePython | 57a7a8a9ab |
|
@ -105,6 +105,7 @@ You can find the old textures and sounds by going back to previous commits in Gi
|
||||||
* The Constructor and Deconstructor are now deprecated. Element Exchange is no more.
|
* The Constructor and Deconstructor are now deprecated. Element Exchange is no more.
|
||||||
* Upgrades and Stars can no longer be used as fuel.
|
* Upgrades and Stars can no longer be used as fuel.
|
||||||
* Dark and Red Matter Armor now uses ProjectE's textures
|
* Dark and Red Matter Armor now uses ProjectE's textures
|
||||||
|
* Removed the ability to right click with stars to see the charge (made it more convenient to add the EMC Link)
|
||||||
* Bugfixes:
|
* Bugfixes:
|
||||||
* Dark and Red Matter Armor display properly (and identically) in both games.
|
* Dark and Red Matter Armor display properly (and identically) in both games.
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
local function on_rightclick(pos, node, player, itemstack, pointed_thing)
|
local function on_rightclick(pos, node, player, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if player:get_player_control().sneak then
|
-- Would be sneak but that would require me to override the player's hand...
|
||||||
|
if player:get_player_control().aux1 then
|
||||||
local contained = inv:get_stack("star", 1)
|
local contained = inv:get_stack("star", 1)
|
||||||
if minetest.get_item_group(itemstack:get_name(), "klein_star") > 0 then
|
if minetest.get_item_group(itemstack:get_name(), "klein_star") > 0 then
|
||||||
inv:set_stack("star", 1, itemstack)
|
inv:set_stack("star", 1, itemstack)
|
||||||
|
@ -22,9 +23,61 @@ local function on_rightclick(pos, node, player, itemstack, pointed_thing)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function link_action(pos)
|
||||||
|
local using_star = true
|
||||||
|
local player
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
if minetest.get_item_group(inv:get_stack("star", 1):get_name(), "klein_star") < 1 then
|
||||||
|
using_star = false
|
||||||
|
player = minetest.get_player_by_name(meta:get_string("exchangeclone_placer"))
|
||||||
|
if not (player and player ~= "") then return end
|
||||||
|
end
|
||||||
|
local target_item = meta:get_string("target_item")
|
||||||
|
if target_item and target_item ~= "" and minetest.registered_items[target_item] then
|
||||||
|
local input_stack = inv:get_stack("input", 1)
|
||||||
|
local output_stack = inv:get_stack("output", 1)
|
||||||
|
-- make sure the target matches the output (including enchantments)
|
||||||
|
if not inv:is_empty("output") then
|
||||||
|
if exchangeclone.handle_alias(target_item) ~= output_stack:get_name() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local result = exchangeclone.handle_alias(target_item)
|
||||||
|
-- make sure star/player has enough EMC
|
||||||
|
local current_emc
|
||||||
|
if using_star then
|
||||||
|
current_emc = exchangeclone.get_star_emc(inv, "star", 1)
|
||||||
|
else
|
||||||
|
current_emc = exchangeclone.get_player_emc(player)
|
||||||
|
end
|
||||||
|
local emc_value = exchangeclone.get_item_emc(input_stack:get_name())
|
||||||
|
if emc_value and emc_value > 0 then
|
||||||
|
local max_amount = math.min(input_stack:get_stack_max(), math.floor(current_emc/emc_value))
|
||||||
|
local added_amount = max_amount - inv:add_item("output", ItemStack(result.." "..max_amount)):get_count()
|
||||||
|
local result_emc = math.min(current_emc, current_emc - (emc_value * added_amount)) -- not sure if "math.min()" is necessary
|
||||||
|
if using_star then
|
||||||
|
exchangeclone.set_star_emc(inv, "star", 1, result_emc)
|
||||||
|
else
|
||||||
|
exchangeclone.set_player_emc(player, result_emc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
if not (target_item and target_item ~= "" and minetest.registered_items[target_item]) then
|
||||||
|
timer:stop()
|
||||||
|
else
|
||||||
|
if not timer:is_started() then
|
||||||
|
timer:start(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("exchangeclone:emc_link", {
|
minetest.register_node("exchangeclone:emc_link", {
|
||||||
description = "EMC Link\nAllows automation with personal EMC",
|
description = "EMC Link\nAllows automation with personal EMC",
|
||||||
tiles = {"exchangeclone_emc_link.png"},
|
tiles = {"exchangeclone_emc_link.png"},
|
||||||
|
groups = {pickaxey=4, material_stone=1, cracky = 2, building_block = 1, level = exchangeclone.mtg and 2 or 0},
|
||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
@ -34,13 +87,19 @@ minetest.register_node("exchangeclone:emc_link", {
|
||||||
inv:set_size("output", 1)
|
inv:set_size("output", 1)
|
||||||
meta:set_string("infotext", "EMC Link")
|
meta:set_string("infotext", "EMC Link")
|
||||||
end,
|
end,
|
||||||
|
can_dig = exchangeclone.can_dig,
|
||||||
|
after_dig_node = exchangeclone.drop_after_dig({"input", "star", "output"}),
|
||||||
|
on_blast = exchangeclone.on_blast({"input", "star", "output"}),
|
||||||
after_place_node = function(pos, player, itemstack, pointed_thing)
|
after_place_node = function(pos, player, itemstack, pointed_thing)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("exchangeclone_placer", player_name)
|
meta:set_string("exchangeclone_placer", player_name)
|
||||||
meta:set_string("infotext", "EMC Link".."\n"..S("Owned by ")..player_name)
|
meta:set_string("infotext", "EMC Link".."\n".."Owned by "..player_name)
|
||||||
if exchangeclone.pipeworks then
|
if exchangeclone.pipeworks then
|
||||||
pipeworks.after_place(pos, player, itemstack, pointed_thing)
|
pipeworks.after_place(pos, player, itemstack, pointed_thing)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||||
|
_mcl_blast_resistance = 10,
|
||||||
|
_mcl_hardness = 8,
|
||||||
})
|
})
|
|
@ -8,26 +8,25 @@ hopper:add_container({
|
||||||
})
|
})
|
||||||
|
|
||||||
hopper:add_container({
|
hopper:add_container({
|
||||||
{"top", "group:container=3", "main"},
|
{"top", "exchangeclone:upgrader", "dst"},
|
||||||
{"bottom", "group:container=3", "main"},
|
{"side", "exchangeclone:upgrader", "fuel"},
|
||||||
{"side", "group:container=3", "main"},
|
{"bottom", "exchangeclone:upgrader", "src"},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- I assumed "top" meant when it's on top of a node, not when there's a node on top of it. Whoops.
|
|
||||||
hopper:add_container({
|
hopper:add_container({
|
||||||
{"top", "group:container=4", "dst"},
|
{"top", "group:exchangeclone_furnace", "dst"},
|
||||||
{"side", "group:container=4", "fuel"},
|
{"side", "group:exchangeclone_furnace", "fuel"},
|
||||||
{"bottom", "group:container=4", "src"},
|
{"bottom", "group:exchangeclone_furnace", "src"},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Hoppers will only be able to insert into one side of a double chest, I think (unless you have 1 hopper per side)
|
|
||||||
hopper:add_container({
|
hopper:add_container({
|
||||||
{"top", "group:container=5", "main"},
|
{"top", "group:energy_collector", "main"},
|
||||||
{"bottom", "group:container=5", "main"},
|
{"bottom", "group:energy_collector", "main"},
|
||||||
{"side", "group:container=5", "main"},
|
{"side", "group:energy_collector", "main"},
|
||||||
})
|
})
|
||||||
|
|
||||||
hopper:add_container({
|
hopper:add_container({
|
||||||
{"top", "group:container=6", "main"},
|
{"top", "exchangeclone:emc_link", "output"},
|
||||||
{"bottom", "group:container=6", "main"},
|
{"bottom", "exchangeclone:emc_link", "input"},
|
||||||
{"side", "group:container=6", "main"},
|
{"side", "exchangeclone:emc_link", "input"},
|
||||||
})
|
})
|
|
@ -1,16 +1,5 @@
|
||||||
local S = minetest.get_translator()
|
local S = minetest.get_translator()
|
||||||
|
|
||||||
local function read_star_charge(itemstack, player, pointed_thing)
|
|
||||||
local click_test = exchangeclone.check_on_rightclick(itemstack, player, pointed_thing)
|
|
||||||
if click_test ~= false then
|
|
||||||
return click_test
|
|
||||||
end
|
|
||||||
|
|
||||||
local stored = exchangeclone.get_star_itemstack_emc(itemstack)
|
|
||||||
minetest.chat_send_player(player:get_player_name(), S("Current Charge: @1", exchangeclone.format_number(stored)))
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
local names = {
|
local names = {
|
||||||
"Klein Star Ein",
|
"Klein Star Ein",
|
||||||
"Klein Star Zwei",
|
"Klein Star Zwei",
|
||||||
|
@ -35,8 +24,6 @@ for i, name in ipairs(names) do
|
||||||
description = S(name).."\n"..S("Current Charge: @1/@2", 0, exchangeclone.format_number(capacity)),
|
description = S(name).."\n"..S("Current Charge: @1/@2", 0, exchangeclone.format_number(capacity)),
|
||||||
inventory_image = "exchangeclone_"..codified_name..".png",
|
inventory_image = "exchangeclone_"..codified_name..".png",
|
||||||
wield_image = "exchangeclone_"..codified_name..".png",
|
wield_image = "exchangeclone_"..codified_name..".png",
|
||||||
on_secondary_use = read_star_charge,
|
|
||||||
on_place = read_star_charge,
|
|
||||||
groups = {klein_star = i, disable_repair = 1, fire_immune = 1},
|
groups = {klein_star = i, disable_repair = 1, fire_immune = 1},
|
||||||
max_capacity = capacity,
|
max_capacity = capacity,
|
||||||
_mcl_generate_description = function(itemstack)
|
_mcl_generate_description = function(itemstack)
|
||||||
|
|
Loading…
Reference in New Issue