Tong cooling/quenching recipes
Note that these are separate from the existing recipes used elsewhere out of necessity. Lode also anneals faster when carried (it's exposed to more air cooling).
This commit is contained in:
parent
8e503c9b93
commit
68ca7ad4c3
@ -207,25 +207,6 @@ IDEAS: Possible future additions/improvements to the game
|
||||
- Footsteps?
|
||||
- Can be used as a BUD
|
||||
|
||||
- Lode tongs?
|
||||
- Craft from bars/rods (or lode adzes?).
|
||||
- Add an API to hot potato
|
||||
- Scan for all hot potato items and produce a list of slot->bool
|
||||
- If any items found with an on_hot_potato callback, pass them
|
||||
that list (and player, inv, etc) to be modified.
|
||||
- If slot is marked "safe" then no hot potato if items are in
|
||||
a slot adjacent to tongs.
|
||||
- If slot is not marked safe, mark it safe if tongs or any tool
|
||||
are wielded item.
|
||||
- Unmark safe any slots that don't contain hot things after
|
||||
hot potato check.
|
||||
- Will probably need to unify damage_touch into an API that checks
|
||||
for damage given a player and a stack.
|
||||
- Check for hot potato.
|
||||
- Check upon pickup for anti-lode-move-exploit.
|
||||
- Reform rake recipes
|
||||
- Maybe 2x adze -> tongs, 2x tongs -> rake?
|
||||
|
||||
- Lux/lode ore in already-partly-dug cobble form in mapgen/ore?
|
||||
|
||||
- Dungeon loot
|
||||
|
@ -32,6 +32,7 @@ local function playcookfx(pos, cookfx, sound, smokeqty, smoketime)
|
||||
nodecore.smokefx(pos, smoketime, smokeqty)
|
||||
end
|
||||
end
|
||||
nodecore.playcookfx = playcookfx
|
||||
|
||||
local function inprogress(pos, data)
|
||||
local meta = minetest.get_meta(data.node)
|
||||
|
@ -7,7 +7,7 @@ local math_floor, math_random
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
|
||||
local tongs_holdable = nodecore.group_expand("group:lode_temper_hot", true)
|
||||
local hotlode = nodecore.group_expand("group:lode_temper_hot", true)
|
||||
|
||||
nodecore.register_lode("tongs", {
|
||||
type = "tool",
|
||||
@ -25,11 +25,12 @@ nodecore.register_lode("tongs", {
|
||||
|
||||
def.on_item_hotpotato = function(player, myslot, mystack, itemslot, itemstack, dtime)
|
||||
-- only works on glowing lode things
|
||||
if not tongs_holdable[itemstack:get_name()] then return end
|
||||
if not hotlode[itemstack:get_name()] then return end
|
||||
|
||||
-- item must be adjacent to tongs in inventory
|
||||
if myslot > itemslot + 1 or myslot < itemslot - 1 then return end
|
||||
|
||||
-- Apply tool wear/breakage.
|
||||
local dwear = wrate * (dtime or 3)
|
||||
dwear = math_floor(dwear) + (math_random() < (dwear - math_floor(dwear))
|
||||
and 1 or 0)
|
||||
@ -85,3 +86,35 @@ nodecore.register_craft({
|
||||
{name = modname .. ":rod_hot", count = 2}
|
||||
}
|
||||
})
|
||||
|
||||
local function coolto(pos, stack, tempername)
|
||||
local def = minetest.registered_items[stack:get_name()]
|
||||
if not def then return end
|
||||
local alt = def["lode_alt_" .. tempername]
|
||||
if not alt then return end
|
||||
nodecore.playcookfx(pos, true, "hiss", 80, 0.2)
|
||||
stack:set_name(alt)
|
||||
return stack
|
||||
end
|
||||
|
||||
nodecore.register_aism({
|
||||
label = "tong-carried lode cooling",
|
||||
itemnames = {"group:lode_temper_hot"},
|
||||
action = function(stack, data)
|
||||
-- Don't conflict with cooking ABMs already operating on stack nodes
|
||||
if data.node then return end
|
||||
|
||||
if nodecore.quenched(data.pos) then
|
||||
return coolto(data.pos, stack, "tempered")
|
||||
end
|
||||
|
||||
local meta = stack:get_meta()
|
||||
local time = (meta:get_float("~annealtime") or 0) + 1
|
||||
if time >= 60 then
|
||||
return coolto(data.pos, stack, "annealed")
|
||||
end
|
||||
nodecore.playcookfx(data.pos, {smoke = true}, "", 2, 1)
|
||||
meta:set_float("~annealtime", time)
|
||||
return stack
|
||||
end
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user