Finished GoED

This commit is contained in:
ThePython 2024-02-15 16:26:34 -08:00
parent cf8663d015
commit 5ff0d9b255
10 changed files with 121 additions and 76 deletions

View File

@ -93,7 +93,7 @@ You can find the old textures and sounds by going back to previous commits in Gi
* [ ] Swiftwolf's Rending Gale (maybe rename?)
* [ ] Mind, Life, Body and Soul Stones (Mind = MCL only)
* [ ] Talisman of Repair (will only work in player inventory, not Alchemical Chests like ProjectE)
* [ ] Gem of Eternal Density (will only work on right click, not automatically).
* [x] Gem of Eternal Density (will only work on right click, not automatically).
* [ ] Change energy collector recipes to match ProjectE
* [ ] Update screenshots
* [x] Update media licenses
@ -125,6 +125,7 @@ You can find the old textures and sounds by going back to previous commits in Gi
* Added achivements/advancements awards (mostly matching ProjectE, but with some missing or added).
* Replaced Exchange Orbs with Klein Stars and Magnum Stars
* Added storage blocks for Alchemical Coal, Mobius Fuel, and Aeternalis Fuel
* Added Gem of Eternal Density
* Changes:
* Most textures and all sounds are now from ProjectE/EE2. See license section for details.
* Several improvements to tools:

View File

@ -285,13 +285,14 @@ else
})
minetest.register_on_player_hpchange(function(player, hp_change, reason)
if hp_change < 0 then
local damage = -hp_change
local _, armor_inv = armor:get_valid_player(player, "3d_armor")
local blocked = 0
for i = 1, 6 do
local itemstack = armor_inv:get_stack("armor", i)
blocked = blocked + get_blocked_damage(itemstack, hp_change, reason)
blocked = blocked + get_blocked_damage(itemstack, damage, reason)
end
return math.max(0, hp_change - blocked)
return -math.max(0, damage - blocked)
else
return hp_change
end
@ -364,7 +365,7 @@ minetest.register_craft({
if exchangeclone.mtg then
minetest.register_tool("exchangeclone:shield_dark_matter", {
description = "Dark Matter Shield (deprecated)\nYou still have this so you can turn it into EMC.\nAnd no, it's not supposed to have a texture.",
groups = {disable_repair = 1, not_in_creative_inventory = 1}
groups = {disable_repair = 1, not_in_creative_inventory = 1, not_in_craft_guide = 1}
})
exchangeclone.register_craft({
output = "exchangeclone:shield_dark_matter",
@ -382,7 +383,7 @@ if exchangeclone.mtg then
minetest.register_tool("exchangeclone:shield_red_matter", {
description = "Red Matter Shield (deprecated)\nYou still have this so you can turn it into EMC.\nAnd no, it's not supposed to have a texture.",
groups = {disable_repair = 1, not_in_creative_inventory = 1}
groups = {disable_repair = 1, not_in_creative_inventory = 1, not_in_craft_guide = 1}
})
exchangeclone.register_craft({
output = "exchangeclone:shield_red_matter",

View File

@ -0,0 +1,107 @@
exchangeclone.density_targets = {
exchangeclone.itemstrings.iron,
exchangeclone.itemstrings.gold,
exchangeclone.itemstrings.diamond,
"exchangeclone:dark_matter",
"exchangeclone:red_matter",
}
local function get_gem_description(itemstack)
local meta = itemstack:get_meta()
local current_target = math.max(meta:get_int("density_target"), 1)
local target_message = "Target: "..ItemStack(exchangeclone.density_targets[current_target]):get_short_description()
local emc = exchangeclone.get_item_emc(itemstack:get_name())
local stored = exchangeclone.get_item_emc(itemstack) - emc
return "Gem of Eternal Density\n"..target_message.."\nEMC value: "..exchangeclone.format_number(emc).."\nStored EMC: "..exchangeclone.format_number(stored)
end
local function gem_action(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 meta = itemstack:get_meta()
if player:get_player_control().aux1 then
local current_target = math.max(meta:get_int("density_target"), 1)
if player:get_player_control().sneak then
current_target = math.max(1, current_target - 1)
else
current_target = math.min(#exchangeclone.density_targets, current_target + 1)
end
minetest.chat_send_player(player:get_player_name(), "Target: "..ItemStack(exchangeclone.density_targets[current_target]):get_short_description())
meta:set_int("density_target", current_target)
meta:set_string("description", get_gem_description(itemstack))
return itemstack
end
local inv = player:get_inventory()
local list = inv:get_list("main")
-- Don't include hotbar
local min = exchangeclone.mcl and 10 or 9
if player:get_wield_index() >= min then return end
local total_emc = exchangeclone.get_item_emc(itemstack) - exchangeclone.get_item_emc(itemstack:get_name())
local target = exchangeclone.density_targets[math.max(meta:get_int("density_target"), 1)]
for i = min, #list do
local stack = list[i]
if stack:get_name() ~= target then
local emc = exchangeclone.get_item_emc(stack) or 0
if emc > 0 then
total_emc = total_emc + emc
list[i] = ItemStack("")
end
end
end
inv:set_list("main", list)
if not (total_emc and total_emc > 0) then return end
local target_emc = exchangeclone.get_item_emc(target)
local stack_max = ItemStack(target):get_stack_max()
local num_to_add, remainder_emc = math.floor(total_emc/target_emc), total_emc % target_emc
local num_stacks, remainder = math.floor(num_to_add/stack_max), num_to_add%stack_max
if num_stacks > 0 then
for i = 1, num_stacks do
num_stacks = num_stacks - 1
local extra = inv:add_item("main", ItemStack(target.." "..stack_max))
if extra:get_count() > 0 then
remainder = remainder + extra:get_count()
break
end
end
end
if num_stacks > 0 then
remainder = remainder + num_stacks*stack_max
else
remainder = inv:add_item("main", ItemStack(target.." "..remainder)):get_count()
end
if remainder > 0 then
remainder_emc = remainder_emc + remainder*target_emc
end
exchangeclone.play_sound(player, "exchangeclone_enable")
meta:set_int("exchangeclone_emc_value", exchangeclone.get_item_emc(itemstack:get_name()) + remainder_emc)
meta:set_string("description", get_gem_description(itemstack))
return itemstack
end
minetest.register_tool("exchangeclone:gem_of_eternal_density", {
description = "Gem of Eternal Density",
inventory_image = "exchangeclone_gem_of_eternal_density.png",
on_secondary_use = gem_action,
on_place = gem_action
})
minetest.register_craft({
output = "exchangeclone:gem_of_eternal_density",
recipe = {
{exchangeclone.itemstrings.diamond, exchangeclone.itemstrings.obsidian, exchangeclone.itemstrings.diamond},
{"exchangeclone:dark_matter", exchangeclone.itemstrings.diamond, "exchangeclone:dark_matter"},
{exchangeclone.itemstrings.diamond, exchangeclone.itemstrings.obsidian, exchangeclone.itemstrings.diamond}
}
})

View File

@ -136,6 +136,7 @@ dofile(modpath.."/infinite_food.lua")
dofile(modpath.."/alchemical_chests.lua")
dofile(modpath.."/transmutation_table.lua")
dofile(modpath.."/furnaces.lua")
dofile(modpath.."/gem_of_eternal_density.lua")
if minetest.get_modpath("awards") then
dofile(modpath.."/awards.lua")
end

View File

@ -152,7 +152,7 @@ minetest.register_tool("exchangeclone:red_matter_shovel", {
damage_groups = {fleshy=7},
punch_attack_uses = 0,
groupcaps={
crumbly = {times=exchangeclone.get_mtg_times(16, nil, "crumbly") maxlevel=5},
crumbly = {times=exchangeclone.get_mtg_times(16, nil, "crumbly"), maxlevel=5},
},
},
on_place = shovel_on_place,

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

View File

@ -83,7 +83,7 @@ local function upgrader_action(pos)
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))
new_tool:get_meta():set_int("exchangeclone_emc_value", new_emc)
inv:set_stack("dst", 1, new_tool)

View File

@ -1,60 +0,0 @@
exchangeclone.density_targets = {
exchangeclone.itemstrings.iron,
exchangeclone.itemstrings.gold,
exchangeclone.itemstrings.diamond,
"exchangeclone:dark_matter",
"exchangeclone:red_matter",
}
local function gem_action(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 meta = itemstack:get_meta()
if player:get_player_controls().aux1 then
local current_target = meta:get_int("density_target") or 1
if player:get_player_controls().sneak then
current_target = math.max(1, current_target - 1)
else
current_target = math.min(#exchangeclone.density_targets, current_target + 1)
end
minetest.chat_send_player(player:get_name(), "Target: "..ItemStack(exchangeclone.density_targets[current_target]):get_short_description())
meta:set_int("density_target", current_target)
return itemstack
end
local inv = player:get_inventory()
local list = inv:get_list("main")
-- Don't include hotbar
local min = exchangeclone.mcl and 10 or 9
if player:get_wield_index() >= min then return end
local total_emc = meta:get_int("density_stored") or 0
for i = min, #list do
local stack = list[i]
local emc = exchangeclone.get_item_emc(stack) or 0
if emc > 0 then
total_emc = total_emc + emc
list[i] = ItemStack("")
end
end
if not (total_emc and emc > 0) then return end
local target = exchangeclone.density_targets[meta:get_int("density_target") or 1]
local target_emc = exchangeclone.get_item_emc(target)
local stack_max = ItemStack(target):get_stack_max()
local num_to_add = math.floor(total_emc/target_emc)
local num_stacks, remainder = math.floor(num_to_add/stack_max), num_to_add%stack_max
for i = 0, num_stacks do
local extra = inv:add_item("main", ItemStack(target.." "..stack_max))
if extra:get_count() > 0 then
break
else
end
end

View File

@ -69,7 +69,6 @@ function exchangeclone.get_item_emc(item)
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
@ -354,6 +353,7 @@ end
exchangeclone.itemstrings = {
cobble = exchangeclone.mcl and "mcl_core:cobble" or "default:cobble",
redstoneworth = exchangeclone.mcl and "mesecons:redstone" or "default:obsidian",
obsidian = exchangeclone.mcl and "mcl_core:obsidian" or "default:obsidian",
glowstoneworth = exchangeclone.mcl and "mcl_nether:glowstone_dust" or "default:tin_ingot",
coal = exchangeclone.mcl and "mcl_core:coal_lump" or "default:coal_lump",
iron = exchangeclone.mcl and "mcl_core:iron_ingot" or "default:steel_ingot",
@ -1100,13 +1100,6 @@ 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 = {
@ -1140,7 +1133,9 @@ function exchangeclone.get_groupcaps(item, efficiency)
if not groupcaps then return end
for group, def in pairs(groupcaps) do
groupcaps[group].times = exchangeclone.get_mtg_times(speed, efficiency, group)
local test_group = group
if test_group == "exchangeclone_dirt" then test_group = "crumbly" end
groupcaps[group].times = exchangeclone.get_mtg_times(speed, efficiency, test_group)
end
return groupcaps
end