Started getting proper tool speeds in MTG

This commit is contained in:
ThePython 2024-02-15 07:53:54 -08:00
parent 2e877676f9
commit 2635fd9d06
7 changed files with 63 additions and 33 deletions

View File

@ -50,21 +50,27 @@ Dependencies: Minetest Game or MineClone.
![Screenshot](screenshot.png)
![Transmutation GUI Screenshot](transmutation_screenshot.png)
## Sources/license: (note: this will change soon)
* Code: Originally started as a fork of Enchant97's mod [Element Exchange](https://github.com/enchant97/minetest_element_exchange). Since then, there have been tons of new bugs and features (at this point, at least 95% of the code is my own). Both this mod and Element Exchange are licenced under GPLv3+. Based on Equivalent Exchange and ProjectE, mods for Minecraft.
## Sources/licenses:
* Code: GPLv3+
* Originally started as a fork of Enchant97's mod [Element Exchange](https://github.com/enchant97/minetest_element_exchange) (also GPLv3+).
* Based on the Minecraft mods Equivalent Exchange 2 and ProjectE (both MIT, though the source for EE2 is unavailable)
* Textures:
* Energy Collector, Deconstructor, Constructor: Directly from Element Exchange, GPLv3+.
* Exchange Orb: *Slightly* modified from Element Exchange (I just changed the color to white so it could change colors correctly)
* Alchemical Coal, Mobius Fuel, and Aeternalis Fuel: modified versions of MineClone's coal texture (CC-BY-SA-3.0).
* Covalence Dust: Slightly modified from MineClon(e2/ia)'s redstone dust (CC-BY-SA-3.0)
* Dark and Red Matter Armor (and maybe 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.
* Constructor and Deconstructor: Unmodified from Element Exchange (GPLv3+)
* Armor (not the inventory image): Modified versions of diamond armor from 3D Armor in MTG and `mcl_armor` in MCL (both CC-BY-SA-3.0)
* Upgraders and Upgrades: Created by me (CC-BY-SA-3.0)
* Energy Collectors:
* Base: Glowstone block from MineClone2 (CC-BY-SA-3.0)
* Overlay: Created by me (CC-BY-SA-3.0)
* Alchemical Chests (and Advanced Alchemical Chests): Modified version of EE2/ProjectE's textures, extended to 16x16 instead of 14x14 (MIT)
* All other textures and sounds: Directly from EE2/ProjectE (MIT)
You can find the old textures and sounds by going back to previous commits in GitHub.
-----
### PLANS/TODO FOR v7.0 (see dev branch for current progress)
* [x] Achievements/advancements/awards
* [x] Achievements/advancements/awards (match ProjectE with a few missing/added)
* [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 (\* = only in MCL at the moment)
@ -91,6 +97,7 @@ Dependencies: Minetest Game or MineClone.
* [ ] DM/RM blocks can only be broken by correct (or higher) type.
* [ ] Change energy collector recipes to match ProjectE
* [ ] Update screenshots
* [x] Update media licenses
* [ ] Edit wiki:
* [ ] Achievements?
* [ ] Divining rods
@ -119,11 +126,7 @@ Dependencies: Minetest Game or MineClone.
* Replaced Exchange Orbs with Klein Stars and Magnum Stars
* Added storage blocks for Alchemical Coal, Mobius Fuel, and Aeternalis Fuel
* Changes:
* Most textures and all sounds are now from ProjectE/EE2.
* Only (De)Constructors, and worn armor have the original textures.
* Textures for Upgrades and Upgraders have been changed.
* Textures for Collectors are based on ProjectE's but not identical.
* Textures for Alchemical Chests are slightly modified from ProjectE's to make them 16x16 instead of 14x14
* Most textures and all sounds are now from ProjectE/EE2. See license section for details.
* Several improvements to tools:
* The pickaxe vein mining ability only checks each position once.
* Tools do not mine slower in 3x1/3x3 modes (to match ProjectE)
@ -134,6 +137,7 @@ Dependencies: Minetest Game or MineClone.
* Several changes to tool abilities (*mostly* making them closer to the ProjectE versions)
* Got rid of `exchangeclone.node_radius_action` function (it was pretty much over-refactoring and made things so much more complicated)
* Removed the deprecated PESA.
* Changed "energy" to "EMC"
* Replaced Exchange Orbs with Klein Stars and Magnum Stars
* Since Klein Star Omegas have the same capacity as the old Exchange Orbs, they now replace them (meaning players don't lose anything).
* Klein Star Ein->Zwei->Drei->Vier->Sphere->Omega, then the same order for Magnum Stars.

View File

@ -87,7 +87,7 @@ minetest.register_tool("exchangeclone:dark_matter_axe", {
damage_groups = {fleshy=9},
punch_attack_uses = 0,
groupcaps={
choppy = {times={[1]=1.5, [2]=0.75, [3]=0.38}, uses=0, maxlevel=4},
choppy = {times={[1]=4, [2]=0.3, [3]=0.25}, uses=0, maxlevel=4},
},
},
sound = { breaks = "default_tool_breaks" },
@ -114,7 +114,7 @@ minetest.register_tool("exchangeclone:red_matter_axe", {
damage_groups = {fleshy=10},
punch_attack_uses = 0,
groupcaps={
choppy = {times={[1]=1, [2]=0.5, [3]=0.25}, uses=0, maxlevel=5},
choppy = {times={[1]=0.35, [2]=0.25, [3]=0.2}, uses=0, maxlevel=5},
},
},
sound = { breaks = "default_tool_breaks" },

View File

@ -124,7 +124,7 @@ minetest.register_tool("exchangeclone:dark_matter_hoe", {
full_punch_interval = 0.25,
damage_groups = { fleshy = 1, },
groupcaps={
exchangeclone_dirt = {times={[1]=0.25, [2]=0.25, [3]=0.25}, uses=0, maxlevel=4},
exchangeclone_dirt = {times={[1]=0.25, [2]=0.1, [3]=0.1}, uses=0, maxlevel=4},
},
},
_mcl_toollike_wield = true,
@ -150,7 +150,7 @@ minetest.register_tool("exchangeclone:red_matter_hoe", {
full_punch_interval = 0.25,
damage_groups = { fleshy = 1, },
groupcaps={
exchangeclone_dirt = {times={[1]=0.25, [2]=0.25, [3]=0.25}, uses=0, maxlevel=4},
exchangeclone_dirt = {times={[1]=0.2, [2]=0.1, [3]=0.05}, uses=0, maxlevel=4},
},
},
_mcl_toollike_wield = true,

View File

@ -88,7 +88,7 @@ minetest.register_tool("exchangeclone:dark_matter_pickaxe", {
damage_groups = {fleshy=8},
punch_attack_uses = 0,
groupcaps={
cracky = {times={[1]=0.4, [2]=0.2, [3]=0.1}, uses=0, maxlevel=4},
cracky = {times={[1]=0.55, [2]=0.35, [3]=0.2}, uses=0, maxlevel=4},
},
},
_mcl_toollike_wield = true,
@ -115,7 +115,7 @@ minetest.register_tool("exchangeclone:red_matter_pickaxe", {
damage_groups = {fleshy=9},
punch_attack_uses = 0,
groupcaps={
cracky = {times={[1]=0.27, [2]=0.13, [3]=0.07}, uses=0, maxlevel=5},
cracky = {times={[1]=0.5, [2]=0.3, [3]=0.15}, uses=0, maxlevel=5},
},
},
_mcl_toollike_wield = true,

View File

@ -126,10 +126,9 @@ minetest.register_tool("exchangeclone:dark_matter_shovel", {
damage_groups = {fleshy=6},
punch_attack_uses = 0,
groupcaps={
crumbly = {times={[1]=0.9, [2]=0.45, [3]=0.225}, uses=0, maxlevel=4},
crumbly = {times={[1]=0.25, [2]=0.1, [3]=0.1}, uses=0, maxlevel=4},
},
},
sound = { breaks = "default_tool_breaks" },
on_place = shovel_on_place,
on_secondary_use = shovel_on_place,
_mcl_toollike_wield = true,
@ -153,10 +152,9 @@ minetest.register_tool("exchangeclone:red_matter_shovel", {
damage_groups = {fleshy=7},
punch_attack_uses = 0,
groupcaps={
crumbly = {times={[1]=0.6, [2]=0.25, [3]=0.1}, uses=0, maxlevel=5},
crumbly = {times={[1]=0.2, [2]=0.1, [3]=0.05}, uses=0, maxlevel=5},
},
},
sound = { breaks = "default_tool_breaks" },
on_place = shovel_on_place,
on_secondary_use = shovel_on_place,
_mcl_toollike_wield = true,

View File

@ -176,7 +176,7 @@ minetest.register_tool("exchangeclone:dark_matter_sword", {
damage_groups = {fleshy=13},
punch_attack_uses = 0,
groupcaps={
snappy = {times={[1]=0.95, [2]=0.45, [3]=0.15}, uses=0, maxlevel=4},
snappy = {times={[1]=0.2, [2]=0.1, [3]=0.05}, uses=0, maxlevel=4},
},
},
on_secondary_use = exchangeclone.aoe_attack({damage = 12, knockback = 12, radius = 5, cooldown = 0.7}),
@ -201,7 +201,7 @@ minetest.register_tool("exchangeclone:red_matter_sword", {
damage_groups = {fleshy=17},
punch_attack_uses = 0,
groupcaps={
snappy = {times={[1]=0.6, [2]=0.25, [3]=0.1}, uses=0, maxlevel=5},
snappy = {times={[1]=0.15, [2]=0.1, [3]=0.05}, uses=0, maxlevel=5},
},
},
on_secondary_use = red_matter_sword_action,

View File

@ -1100,21 +1100,49 @@ function exchangeclone.add_range_setting(name, data)
exchangeclone.tool_levels.range[name] = data
end
local function calculate_time_from_time(time, speed, efficiency)
if not efficiency then return time end
local hardness = (2/3)*time*speed
speed = speed + efficiency*efficiency + 1
return math.ceil(30/(speed/hardness))/20
end
-- A table of estimated hardness values for MTG
-- Calculated by finding MTG nodes with the right group, then looking up the Minecraft hardness for them
local hacky_workaround = {
snappy = {1.5, 0.8, 0.2},
cracky = {5, 3, 2},
choppy = {5, 3, 2},
crumbly = {2, 0.6, 0.5}
}
function exchangeclone.get_mtg_times(speed, efficiency, group)
if efficiency then speed = speed + efficiency*efficiency + 1 end
local times = {}
for i, hardness in ipairs(hacky_workaround[group]) do
times[i] = math.ceil(30/(speed/hardness))/20
end
minetest.log(dump(times))
return times
end
-- Given an item and effiency level, return the groupcaps of the item with that efficiency level.
function exchangeclone.get_groupcaps(item, efficiency)
item = ItemStack(item)
if exchangeclone.mcl then
local thingy = mcl_autogroup.get_groupcaps(item:get_name(), efficiency)
return thingy
else
local groupcaps = mcl_autogroup.get_groupcaps(item:get_name(), efficiency)
return groupcaps
else -- This only works if the tool is the same speed for every group.
local groupcaps = table.copy(minetest.registered_items[item:get_name()].tool_capabilities.groupcaps)
local adjusted_efficiency = 1 -- TODO finish this
local next, mcl_diggroups = pairs(item:get_definition()._mcl_diggroups)
local _, mcl_group_def = next(mcl_diggroups)
local speed = mcl_group_def.speed
if not groupcaps then return end
for group, def in pairs(groupcaps) do
for level, time in pairs(def.times) do
def[level] = time -- TODO finish this
end
groupcaps[group].times = exchangeclone.get_mtg_times(speed, efficiency, group)
end
return groupcaps
end
end