Another commit
This commit is contained in:
parent
0017430f8f
commit
2e877676f9
15
README.md
15
README.md
|
@ -67,20 +67,21 @@ Dependencies: Minetest Game or MineClone.
|
|||
* [x] Achievements/advancements/awards
|
||||
* [x] Textures/sounds from ProjectE/ProjectExpansion (I wanted this for a while, but I couldn't figure out how to get permission until I saw [this tweet](https://twitter.com/MercuriusXeno/status/1662203934713212932) from the creator of Equivalent Exchange)
|
||||
* [x] Change "energy" to EMC
|
||||
* [ ] Improvements to tools (mostly only in MCL at the moment)
|
||||
* [ ] Improvements to tools (\* = only in MCL at the moment)
|
||||
* [x] Wear bar for charge level
|
||||
* [x] Charge levels match ProjectE (both in number and in range)
|
||||
* [x] Charge level affects speed
|
||||
* [x] Correct/accurate speeds compared to ProjectE (hopefully)
|
||||
* [x] Wear bar on Exchange Orbs for EMC
|
||||
* [x] Charge level affects speed\*
|
||||
* [x] Correct/accurate speeds compared to ProjectE\*
|
||||
* [x] Only one item per tool (not a separate 3x3 tool)
|
||||
* [x] Make Philosopher's Stone only affect the node type you click on (and also not work when not pointed at anything), so clicking on a grass block will only transmute grass blocks in range (not everything else)
|
||||
* [x] Shovels can remove paths (MCL2)
|
||||
* [x] Changes to armor (but it's so hard to get it right)
|
||||
* Unfortunately, due to an [engine bug](https://github.com/minetest/minetest/issues/14344), this means that players are kind of invincible most of the time.
|
||||
* [x] Accurate armor protection\*
|
||||
* Unfortunately, due to an [engine bug](https://github.com/minetest/minetest/issues/14344), this means that players are invincible 90% of the time.
|
||||
* [x] Remove and add alias for DM/RM shields
|
||||
* [ ] Upgrades affect EMC value
|
||||
* [x] Upgrades affect EMC value
|
||||
* [ ] Make tool speeds work in Minetest Game
|
||||
* [x] Multiple levels of Exchange Orbs (change to Klein Stars, adjust recipes)
|
||||
* [x] Wear bar on Klein Stars for EMC
|
||||
* [x] Fuel storage blocks
|
||||
* [ ] Divining rods
|
||||
* [ ] Swiftwolf's Rending Gale (maybe rename?)
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
local S = minetest.get_translator()
|
||||
|
||||
local function get_level(level)
|
||||
if exchangeclone.mcl then
|
||||
return nil
|
||||
else
|
||||
return level
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_craftitem("exchangeclone:alchemical_coal", {
|
||||
description = S("Alchemical Coal"),
|
||||
wield_image = "exchangeclone_alchemical_coal.png",
|
||||
|
@ -34,7 +26,7 @@ minetest.register_node("exchangeclone:alchemical_coal_block", {
|
|||
tiles = {"exchangeclone_alchemical_coal_block.png"},
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, building_block = 1, level = get_level(2)}, --ridiculous workaround
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, building_block = 1, level = exchangeclone.mtg and 2 or 0},
|
||||
_mcl_blast_resistance = 8,
|
||||
_mcl_hardness = 7,
|
||||
})
|
||||
|
@ -44,7 +36,7 @@ minetest.register_node("exchangeclone:mobius_fuel_block", {
|
|||
tiles = {"exchangeclone_mobius_fuel_block.png"},
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, building_block = 1, level = get_level(2)}, --ridiculous workaround
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, building_block = 1, level = exchangeclone.mtg and 2 or 0},
|
||||
_mcl_blast_resistance = 10,
|
||||
_mcl_hardness = 8,
|
||||
})
|
||||
|
@ -54,7 +46,7 @@ minetest.register_node("exchangeclone:aeternalis_fuel_block", {
|
|||
tiles = {"exchangeclone_aeternalis_fuel_block.png"},
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, building_block = 1, level = get_level(2)}, --ridiculous workaround
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, building_block = 1, level = exchangeclone.mtg and 2 or 0},
|
||||
_mcl_blast_resistance = 10,
|
||||
_mcl_hardness = 8,
|
||||
})
|
||||
|
@ -156,7 +148,7 @@ minetest.register_node("exchangeclone:dark_matter_block", {
|
|||
tiles = {"exchangeclone_dark_matter_block.png"},
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, building_block = 1, level = get_level(4)}, --ridiculous workaround
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, building_block = 1, level = exchangeclone.mtg and 4 or 0},
|
||||
_mcl_blast_resistance = 1500,
|
||||
_mcl_hardness = 12,
|
||||
})
|
||||
|
@ -167,7 +159,7 @@ minetest.register_node("exchangeclone:red_matter_block", {
|
|||
is_ground_content = false,
|
||||
light_source = 14,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
groups = {pickaxey=6, material_stone=1, cracky = 3, building_block = 1, level = get_level(5)},
|
||||
groups = {pickaxey=6, material_stone=1, cracky = 3, building_block = 1, level = exchangeclone.mtg and 5 or 0},
|
||||
_mcl_blast_resistance = 1500,
|
||||
_mcl_hardness = 37,
|
||||
})
|
||||
|
|
|
@ -38,15 +38,9 @@ local function deconstructor_action(pos, elapsed)
|
|||
end
|
||||
|
||||
local stack = inv:get_stack("src", 1)
|
||||
local individual_emc_value = exchangeclone.get_item_emc(stack:get_name())
|
||||
local single_item = stack:peek_item(1)
|
||||
local individual_emc_value = exchangeclone.get_item_emc(single_item)
|
||||
if not (individual_emc_value and individual_emc_value > 0) then return end
|
||||
local wear = stack:get_wear()
|
||||
if wear and wear > 0 then
|
||||
individual_emc_value = math.max(math.floor(individual_emc_value * ((65536 - wear)/65536)), 1)
|
||||
end
|
||||
if minetest.get_item_group(stack:get_name(), "klein_star") > 0 then
|
||||
individual_emc_value = individual_emc_value + exchangeclone.get_star_itemstack_emc(stack)
|
||||
end
|
||||
|
||||
local current_emc
|
||||
if using_star then
|
||||
|
@ -57,13 +51,11 @@ local function deconstructor_action(pos, elapsed)
|
|||
local max_count = math.floor((limit - current_emc)/individual_emc_value)
|
||||
local add_count = math.min(max_count, stack:get_count())
|
||||
local emc = individual_emc_value * add_count
|
||||
local result = current_emc + emc
|
||||
if result < 0 or result > limit then return end
|
||||
|
||||
if using_star then
|
||||
exchangeclone.set_star_emc(inv, "fuel", 1, result)
|
||||
exchangeclone.add_star_emc(inv, "fuel", 1, emc)
|
||||
else
|
||||
exchangeclone.set_player_emc(player, result)
|
||||
exchangeclone.add_player_emc(player, emc)
|
||||
end
|
||||
stack:set_count(stack:get_count() - add_count)
|
||||
if stack:get_count() == 0 then stack = ItemStack("") end
|
||||
|
|
|
@ -30,14 +30,6 @@ if exchangeclone.mcl then
|
|||
furnace_itemstring = "mcl_furnaces:furnace"
|
||||
end
|
||||
|
||||
local function get_level(level)
|
||||
if exchangeclone.mcl then
|
||||
return nil
|
||||
else
|
||||
return level
|
||||
end
|
||||
end
|
||||
|
||||
local function is_ore(itemstring)
|
||||
if ores[itemstring] then return true end
|
||||
local exchangeclone_ore = minetest.get_item_group(itemstring, "exchangeclone_ore")
|
||||
|
@ -514,7 +506,7 @@ local inactive_def = {
|
|||
"exchangeclone_dark_matter_furnace.png",
|
||||
},
|
||||
paramtype2 = "4dir",
|
||||
groups = {pickaxey=5, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, material_stone=1, level = get_level(4), exchangeclone_furnace = 1, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=5, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, material_stone=1, level = exchangeclone.mtg and 4 or 0, exchangeclone_furnace = 1, tubedevice = 1, tubedevice_receiver = 1},
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
|
||||
|
@ -589,7 +581,7 @@ local active_def = {
|
|||
parammatter_type = "light",
|
||||
light_source = LIGHT_ACTIVE_FURNACE,
|
||||
drop = "exchangeclone:dark_matter_furnace",
|
||||
groups = {pickaxey=5, not_in_creative_inventory = 1, container = exchangeclone.mcl2 and 2 or 4, material_stone=1, cracky = 3, level = get_level(4), exchangeclone_furnace = 1, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=5, not_in_creative_inventory = 1, container = exchangeclone.mcl2 and 2 or 4, material_stone=1, cracky = 3, level = exchangeclone.mtg and 4 or 0, exchangeclone_furnace = 1, tubedevice = 1, tubedevice_receiver = 1},
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
on_timer = furnace_node_timer,
|
||||
|
@ -664,7 +656,7 @@ minetest.override_item("exchangeclone:red_matter_furnace", {
|
|||
"exchangeclone_red_matter_block.png",
|
||||
"exchangeclone_red_matter_furnace.png",
|
||||
},
|
||||
groups = {pickaxey=6, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, deco_block=1, material_stone=1, level = get_level(5), exchangeclone_furnace = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=6, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, deco_block=1, material_stone=1, level = exchangeclone.mtg and 5 or 0, exchangeclone_furnace = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
_mcl_hardness = 100,
|
||||
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
|
@ -719,7 +711,7 @@ minetest.override_item("exchangeclone:red_matter_furnace_active", {
|
|||
"exchangeclone_red_matter_furnace_active.png",
|
||||
},
|
||||
drop = "exchangeclone:red_matter_furnace",
|
||||
groups = {pickaxey=6, not_in_creative_inventory = 1, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, deco_block=1, material_stone=1, level = get_level(5), exchangeclone_furnace = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=6, not_in_creative_inventory = 1, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, deco_block=1, material_stone=1, level = exchangeclone.mtg and 5 or 0, exchangeclone_furnace = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
_mcl_hardness = 100,
|
||||
|
||||
on_construct = function(pos)
|
||||
|
|
|
@ -81,6 +81,10 @@ local function upgrader_action(pos)
|
|||
local new_tool = exchangeclone.enchant(tool, upgrade_def.enchantment, upgrade_def.level)
|
||||
if not new_tool then return end -- If the tool already has that enchantment
|
||||
|
||||
local new_emc = exchangeclone.get_item_emc(new_tool) + exchangeclone.get_item_emc(upgrade:get_name())
|
||||
|
||||
new_tool:get_meta():set_string("exchangeclone_emc_value", tostring(new_emc))
|
||||
|
||||
inv:set_stack("dst", 1, new_tool)
|
||||
|
||||
tool:set_count(tool:get_count() - 1)
|
||||
|
@ -128,14 +132,6 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
|||
return stack:get_count()
|
||||
end
|
||||
|
||||
local function get_level(level)
|
||||
if exchangeclone.mcl then
|
||||
return nil
|
||||
else
|
||||
return level
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("exchangeclone:upgrader", {
|
||||
description = "Upgrader",
|
||||
tiles = {
|
||||
|
@ -152,7 +148,7 @@ minetest.register_node("exchangeclone:upgrader", {
|
|||
meta:set_string("infotext", "Upgrader")
|
||||
meta:set_string("formspec", upgrader_formspec)
|
||||
end,
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, level = get_level(4), tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, level = exchangeclone.mtg and 4 or 0, tubedevice = 1, tubedevice_receiver = 1},
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
|
|
|
@ -116,6 +116,7 @@ end
|
|||
local function handle_inventory(player, inventory, to_list)
|
||||
local stack = inventory:get_stack(to_list, 1)
|
||||
local itemstring = stack:get_name()
|
||||
local single_item = stack:peek_item(1)
|
||||
itemstring = exchangeclone.emc_aliases[itemstring] or itemstring
|
||||
if to_list == "learn" then
|
||||
local list = minetest.deserialize(player:get_meta():get_string("exchangeclone_transmutation_learned_items")) or {}
|
||||
|
@ -133,22 +134,16 @@ local function handle_inventory(player, inventory, to_list)
|
|||
player:get_meta():set_string("exchangeclone_transmutation_learned_items", minetest.serialize(list))
|
||||
inventory:set_stack(to_list, 1, nil)
|
||||
else
|
||||
local individual_emc_value = exchangeclone.get_item_emc(itemstring)
|
||||
local individual_emc_value = exchangeclone.get_item_emc(single_item)
|
||||
if not individual_emc_value or individual_emc_value <= 0 then return end
|
||||
local wear = stack:get_wear()
|
||||
if wear and wear > 1 then
|
||||
individual_emc_value = math.max(math.floor(individual_emc_value * ((65536 - wear)/65536)), 1)
|
||||
end
|
||||
if minetest.get_item_group(itemstring, "klein_star") > 0 then
|
||||
individual_emc_value = individual_emc_value + exchangeclone.get_star_itemstack_emc(stack)
|
||||
end
|
||||
local player_emc = exchangeclone.get_player_emc(player)
|
||||
-- How many items can be added?
|
||||
local max_count = math.floor((exchangeclone.limit - player_emc)/individual_emc_value)
|
||||
-- How many items will be added?
|
||||
local add_count = math.min(max_count, stack:get_count())
|
||||
-- How much EMC is that?
|
||||
local emc_value = individual_emc_value * add_count
|
||||
local result = player_emc + emc_value
|
||||
if result < 0 or result > exchangeclone.limit then return end
|
||||
exchangeclone.set_player_emc(player, result)
|
||||
exchangeclone.add_player_emc(player, emc_value)
|
||||
local item_index = table.indexof(list, itemstring)
|
||||
if item_index == -1 then
|
||||
list[#list+1] = itemstring
|
||||
|
@ -167,8 +162,8 @@ local function handle_inventory(player, inventory, to_list)
|
|||
local star_emc = exchangeclone.get_star_itemstack_emc(stack)
|
||||
local charge_amount = math.min(exchangeclone.get_star_max(stack) - star_emc, player_emc)
|
||||
if charge_amount > 0 then
|
||||
exchangeclone.add_player_emc(player, 0-charge_amount)
|
||||
exchangeclone.set_star_emc(inventory, to_list, 1, star_emc + charge_amount)
|
||||
exchangeclone.add_player_emc(player, -charge_amount)
|
||||
exchangeclone.add_star_emc(inventory, to_list, 1, charge_amount)
|
||||
exchangeclone.show_transmutation_table_formspec(player)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -67,15 +67,18 @@ function exchangeclone.get_item_emc(item)
|
|||
end
|
||||
return cheapest
|
||||
end
|
||||
|
||||
if type(item) == "userdata" then
|
||||
minetest.log("thingithingi")
|
||||
local meta_emc_value = tonumber(item:get_meta():get_string("exchangeclone_emc_value"))
|
||||
if meta_emc_value then minetest.log(dump(meta_emc_value)) return math.max(0, meta_emc_value) end
|
||||
end
|
||||
|
||||
-- handle items/itemstacks
|
||||
item = ItemStack(item)
|
||||
if item == ItemStack("") then return end
|
||||
item:set_name(exchangeclone.handle_alias(item))
|
||||
local meta_emc_value = tonumber(item:get_meta():get_string("exchangeclone_emc_value"))
|
||||
if meta_emc_value then
|
||||
if meta_emc_value < 0 then return 0 end
|
||||
if meta_emc_value > 0 then return meta_emc_value end
|
||||
end
|
||||
|
||||
local def = minetest.registered_items[item:get_name()]
|
||||
if not def then return end
|
||||
if minetest.get_item_group(item:get_name(), "klein_star") > 0 then
|
||||
|
@ -137,6 +140,26 @@ function exchangeclone.set_star_emc(inventory, listname, index, amount)
|
|||
inventory:set_stack(listname, index, new_stack)
|
||||
end
|
||||
|
||||
function exchangeclone.add_star_itemstack_emc(itemstack, amount)
|
||||
if itemstack and amount then
|
||||
local emc = exchangeclone.get_star_itemstack_emc(itemstack) + amount
|
||||
minetest.log(dump(emc))
|
||||
if not emc or emc < 0 or emc > exchangeclone.get_star_max(itemstack) then return end
|
||||
return exchangeclone.set_star_itemstack_emc(itemstack, emc)
|
||||
end
|
||||
end
|
||||
|
||||
-- Adds to the amount of EMC in a star in a specific inventory slot
|
||||
function exchangeclone.add_star_emc(inventory, listname, index, amount)
|
||||
if not inventory or not amount or amount < 0 then return end
|
||||
if not listname then listname = "main" end
|
||||
if not index then index = 1 end
|
||||
local itemstack = inventory:get_stack(listname, index)
|
||||
local new_stack = exchangeclone.add_star_itemstack_emc(itemstack, amount)
|
||||
if not new_stack then return end
|
||||
inventory:set_stack(listname, index, new_stack)
|
||||
end
|
||||
|
||||
function exchangeclone.get_star_max(item)
|
||||
item = ItemStack(item)
|
||||
return item:get_definition().max_capacity or 0
|
||||
|
|
Loading…
Reference in New Issue