Giving up for now.

This commit is contained in:
ThePython 2023-11-02 16:33:30 -07:00
parent 3821ae518c
commit a683beb709
6 changed files with 1416 additions and 3484 deletions

View File

@ -54,17 +54,30 @@ Dependencies: Minetest Game or MineClone.
<details><summary><h1>Changelog:</h1></summary>
### 6.0
* New features
* ExchangeClone can now generate energy values automatically based on crafting recipes! This means the list of energy values can be much shorter (although it does mean that it takes longer to load a world..... sorry).
* Changes
* ExchangeClone is now a modpack for [annoying reasons](https://forum.minetest.net/viewtopic.php?f=47&p=429775s). *Every single mod* in the modpack is required, regardless of what it says the dependencies are.
* The 2-billion-ish energy limit is has been increased to the actual maximum Lua allows. This may mean some precision is lost when your energy reaches a few quadrillion... but that's unlikely to happen, and at that point, it probably doesn't matter, so I'm not testing it.
* Bugfixes
*
### 5.2
* Removed unnecessary logging every time players take damage (I was testing stuff out with the armor)
* Bugfixes
* Removed unnecessary logging every time players take damage (I was testing stuff out with the armor)
### 5.1
* Fixed Mineclonia energy values (I foolishly assumed that all items would have the same itemstrings and groups).
* Added new Mineclonia items (pottery, sculk, smithing templates, suspicious sand, etc.)
* Changed a couple of energy values (enchanted golden apple was way too cheap, clay seemed too expensive)
* Sword/Katar AOE damage now matches ProjectE (DM sword = 12, RM sword = 16, katar = 1000... kinda OP). All AOE cooldowns (including swinging swords/katar) are now 0.7 seconds.
* DM/RM pickaxe/hammer/morningstar dig times now are approximately the same as ProjectE (at full charge), meaning they are now maybe too fast.
* Red Matter Armor no longer increases player health (the wiki lied to me).
* A couple of changes to DM/RM armor in MineClone, which may or may not be noticeable. I really don't know.
* New features
* Added new Mineclonia items (pottery, sculk, smithing templates, suspicious sand, etc.)
* Changes
* Changed a couple of energy values (enchanted golden apple was way too cheap, clay seemed too expensive)
* Sword/Katar AOE damage now matches ProjectE (DM sword = 12, RM sword = 16, katar = 1000... kinda OP). All AOE cooldowns (including swinging swords/katar) are now 0.7 seconds.
* DM/RM pickaxe/hammer/morningstar dig times now are approximately the same as ProjectE (at full charge), meaning they are now maybe too fast.
* Red Matter Armor no longer increases player health (the wiki lied to me).
* A couple of changes to DM/RM armor in MineClone, which may or may not be noticeable. I really don't know.
* Bugfixes
* Fixed Mineclonia energy values (I foolishly assumed that all items would have the same itemstrings and groups).
### 5.0 (the most insteresting release so far)
**You MUST break and replace any existing Constructors, Deconstructors, and Energy Collectors when updating from any previous version. Nothing will be lost (hopefully). In Minetest Game, this is a bit of a problem (try blowing it up maybe? I don't know, sorry).**

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
name = _exchangeclone_energy
title = ExchangeClone Energy
depends = exchangeclone, zzzz_exchangeclone_crafthook
optional_depends = 3d_armor, mcl_item_id, mcl_core, default, moreswords, mcl_stairs, meat_blocks, sticky_things, fake_liquids, sound_machine, stairs, mcl_dispensers, farming, mobs_mc, screwdriver
optional_depends = 3d_armor, mcl_item_id, mcl_core, default, moreswords, mcl_stairs, meat_blocks, sticky_things, fake_liquids, sound_machine, stairs, mcl_dispensers, farming, mobs_mc, screwdriver, _mcl_autogroup

File diff suppressed because it is too large Load Diff

View File

@ -12,8 +12,33 @@ function exchangeclone.get_inventory_drops(pos, inventory, drops) --removes defa
end
end
function exchangeclone.get_item_energy(name)
return minetest.registered_items[name].energy_value or -1
function exchangeclone.get_item_energy(item)
if type(item) == "string" and item:sub(1,6) == "group:" and exchangeclone.group_values then
local item_group = item:sub(7,-1)
for _, group in ipairs(exchangeclone.group_values) do
if item_group == group[1] then return group[2] end
end
local group_items = exchangeclone.get_group_items(item_group)
local cheapest
for _, group_item in ipairs(group_items[item_group]) do
local energy_value = exchangeclone.get_item_energy(group_item)
if energy_value > 0 and ((not cheapest) or energy_value < cheapest) then
cheapest = energy_value
end
end
return cheapest
end
item = ItemStack(item)
local def = minetest.registered_items[item:get_name()]
if not def then return 0 end
if item:get_name() == "exchangeclone:exchange_orb" then
return def.energy_value or 0 + exchangeclone.get_orb_itemstack_energy(item)
end
if def.energy_value then
return (def.energy_value) * item:get_count()
else
return
end
end
function exchangeclone.round(num)
@ -30,20 +55,20 @@ function exchangeclone.map(input, min1, max1, min2, max2)
end
function exchangeclone.get_orb_itemstack_energy(itemstack)
if not itemstack then return -1 end
if itemstack:get_name() ~= "exchangeclone:exchange_orb" then return -1 end
if not itemstack then return end
if itemstack:get_name() ~= "exchangeclone:exchange_orb" then return end
return itemstack:get_meta():get_float("stored_energy") or 0
end
function exchangeclone.get_orb_energy(inventory, listname, index)
if not inventory then return -1 end
if not inventory then return end
if not listname then listname = "main" end
if not index then index = 1 end
local itemstack = inventory:get_stack(listname, index)
return exchangeclone.get_orb_itemstack_energy(itemstack)
end
if default then exchangeclone.sound_mod = default else exchangeclone.sound_mod = mcl_sounds end
if exchangeclone.mcl then exchangeclone.sound_mod = mcl_sounds else exchangeclone.sound_mod = default end
function exchangeclone.set_orb_energy(inventory, listname, index, amount)
if not inventory or amount < 0 then return end
@ -51,7 +76,7 @@ function exchangeclone.set_orb_energy(inventory, listname, index, amount)
if not index then index = 1 end
local itemstack = inventory:get_stack(listname, index)
if not itemstack then return end
if not (itemstack:get_name() and itemstack:get_name() == "exchangeclone:exchange_orb") then return end
if itemstack:get_name() ~= "exchangeclone:exchange_orb" then return end
local old_energy = exchangeclone.get_orb_itemstack_energy(itemstack)
if amount > old_energy and old_energy > exchangeclone.orb_max then return end -- don't allow more energy to be put into an over-filled orb
@ -128,7 +153,7 @@ function exchangeclone.set_player_energy(player, amount)
exchangeclone.update_hud(player)
end
-- copied from http://lua-users.org/wiki/IntegerDomain
-- copied from http://lua-users.org/wiki/IntegerDomain {
-- get highest power of 2 which Lua can still handle as integer
local step = 2
while true do
@ -150,9 +175,15 @@ while step > 0 do
step = math.floor(step/2)
end
function exchangeclone.get_group_items(groups, allow_duplicates, include_no_group)
-- }
function exchangeclone.get_group_items(groups, allow_duplicates, include_no_group, use_cache)
if type(groups) ~= "table" then
return nil
if type(groups) == "string" then
groups = {groups}
else
return
end
end
allow_duplicates = allow_duplicates or false

View File

@ -1,10 +1,10 @@
exchangeclone = {}
exchangeclone = {recipes = {}}
local old_func = minetest.register_craft
function minetest.register_craft(...)
local arg = {...}
if arg.replacements then
table.insert(exchangeclone.recipes, table.copy(arg))
function minetest.register_craft(arg)
if arg.output then
exchangeclone.recipes[arg.output] = exchangeclone.recipes[arg.output] or {}
table.insert(exchangeclone.recipes[arg.output], table.copy(arg))
end
old_func(...)
old_func(arg)
end