Still doin that thing

This commit is contained in:
ThePython 2023-10-03 17:08:07 -07:00
parent 5e9ca823af
commit c71e07eef4
15 changed files with 342 additions and 143 deletions

81
.luacheckrc Normal file
View File

@ -0,0 +1,81 @@
read_globals = {
"DIR_DELIM", "INIT",
"minetest", "core",
"dump", "dump2",
"mcl_weather",
"mesecon",
"mcl_worlds",
"mcl_sounds",
"mcl_burning",
"mcl_util",
"mcl_formspec",
"mcl_item_id",
"mcl_enchanting",
"mcl_hunger",
"mcl_stairs",
"mcl_playerinfo",
"playerphysics",
"mcl_armor",
"armor",
"mcl_enchanting",
"mcl_damage",
"mcl_autogroup",
"mcl_experience",
"mcl_mobs",
"mcl_craftguide",
"awards",
"mcl_particles",
"screwdriver",
"mcl_crafting_table",
"Raycast",
"Settings",
"PseudoRandom",
"PerlinNoise",
"VoxelManip",
"SecureRandom",
"VoxelArea",
"PerlinNoiseMap",
"PcgRandom",
"ItemStack",
"AreaStore",
"vector",
table = {
fields = {
"copy",
"indexof",
"insert_all",
"key_value_swap",
"shuffle",
}
},
string = {
fields = {
"split",
"trim",
}
},
math = {
fields = {
"hypot",
"sign",
"factorial"
}
},
}
globals = {
"why",
"default",
"mcl_buckets",
"bucket",
"mcl_vars",
"mcl_potions",
"mcl_bamboo",
"exchangeclone",
}

View File

@ -38,6 +38,7 @@ If you have a suggestion or notice a bug, visit the [GitHub issues page](https:/
* Alchemical Coal, Mobius Fuel, and Aeternalis Fuel: modified versions of MineClone's coal texture (CC-BY-SA-3.0).
* Dark and Red Matter Armor (and eventually Gem Armor): modified versions of diamond armor from 3D Armor (CC-BY-SA-3.0) and `mcl_armor` (CC-BY-SA-3.0).
* All other textures (and sounds): Created by me, inspired by Equivalent Exchange and licensed under CC-BY-SA-3.0.
<details><summary><h1>Changelog:</h1></summary>
# Changelog:
### 1.0.0
@ -175,53 +176,31 @@ If you have a suggestion or notice a bug, visit the [GitHub issues page](https:/
* New Features
* Mineclonia Support
### 5.0 (another *huge* release)
### 5.0 (the new most insteresting release so far)
* New features:
* Transmutation Table(t)
* A much better (and cheaper) way to manage energy than the Constructor and Deconstructor.
* Teach items to the table by putting them in the Learn slot.
* Recreate learned items by clicking on them, then the "+1," "+5," "+10," and "+Stack" buttons to add them to the Output slots of the Table(t)
* The Table(t) will not show items that cost more energy than the player has.
* Charge orbs by putting them in the Charge slot.
* The Transmutation Tablet is the portable version of the Transmutation Table, and does exactly the same thing.
* All data (learned items, stored energy, etc.) is stored with the player, and will not be lost upon death or breaking/destroying the Transmutation Table(t).
* Mod developers can now add energy values to their own mods! Just set `exchangeclone_custom_energy` in the item/node definition.
* Alchemical Tome
* Feed this item to a Transmutation Table to teach it *all items* with energy. The Tome will NOT turn into energy, and will be completely lost.
* This is mostly so you can't just use it, then make a new one for no real cost and give it to someone else.
* Dark/Red Matter Furnaces
* Much faster than normal furnaces
* The Dark Matter Furnace has a 50% chance to duplicate when smelting ores (raw or otherwise).
* The Red Matter Furnace ALWAYS duplicates ores.
* Can be powered by placing next to an Energy Collector.
* Personal Energy Link
* An item copied from Project Expansion
* Allows you to use hoppers to get items into/out of your Personal Energy (MineClone)
* Upgraded Energy Collectors
* Energy Collector MK1, MK2, MK3, MK4, and MK5
* By default, collected energy is sent to the player's personal energy.
* If an orb is inside an Energy Collector, energy will be stored in the orb instead.
* If it's near a DM/RM Furnace, any Energy Collector will power it instead of the orb or personal energy
* Added a [wiki](https://github.com/ThePython10110/ExchangeClone/wiki)! This is where you can find more complete information on pretty much everything.
* Because the wiki exists, I won't be including anywhere near as many details about how features work in the changelog.
* Added the Transmutation Table(t): Much better than the constructor/deconstructor.
* Alchemical Tome: Instantly teaches every item with an energy value to the Transmutation Table(t).
* Dark/Red Matter Furnaces: Can be powered by Energy Collectors, much faster, and sometimes double ores.
* Personal Energy Link: Allows you to use hoppers to get items into/out of your Personal Energy (MineClone)
* Upgraded Energy Collectors: Now MK1-MK5. They use personal energy unless they have an orb.
* The ability to upgrade dark/red matter tools to give them fortune, looting, fire aspect, and silk touch
* The ability to upgrade dark/red matter armor to give it thorns and frost walker
* Mind, Life, Body, and Soul Stones
* Custom Energy Values
* Mod developers can now set their own energy values by setting `exchangeclone_custom_energy` in the item/node definition.
* Added a [wiki](https://github.com/ThePython10110/ExchangeClone/wiki)!
* Mod developers can now set their own energy values by setting `exchangeclone_custom_energy` in the item/node definition.
* Changes
* Energy for Dark/Red Matter tool abilities (as well as the Transmutation Table) is no longer stored in an orb, but inside the player.
* The amount of energy you currently have stored is visible in the top right of the screen.
* Because of this, the PESA is now useless and deprecated. It will be removed after a few releases (so probably a couple months at least). Remove any Exchange Orbs from your personal storage.
* A lot of items (including DM/RM tools and armor) will not burn in lava in MineClone2.
* Energy Collectors now send their energy to the placer's personal energy by default.
* Placing an orb into an Energy Collector causes energy to go into the orb instead.
* If the Collector is near a DM/RM Furnace, all energy will be used to fuel the furnace.
* Red Matter Armor now sets your maximum health to 200 instead of 2000
* Energy Collectors now require less light to work (15->14)
* Red Matter Armor now sets your maximum health to 200 instead of 2000
* Exchange Orbs are now 18x better as fuel than they used to be
* DM/RM Shovels will now only create paths on blocks below air.
* Bugfixes:
* I must have skipped a row while going through MineClone's mod list. Several mods starting with `mcl_b` or `mcl_c` have been added to the whitelist.
* Fixed right-clicking with an orb not showing charge
* Removed unnecessary tool repair recipes from dark/red matter tools/armor
* Fixed a couple of armor texture issues in Minetest Game (though it still looks like diamond armor; 3D Armor doesn't support texture modifiers)
* The Red Katar is now actually craftable in Minetest Game (I just forgot that shears were only in MCL2)
@ -237,8 +216,10 @@ If you have a suggestion or notice a bug, visit the [GitHub issues page](https:/
* Rings (I'll probably add a new PESA-like item for holding rings)
* Archangel's Smite (though arrows will not track targets)
* Ring of Ignition
* Swiftwolf's Rending Gale (but without the force field)
* Zero Ring
* Swiftwolf's Rending Gale (but without the force field; basically Why's Flying Sausage with a different texture)
* Harvest Band?
* Ring of Arcana (possibly without the Harvest Band)
* Gem Armor
* Gem Armor
</details>

View File

@ -7,7 +7,7 @@ local blocked_damage_types = {
}
local function get_armor_texture(type, matter, preview)
local modifier = ""
local modifier
-- hsl only works in 5.8 which hasn't been released yet
if matter == "dark" then
modifier = "^[multiply:#222222"
@ -91,7 +91,7 @@ if exchangeclone.mcl then
mcl_armor.register_set({
name = "dark_matter",
description = "Dark Matter",
descriptions = {
descriptions = exchangeclone.mineclonia and {
head = "Dark Matter Helmet",
torso = "Dark Matter Chestplate",
legs = "Dark Matter Leggings",
@ -119,7 +119,7 @@ if exchangeclone.mcl then
mcl_armor.register_set({
name = "red_matter",
description = "Red Matter",
descriptions = {
descriptions = exchangeclone.mineclonia and {
head = "Red Matter Helmet",
torso = "Red Matter Chestplate",
legs = "Red Matter Leggings",
@ -271,7 +271,7 @@ else
armor:register_on_equip(function(player, index, stack)
exchangeclone.check_armor_health(player)
end)
armor:register_on_unequip(function(player, index, stack)
exchangeclone.check_armor_health(player)
end)

View File

@ -35,26 +35,25 @@ end
local function on_timer(pos, elapsed)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
-- get node above
pos.y = pos.y + 1
if meta:get_int("connected_to_furnace") == 1 then
-- do nothing, energy is being used for the furnace.
return
end
local above = vector.add({x=0,y=1,z=0}, pos)
local using_orb = true
if inv:is_empty("main") then
using_orb = false
end
if minetest.get_natural_light(pos) == 15 then
if minetest.get_natural_light(above) >= 14 then
meta:set_int("has_light", 1)
if meta:get_int("connected_to_furnace") == 1 then
-- do nothing, energy is being used for the furnace.
return
end
local amount = meta:get_int("collector_amount")
if using_orb then
local dest_orb = inv:get_stack("main", 1)
local stored = exchangeclone.get_orb_energy(inv, "main", 1)
if stored + amount < exchangeclone.energy_max then
stored = stored + amount
@ -88,8 +87,6 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == "main" then
if stack:get_name() == "exchangeclone:exchange_orb" then
return stack:get_count()
@ -118,7 +115,7 @@ local function on_blast(pos)
exchangeclone.get_inventory_drops(pos, "main", drops)
drops[#drops+1] = "exchangeclone:energy_collector"
minetest.remove_node(pos)
return drops
end
@ -141,7 +138,7 @@ end
function exchangeclone.register_energy_collector(itemstring, name, amount, modifier, recipe)
minetest.register_node(itemstring, {
description = "Energy Collector",
description = name,
tiles = {
"exchangeclone_energy_collector_up.png"..modifier,
"exchangeclone_energy_collector_down.png"..modifier,
@ -150,7 +147,7 @@ function exchangeclone.register_energy_collector(itemstring, name, amount, modif
"exchangeclone_energy_collector_right.png"..modifier,
"exchangeclone_energy_collector_right.png"..modifier
},
groups = {cracky = 2, container = 2, pickaxey = 2, energy_collector = 1},
groups = {cracky = 2, container = 2, pickaxey = 2, energy_collector = amount},
_mcl_hardness = 3,
_mcl_blast_resistance = 6,
sounds = exchangeclone.sound_mod.node_sound_metal_defaults(),
@ -212,21 +209,57 @@ end
})
end]]
local recipe_item_1 = "default:steelblock"
local recipe_item_2 = "default:obsidian_glass"
local recipe_item_3 = "default:chest"
local iron = "default:steelblock"
local glass = "default:glass"
local chest = "default:chest"
if exchangeclone.mcl then
recipe_item_1 = "mcl_core:ironblock"
recipe_item_2 = "mcl_core:glass"
recipe_item_3 = "mcl_chests:chest"
iron = "mcl_core:ironblock"
glass = "mcl_core:glass"
chest = "mcl_chests:chest"
end
exchangeclone.register_energy_collector("exchangeclone:energy_collector", "Energy Collector MK1", 4, "", {
output = "exchangeclone:energy_collector",
recipe = {
{recipe_item_2, recipe_item_2, recipe_item_2},
{"exchangeclone:exchange_orb", recipe_item_3, "exchangeclone:exchange_orb"},
{recipe_item_1, recipe_item_1, recipe_item_1}
{glass, glass, glass},
{"exchangeclone:exchange_orb", chest, "exchangeclone:exchange_orb"},
{iron, iron, iron}
}
})
exchangeclone.register_energy_collector("exchangeclone:energy_collector_mk2", "Energy Collector MK2", 12, "^[multiply:#555555", {
output = "exchangeclone:energy_collector_mk2",
recipe = {
{iron, iron, iron},
{"exchangeclone:energy_collector", "exchangeclone:energy_collector", "exchangeclone:energy_collector"},
{iron, iron, iron}
}
})
exchangeclone.register_energy_collector("exchangeclone:energy_collector_mk3", "Energy Collector MK3", 40, "^[multiply:#770000", {
output = "exchangeclone:energy_collector_mk3",
recipe = {
{iron, iron, iron},
{"exchangeclone:energy_collector_mk2", "exchangeclone:energy_collector_mk2", "exchangeclone:energy_collector_mk2"},
{iron, iron, iron}
}
})
exchangeclone.register_energy_collector("exchangeclone:energy_collector_mk4", "Energy Collector MK4", 160, "^[multiply:#000077", {
output = "exchangeclone:energy_collector_mk4",
recipe = {
{iron, iron, iron},
{"exchangeclone:energy_collector_mk3", "exchangeclone:energy_collector_mk3", "exchangeclone:energy_collector_mk3"},
{iron, iron, iron}
}
})
exchangeclone.register_energy_collector("exchangeclone:energy_collector_mk5", "Energy Collector MK5", 640, "^[brighten", {
output = "exchangeclone:energy_collector_mk5",
recipe = {
{iron, iron, iron},
{"exchangeclone:energy_collector_mk4", "exchangeclone:energy_collector_mk4", "exchangeclone:energy_collector_mk4"},
{iron, iron, iron}
}
})

View File

@ -6,12 +6,12 @@ local ores = {
}
local furnace_itemstring = "default:furnace"
if exchangeclone.mineclone then
if exchangeclone.mcl then
furnace_itemstring = "mcl_furnaces:furnace"
end
local function get_level(level)
if exchangeclone.mineclone then
if exchangeclone.mcl then
return nil
else
return level
@ -33,7 +33,7 @@ local LIGHT_ACTIVE_FURNACE = 13
-- Formspecs
--
local base_formspec =
local base_formspec =
-- Craft guide button temporarily removed due to Minetest bug.
-- TODO: Add it back when the Minetest bug is fixed.
--"image_button[8,0;1,1;craftguide_book.png;craftguide;]"..
@ -42,7 +42,7 @@ local base_formspec =
"label[0,4;Inventory]"..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"..
"list[context;src;2.75,0.5;1,1;]"..
"list[context;src;2.75,0.5;1,1]"..
"list[context;fuel;2.75,2.5;1,1;]"..
"list[context;dst;5.75,1.5;1,1;]"..
"listring[context;dst]"..
@ -52,7 +52,7 @@ local base_formspec =
"listring[context;fuel]"..
"listring[current_player;main]"
if exchangeclone.mineclone then
if exchangeclone.mcl then
base_formspec = base_formspec..
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
@ -61,19 +61,23 @@ if exchangeclone.mineclone then
mcl_formspec.get_itemslot_bg(5.75,1.5,1,1)
end
local function inactive_formspec(type)
local function inactive_formspec(type)
local num_columns = (type == "Dark" and 2) or 3
return base_formspec..
"list[context;src;0,1;"..tostring(num_columns)..",3;2]"..
"label[2.75,0;"..type.." Matter Furnace]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
"image[4.1,1.5;1.5,1;gui_furnace_arrow_bg.png^[transformR270]"
end
local function active_formspec(fuel_percent, item_percent, type)
local num_columns = (type == "Dark" and 2) or 3
return base_formspec..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
"list[context;src;0,1;"..tostring(num_columns)..",3;2]"..
"image[4.1,1.5;1.5,1;gui_furnace_arrow_bg.png^[lowpart:"..
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
"label[2.75,0;"..type.." Matter Furnace]"
end
@ -164,12 +168,6 @@ local function on_metadata_inventory_take(pos, listname, index, stack, player)
end
end
local function on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
if from_list == "dst" then
--give_xp(pos, player)
end
end
local function spawn_flames(pos, param2)
local minrelpos, maxrelpos
local dir = minetest.facedir_to_dir(param2)
@ -281,19 +279,37 @@ local check_positions = {
local function check_for_collector(pos, set_furnace)
local collector_found = false
for _, check_pos in ipairs(check_positions) do
minetest.log(dump(vector.add(pos, check_pos)))
local check_node = minetest.get_node(vector.add(pos, check_pos))
minetest.log(minetest.get_meta(check_pos):get_int("has_light"))
if minetest.get_item_group(check_node.name, "energy_collector") > 0
and minetest.get_meta(check_pos):get_int("has_light") > 0 then
collector_found = true
if minetest.get_item_group(check_node.name, "energy_collector") > 0 then
minetest.log(minetest.get_meta(check_pos):get_int("has_light"))
if set_furnace ~= nil then
minetest.get_meta(check_pos):set_int("connected_to_furnace", set_furnace)
end
if minetest.get_meta(check_pos):get_int("has_light") > 0 then
collector_found = true
end
end
end
return collector_found
end
local function check_srclist(pos)
local meta = minetest:get_meta(pos)
local inv = meta:get_inventory()
if not inv:get_stack("src", 1):is_empty() then
return
end
for i=2,inv:get_size("src") do
local stack = inv:get_stack("src", i)
if not stack:is_empty() then
inv:set_stack("src", 1, stack)
inv:set_stack("src", i, ItemStack(""))
return
end
end
end
local function furnace_node_timer(pos, elapsed)
--
-- Inizialize metadata
@ -312,6 +328,8 @@ local function furnace_node_timer(pos, elapsed)
local active = true
local fuel
local using_collector = check_for_collector(pos, 1)
local type = "Dark"
local speed = 22 -- /10 to get items/second
if minetest.get_node(pos).name:find("red_matter") then
@ -340,7 +358,7 @@ local function furnace_node_timer(pos, elapsed)
-- Check if we have cookable content: cookable
local aftercooked
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = {srclist[1]}})
cookable = cooked.item ~= ItemStack("") --minetest.get_item_group(inv:get_stack("src", 1):get_name(), "furnace_smeltable") == 1
if cookable then
-- Successful cooking requires space in dst slot and time
@ -353,8 +371,6 @@ local function furnace_node_timer(pos, elapsed)
el = math.min(el, cooked.time - src_time)
end
local using_collector = check_for_collector(pos, 1)
-- Check if we have enough fuel to burn
active = (fuel_time < fuel_totaltime) or (using_collector and cooked.item ~= ItemStack(""))
minetest.log(dump({using_collector, cooked.item}))
@ -413,7 +429,10 @@ local function furnace_node_timer(pos, elapsed)
fuel_totaltime = fuel.time * 5.5
end
if srclist and srclist[1]:is_empty() then
src_time = 0
check_srclist(pos)
if srclist and srclist[1]:is_empty() then
src_time = 0
end
end
--
@ -474,10 +493,15 @@ end
local inactive_def = {
description = "Dark Matter Furnace",
tiles = {
"exchangeclone_dark_matter_block.png"
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_furnace.png",
},
paramtype2 = "facedir",
groups = {pickaxey=5, cracky = 3, container=4, deco_block=1, material_stone=1, level = get_level(4)},
groups = {pickaxey=5, cracky = 3, container=4, material_stone=1, level = get_level(4)},
is_ground_content = false,
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
@ -488,10 +512,20 @@ local inactive_def = {
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for _, listname in ipairs({"src", "dst", "fuel"}) do
local stack = inv:get_stack(listname, 1)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
if listname == "src" then
for i = 1,7 do
local stack = inv:get_stack(listname, i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
else
local stack = inv:get_stack(listname, 1)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
end
meta:from_table(meta2)
@ -500,8 +534,9 @@ local inactive_def = {
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", inactive_formspec("Dark"))
check_for_collector(pos, 1)
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("src", 7)
inv:set_size("fuel", 1)
inv:set_size("dst", 1)
end,
@ -514,9 +549,6 @@ local inactive_def = {
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
-- Reset accumulated game time when player works with furnace:
furnace_reset_delta_time(pos)
minetest.get_node_timer(pos):start(0.45)
on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
end,
on_metadata_inventory_put = function(pos)
-- Reset accumulated game time when player works with furnace:
@ -546,6 +578,11 @@ local active_def = {
description = "Active Dark Matter Furnace",
tiles = {
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_block.png",
"exchangeclone_dark_matter_furnace.png",
},
paramtype2 = "facedir",
paramtype = "light",
@ -558,17 +595,27 @@ local active_def = {
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta
local meta2 = meta:to_table()
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for _, listname in ipairs({"src", "dst", "fuel"}) do
local stack = inv:get_stack(listname, 1)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
if listname == "src" then
for i = 1,7 do
local stack = inv:get_stack(listname, i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
else
local stack = inv:get_stack(listname, 1)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
end
meta:from_table(meta2:to_table())
meta:from_table(meta2)
end,
on_construct = function(pos)
@ -584,7 +631,6 @@ local active_def = {
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
on_metadata_inventory_move = on_metadata_inventory_move,
on_metadata_inventory_take = on_metadata_inventory_take,
on_receive_fields = receive_fields,
_mcl_blast_resistance = 1500,
@ -601,7 +647,12 @@ minetest.register_node("exchangeclone:red_matter_furnace_active", table.copy(act
minetest.override_item("exchangeclone:red_matter_furnace", {
description = "Red Matter Furnace",
tiles = {
"exchangeclone_red_matter_block.png"
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_furnace.png",
},
groups = {pickaxey=5, cracky = 3, container=4, deco_block=1, material_stone=1, level = get_level(5)},
_mcl_hardness = 100,
@ -610,8 +661,6 @@ minetest.override_item("exchangeclone:red_matter_furnace", {
-- Reset accumulated game time when player works with furnace:
furnace_reset_delta_time(pos)
minetest.get_node_timer(pos):start(0.16)
on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
end,
on_metadata_inventory_put = function(pos)
-- Reset accumulated game time when player works with furnace:
@ -632,29 +681,93 @@ minetest.override_item("exchangeclone:red_matter_furnace", {
local meta = minetest.get_meta(pos)
meta:set_string("formspec", inactive_formspec("Red"))
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("src", 10)
inv:set_size("fuel", 1)
inv:set_size("dst", 1)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta:to_table()
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for _, listname in ipairs({"src", "dst", "fuel"}) do
if listname == "src" then
for i = 1,10 do
local stack = inv:get_stack(listname, i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
else
local stack = inv:get_stack(listname, 1)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
end
meta:from_table(meta2)
end,
})
minetest.override_item("exchangeclone:red_matter_furnace_active", {
description = "Active Red Matter Furnace",
tiles = {
"exchangeclone_red_matter_block.png"
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_block.png",
"exchangeclone_red_matter_furnace.png",
},
drop = "exchangeclone:red_matter_furnace",
groups = {pickaxey=5, cracky = 3, container=4, deco_block=1, material_stone=1, level = get_level(5)},
_mcl_hardness = 100,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", inactive_formspec("Red"))
local inv = meta:get_inventory()
inv:set_size("src", 10)
inv:set_size("fuel", 1)
inv:set_size("dst", 1)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
local meta2 = meta:to_table()
meta:from_table(oldmetadata)
local inv = meta:get_inventory()
for _, listname in ipairs({"src", "dst", "fuel"}) do
if listname == "src" then
for i = 1,10 do
local stack = inv:get_stack(listname, i)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
else
local stack = inv:get_stack(listname, 1)
if not stack:is_empty() then
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
minetest.add_item(p, stack)
end
end
end
meta:from_table(meta2)
end,
})
minetest.register_craft({
output = "exchangeclone:dark_matter_furnace",
recipe = {
{ "exchangeclone:dark_matter_block", "exchangeclone:dark_matter_block", "exchangeclone:dark_matter_block" },
{ "exchangeclone:dark_matter_block", "mcl_core:furnace", "exchangeclone:dark_matter_block" },
{ "exchangeclone:dark_matter_block", furnace_itemstring, "exchangeclone:dark_matter_block" },
{ "exchangeclone:dark_matter_block", "exchangeclone:dark_matter_block", "exchangeclone:dark_matter_block" },
}
})

View File

@ -40,5 +40,5 @@ dofile(modpath.."/red_matter_multitools.lua")
dofile(modpath.."/philosophers_stone.lua")
dofile(modpath.."/pesa.lua")
dofile(modpath.."/transmutation_table.lua")
dofile(default_path.."/furnaces.lua")
dofile(modpath.."/furnaces.lua")
dofile(modpath.."/energy.lua")

View File

@ -134,7 +134,7 @@ function exchangeclone.get_group_items(groups, allow_duplicates, include_no_grou
if include_no_group then
result["NO_GROUP"] = {}
end
local in_group = false
local in_group
for name, def in pairs(minetest.registered_items) do
in_group = false
@ -222,8 +222,8 @@ local function get_fortune_drops(fortune_drops, fortune_level)
end
function exchangeclone.inventory_formspec(x,y)
local formspec = ""
if why.mineclone then
local formspec
if exchangeclone.mcl then
formspec = "list[current_player;main;"..tostring(x)..","..tostring(y)..";9,3;9]"..
mcl_formspec.get_itemslot_bg(x,y,9,3)..
"list[current_player;main;"..tostring(x)..","..tostring(y+3.25)..";9,1]"..

View File

@ -3,8 +3,8 @@ local function read_orb_charge(itemstack, player, pointed_thing)
if click_test ~= false then
return click_test
end
local stored = itemstack:get_meta():get_float("stored_charge") or 0
local stored = exchangeclone.get_orb_itemstack_energy(itemstack)
minetest.chat_send_player(player:get_player_name(), "Current Charge: "..stored)
return itemstack
end

View File

@ -5,13 +5,13 @@ local function show_enchanting(player)
mcl_enchanting.show_enchanting_formspec(player)
end
local width = (exchangeclone.mineclone and 9) or 8
local width = (exchangeclone.mcl and 9) or 8
local smelting_formspec =
"size["..width..",8]"..
"label[0.25,0.25;Smelting]"..
"label["..(width/3)..",0.75;Input]"..
"list[current_player;exchangeclone_smelting_input;"..(width/3)..",1;1,1]"..
"label["..(width/3)..",2.25;Coal"..((exchangeclone.mineclone and "/charcoal]") or "]")..
"label["..(width/3)..",2.25;Coal"..((exchangeclone.mcl and "/charcoal]") or "]")..
"list[current_player;exchangeclone_smelting_fuel;"..(width/3)..",2.5;1,1]"..
"label["..(2*width/3)..",0.75;Output]"..
"list[current_player;exchangeclone_smelting_output;"..(2*width/3)..",1.5;1,1]"..
@ -24,7 +24,7 @@ local smelting_formspec =
"listring[current_player;exchangeclone_smelting_fuel]"..
"listring[current_player;main]"
if exchangeclone.mineclone then
if exchangeclone.mcl then
smelting_formspec = smelting_formspec..
mcl_formspec.get_itemslot_bg(width/3,1,1,1)..
mcl_formspec.get_itemslot_bg(width/3,2.5,1,1)..
@ -312,7 +312,7 @@ minetest.register_on_player_inventory_action(function(player, action, inventory,
or info.listname == "exchangeclone_smelting_fuel" then
set_smelting_output(player)
elseif info.listname == "exchangeclone_smelting_output" then
-- TODO
end
end
end)
@ -369,7 +369,7 @@ if exchangeclone.mcl then
usagehelp = usagehelp..extra_stuff
end
--[[ Could NOT figure out how to make this work.
--[[ Could NOT figure out how to make this work.
for name, def in pairs(minetest.registered_nodes) do
local result, _ = minetest.get_craft_result({

View File

@ -1,5 +1,3 @@
local multidig = {}
function exchangeclone.mine_vein(player, player_energy, start_pos, node_name, pos)
-- Not very efficient, but it SHOULD work.
if not player then return 0 end
@ -85,7 +83,7 @@ end
for name, def in pairs(minetest.registered_nodes) do
if name:find("_ore") or name:find("stone_with") or name:find("deepslate_with")
or name:find("diorite_with") or name:find("andesite_with") or name:find("granite_with")
or name:find("tuff_with") or (name == "mcl_blackstone:nether_gold") then
or name:find("tuff_with") or (name == "mcl_blackstone:nether_gold") or (name == "mcl_nether:ancient_debris") then
local groups = table.copy(def.groups)
groups.exchangeclone_ore = 1
minetest.override_item(name, {groups = groups})

View File

@ -45,7 +45,7 @@ local katar_on_use = function(itemstack, player, pointed_thing)
else
local damage_all = itemstack:get_meta():get_int("exchangeclone_damage_all")
exchangeclone.aoe_attack{max_damage = 2}
if not damage_all == 0 then damage_all = 1 end
if damage_all ~= 0 then damage_all = 1 end
if player:get_player_control().sneak then
if damage_all == 0 then
damage_all = 1
@ -108,7 +108,7 @@ minetest.register_craft({
"exchangeclone:red_matter_sword",
"exchangeclone:red_matter_axe",
"group:red_matter_hoe",
(exchangeclone.mineclone and "exchangeclone:red_matter_shears") or "exchangeclone:red_matter",
(exchangeclone.mcl and "exchangeclone:red_matter_shears") or "exchangeclone:red_matter",
"exchangeclone:red_matter",
"exchangeclone:red_matter",
"exchangeclone:red_matter",
@ -171,7 +171,6 @@ local function morningstar_on_use(itemstack, player, pointed_thing)
local center = player:get_pos()
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
center = pointed_thing.under
if player:get_player_control().sneak then
exchangeclone.node_radius_action(player, center, range, exchangeclone.morningstar_action)

View File

@ -239,7 +239,6 @@ end
local old_honey_harvest = minetest.registered_items["mcl_beehives:bee_nest_5"].on_rightclick
for _, itemstring in ipairs({"mcl_beehives:bee_nest_5", "mcl_beehives:beehive_5"}) do
minetest.registered_items[itemstring].on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local inv = player:get_inventory()
local held_name = player:get_wielded_item():get_name()
local shears = special_shears[held_name]
local beehive = "mcl_beehives:beehive"
@ -271,14 +270,10 @@ local new_dispenser_function = function(pos, node)
dropdir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
droppos = vector.add(pos, dropdir)
elseif node.name == "mcl_dispensers:dispenser_up" then
dropdir = {x=0, y=1, z=0}
droppos = {x=pos.x, y=pos.y+1, z=pos.z}
elseif node.name == "mcl_dispensers:dispenser_down" then
dropdir = {x=0, y=-1, z=0}
droppos = {x=pos.x, y=pos.y-1, z=pos.z}
end
local dropnode = minetest.get_node(droppos)
local dropnodedef = minetest.registered_nodes[dropnode.name]
local stacks = {}
for i=1,inv:get_size("main") do
local stack = inv:get_stack("main", i)
@ -299,27 +294,26 @@ local new_dispenser_function = function(pos, node)
end
local iname = stack:get_name()
local igroups = stackdef.groups
if special_shears[iname] then
for _, obj in pairs(minetest.get_objects_inside_radius(droppos, 1)) do
local entity = obj:get_luaentity()
if entity and not entity.child and not entity.gotten then
local entname = entity.name
local pos = obj:get_pos()
local entity_pos = obj:get_pos()
local used = false
local texture
if entname == "mobs_mc:sheep" then
local max_wool = 8
if iname == "exchangeclone:red_matter_shears" or iname == "exchangeclone:red_katar" then max_wool = 12 end
minetest.add_item(pos, entity.drops[2].name.." "..math.random(1,max_wool)) --normally 3
minetest.add_item(entity_pos, entity.drops[2].name.." "..math.random(1,max_wool)) --normally 3
if not entity.color then
entity.color = "unicolor_white"
end
local chance = 30 --percent
if iname == "exchangeclone:red_matter_shears" or iname == "exchangeclone:red_katar" then chance = 60 end
if math.random(1, 100) <= chance then
local new_sheep = minetest.add_entity(pos, "mobs_mc:sheep"):get_luaentity() --clone the sheep
local new_sheep = minetest.add_entity(entity_pos, "mobs_mc:sheep"):get_luaentity() --clone the sheep
for attribute, value in pairs(entity) do
if attribute ~= "object" then
new_sheep[attribute] = value
@ -358,7 +352,7 @@ local new_dispenser_function = function(pos, node)
local chance = 30 --percent
if iname == "exchangeclone:red_matter_shears" or iname == "exchangeclone:red_katar" then chance = 60 end
if math.random(1, 100) <= chance then
local new_mooshroom = minetest.add_entity(pos, "mobs_mc:mooshroom"):get_luaentity() --clone the mooshroom
local new_mooshroom = minetest.add_entity(entity_pos, "mobs_mc:mooshroom"):get_luaentity() --clone the mooshroom
for attribute, value in pairs(entity) do
if attribute ~= "object" then
new_mooshroom[attribute] = value
@ -377,7 +371,7 @@ local new_dispenser_function = function(pos, node)
if used then
obj:set_properties({ textures = texture })
entity.gotten = true
minetest.sound_play("mcl_tools_shears_cut", { pos = pos }, true)
minetest.sound_play("mcl_tools_shears_cut", { pos = entity_pos }, true)
inv:set_stack("main", stack_id, stack)
break
end
@ -393,7 +387,7 @@ for _, itemstring in ipairs({"mcl_dispensers:dispenser", "mcl_dispensers:dispens
minetest.registered_items[itemstring].mesecons.effector.action_on = new_dispenser_function
end
local gotten_texture = {
local snowman_gotten_texture = {
"mobs_mc_snowman.png",
"blank.png",
"blank.png",
@ -411,7 +405,7 @@ minetest.registered_entities["mobs_mc:snowman"].on_rightclick = function(self, c
-- Remove pumpkin
self.gotten = true
self.object:set_properties({
textures = gotten_texture,
textures = snowman_gotten_texture,
})
local pos = self.object:get_pos()

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -38,7 +38,7 @@ function exchangeclone.reload_transmutation_list(player, search)
local items_to_show = minetest.deserialize(meta:get_string("exchangeclone_transmutation_learned_items")) or {}
local lang = minetest.get_player_information(player:get_player_name()).lang_code
local pages = {}
local page_num = 1
local page_num
local i = 0
if not search or search == "" then search = player:get_meta():get_string("exchangeclone_transmutation_search") or "" end
if search and search ~= "" then
@ -116,7 +116,7 @@ local function handle_inventory(player, inventory, to_list, to_index, stack)
inventory:set_stack(to_list, to_index, nil)
exchangeclone.show_transmutation_table_formspec(player)
elseif to_list == "forget" then
-- end
return
elseif to_list == "charge" then
local player_energy = exchangeclone.get_player_energy(player)
local orb_energy = exchangeclone.get_orb_itemstack_energy(stack)
@ -218,7 +218,7 @@ function exchangeclone.show_transmutation_table_formspec(player, data)
formspec = formspec.."item_image[0.5,2.5;0.8,0.8;"..selection.."]"
end
if exchangeclone.mineclone then
if exchangeclone.mcl then
formspec = formspec..
mcl_formspec.get_itemslot_bg(0,1,1,1)..
mcl_formspec.get_itemslot_bg(1,1,1,1)..
@ -229,8 +229,8 @@ function exchangeclone.show_transmutation_table_formspec(player, data)
minetest.show_formspec(player_name, "exchangeclone_transmutation_table", formspec)
end
minetest.register_on_joinplayer(function(player, last_login)
local playername = player:get_player_name()
minetest.register_on_joinplayer(function(ref, last_login)
local playername = ref:get_player_name()
minetest.create_detached_inventory("exchangeclone_transmutation_"..playername, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
local stack = inv:get_stack(from_list, from_index)
@ -255,7 +255,7 @@ minetest.register_on_joinplayer(function(player, last_login)
inventory:set_width("output", 2)
inventory:set_size("learn", 1)
inventory:set_size("forget", 1)
exchangeclone.reload_transmutation_list(player)
exchangeclone.reload_transmutation_list(ref)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
@ -337,7 +337,7 @@ minetest.register_tool("exchangeclone:alchemical_tome", {
local book = "default:book"
local obsidian = "default:obsidian"
local stone = "default:stone"
if exchangeclone.mineclone then
if exchangeclone.mcl then
book = "mcl_books:book"
obsidian = "mcl_core:obsidian"
stone = "mcl_core:stone"