Pedestal node timer stopping for no reason
This commit is contained in:
parent
dd3137bb89
commit
e3c51c517e
12
README.md
12
README.md
|
@ -61,15 +61,14 @@ Dependencies: Minetest Game or MineClone.
|
|||
* Originally started as a fork of Enchant97's mod [Element Exchange](https://github.com/enchant97/minetest_element_exchange) (GPLv3+).
|
||||
* Some code copied/modified from MineClone2 and Minetest Game (both GPLv3+)
|
||||
* Textures:
|
||||
* 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)
|
||||
* Upgrader 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)
|
||||
* Armor (not the inventory image): Slightly modified from ProjectE (just moved stuff around so it fit onto Minetest player models correctly).
|
||||
* Alchemical Chest: Modified version of EE2/ProjectE's textures, extended to 16x16 instead of 14x14 (MIT)
|
||||
* Advanced Alchemical Chests: Modified version of ProjectExpansion's textures, extended to 16x16 instead of 14x14 (MIT)
|
||||
* Magnum Stars: Directly from ProjectExpansion (MIT)
|
||||
* Magnum Stars and EMC Link: Directly from ProjectExpansion (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.
|
||||
|
@ -80,9 +79,8 @@ You can find the old textures and sounds by going back to previous commits in Gi
|
|||
[x] Deprecate (De)Constructors
|
||||
[x] Remove fuel crafting recipes for stars and upgrades
|
||||
[x] Add ProjectE armor textures
|
||||
[ ] Add EMC Link
|
||||
[ ] Add Energy Condensers
|
||||
[ ] Add Divining Rods
|
||||
[x] Add EMC Link
|
||||
[ ] ~~Add Divining Rods~~
|
||||
[ ] Add Alchemical Books
|
||||
[ ] Add Knowledge Sharing Book
|
||||
[ ] Add function for getting player's learned items
|
||||
|
@ -100,7 +98,7 @@ You can find the old textures and sounds by going back to previous commits in Gi
|
|||
|
||||
### v8.0
|
||||
* New Features:
|
||||
*
|
||||
* Added the EMC Link to replace both the Constructor and Deconstructor.
|
||||
* Changes:
|
||||
* The Constructor and Deconstructor are now deprecated. Element Exchange is no more.
|
||||
* Upgrades and Stars can no longer be used as fuel.
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
local function pedestal_action(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack("main", 1)
|
||||
if stack:is_empty() then
|
||||
minetest.log("empty")
|
||||
minetest.get_node_timer(pos):stop()
|
||||
return
|
||||
end
|
||||
local def = stack:get_definition()
|
||||
if not def then
|
||||
minetest.log("no def")
|
||||
minetest.get_node_timer(pos):stop()
|
||||
return
|
||||
end
|
||||
local func = def._exchangeclone_pedestal
|
||||
if func then
|
||||
minetest.log("Running function")
|
||||
inv:set_stack("main", 1, func(pos, stack) or stack)
|
||||
local new_stack = inv:get_stack("main", 1)
|
||||
if not (new_stack:get_definition() and new_stack:get_definition()._exchangeclone_pedestal) then
|
||||
minetest.log("fail 2")
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
else
|
||||
minetest.log("no func")
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("exchangeclone:dark_matter_pedestal", {
|
||||
"Dark Matter Pedestal",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"exchangeclone_dark_matter_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.3125, -0.5000, -0.3125, 0.3125, -0.3750, 0.3125},
|
||||
{-0.1250, -0.3750, -0.1250, 0.1250, 0.06250, 0.1250},
|
||||
{-0.1875, 0.06250, -0.1875, 0.1875, 0.1250, 0.1875}
|
||||
}
|
||||
},
|
||||
on_punch = function(pos, node, player, pointed_thing)
|
||||
local wielded_item = player:get_wielded_item()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("main") and wielded_item:is_empty() then
|
||||
minetest.log("Should be an item")
|
||||
minetest.add_item(vector.offset(pos,0,0.5,0), inv:get_stack("main", 1))
|
||||
inv:set_stack("main", 1, ItemStack(""))
|
||||
else
|
||||
minetest.log("Nothing happened (punch)")
|
||||
end
|
||||
end,
|
||||
on_rightclick = function(pos, node, player, pointed_thing)
|
||||
local wielded_item = player:get_wielded_item()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("main") and wielded_item:is_empty() then
|
||||
local stack = inv:get_stack("main", 1)
|
||||
local pedestal_data = stack:get_definition()._exchangeclone_pedestal
|
||||
if pedestal_data then
|
||||
if minetest.get_node_timer(pos):is_started() then
|
||||
minetest.log("Off")
|
||||
minetest.sound_play("exchangeclone_charge_down", {pos = pos, max_hear_distance = 20})
|
||||
minetest.get_node_timer(pos):stop()
|
||||
else
|
||||
minetest.log("On")
|
||||
minetest.sound_play("exchangeclone_enable", {pos = pos, max_hear_distance = 20})
|
||||
minetest.get_node_timer(pos):start(1,0)
|
||||
end
|
||||
else
|
||||
minetest.log("No pedestal data")
|
||||
end
|
||||
elseif inv:is_empty("main") and not wielded_item:is_empty() and wielded_item:get_stack_max() == 1 then
|
||||
minetest.log(wielded_item:get_name())
|
||||
inv:set_stack("main", 1, wielded_item:take_item())
|
||||
--wielded_item:set_count(wielded_item:get_count() - 1)
|
||||
if wielded_item:get_count() <= 0 then wielded_item = ItemStack("") end
|
||||
minetest.log(tostring(wielded_item))
|
||||
return wielded_item
|
||||
else
|
||||
minetest.log("Nothing happened (rightclick)")
|
||||
end
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 1)
|
||||
end,
|
||||
on_timer = pedestal_action,
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
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,
|
||||
})
|
|
@ -36,7 +36,7 @@ local function link_action(pos)
|
|||
local stored_emc
|
||||
local target = inv:get_stack("target", 1):get_name()
|
||||
local output_stack = inv:get_stack("dst", 1)
|
||||
local in_indiv_emc = exchangeclone.get_item_emc(input_stack:peek_item(1)) or 0
|
||||
local in_indiv_emc = exchangeclone.get_item_emc(input_stack:peek_item()) or 0
|
||||
local target_emc = exchangeclone.get_item_emc(target)
|
||||
local stack_max = ItemStack(target):get_stack_max()
|
||||
|
||||
|
@ -102,7 +102,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
|||
return stack:get_count()
|
||||
end
|
||||
elseif listname == "target" then
|
||||
local single_item = stack:peek_item(1)
|
||||
local single_item = stack:peek_item()
|
||||
local emc = exchangeclone.get_item_emc(single_item)
|
||||
if emc and emc > 0 then
|
||||
minetest.get_meta(pos):get_inventory():set_stack("target", 1, ItemStack(exchangeclone.handle_alias(single_item)))
|
||||
|
@ -210,4 +210,13 @@ if exchangeclone.pipeworks then
|
|||
},
|
||||
on_rotate = pipeworks.on_rotate,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = "exchangeclone:emc_link",
|
||||
recipe = {
|
||||
{exchangeclone.itemstrings.obsidian, exchangeclone.itemstrings.diamond, exchangeclone.itemstrings.obsidian},
|
||||
{exchangeclone.itemstrings.diamond, "exchangeclone:alchemical_chest", exchangeclone.itemstrings.diamond},
|
||||
{exchangeclone.itemstrings.obsidian, exchangeclone.itemstrings.diamond, exchangeclone.itemstrings.obsidian},
|
||||
}
|
||||
})
|
|
@ -131,6 +131,7 @@ local files = {
|
|||
"talisman_of_repair",
|
||||
"passive_stones",
|
||||
"emc_link",
|
||||
"dark_matter_pedestal",
|
||||
}
|
||||
|
||||
if exchangeclone.mcl or minetest.get_modpath("3d_armor") then
|
||||
|
|
|
@ -42,6 +42,11 @@ minetest.register_tool("exchangeclone:soul_stone", {
|
|||
active_image = "exchangeclone_soul_stone_active.png",
|
||||
exclude = {"exchangeclone:life_stone"}
|
||||
},
|
||||
_exchangeclone_pedestal = function(pos)
|
||||
for _, player in minetest.get_objects_inside_radius(pos, 5) do
|
||||
heal(player, 2)
|
||||
end
|
||||
end,
|
||||
on_secondary_use = exchangeclone.toggle_active,
|
||||
on_place = exchangeclone.toggle_active,
|
||||
groups = {exchangeclone_passive = 1, disable_repair = 1}
|
||||
|
@ -71,6 +76,13 @@ if (exchangeclone.mcl and mcl_hunger.active) or (exchangeclone.mtg and minetest.
|
|||
active_image = "exchangeclone_body_stone_active.png",
|
||||
exclude = {"exchangeclone:life_stone"}
|
||||
},
|
||||
_exchangeclone_pedestal = function(pos)
|
||||
for _, object in pairs(minetest.get_objects_inside_radius(pos, 5)) do
|
||||
if object:is_player() then
|
||||
heal(object, 2)
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_secondary_use = exchangeclone.toggle_active,
|
||||
on_place = exchangeclone.toggle_active,
|
||||
groups = {exchangeclone_passive = 1, disable_repair = 1}
|
||||
|
@ -108,6 +120,14 @@ if (exchangeclone.mcl and mcl_hunger.active) or (exchangeclone.mtg and minetest.
|
|||
active_image = "exchangeclone_life_stone_active.png",
|
||||
exclude = {"exchangeclone:body_stone", "exchangeclone:soul_stone"}
|
||||
},
|
||||
_exchangeclone_pedestal = function(pos)
|
||||
for _, object in pairs(minetest.get_objects_inside_radius(pos, 5)) do
|
||||
if object:is_player() then
|
||||
heal(object, 2)
|
||||
satiate(object, 2)
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_secondary_use = exchangeclone.toggle_active,
|
||||
on_place = exchangeclone.toggle_active,
|
||||
groups = {exchangeclone_passive = 1, disable_repair = 1},
|
||||
|
|
|
@ -116,7 +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)
|
||||
local single_item = stack:peek_item()
|
||||
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 {}
|
||||
|
|
Loading…
Reference in New Issue