Add smoke particles to cooking recipes as they stand now.
Like pummeling, this should give feedback when players are doing something right.
This commit is contained in:
parent
fd94d67389
commit
1f932edab4
@ -11,6 +11,9 @@ ISSUES: Bugs, Cleanup and Refinements
|
||||
|
||||
- Grass growing ABM needs rethunk.
|
||||
|
||||
- Healing mechanic sucks. Try using euclidian distance, raising base
|
||||
rate, tweaking weightings.
|
||||
|
||||
- API Cleanup
|
||||
- Guard minetest, nodecore, etc. against : calls instead of . calls.
|
||||
- Utils
|
||||
|
34
mods/nc_api/fx_smoke.lua
Normal file
34
mods/nc_api/fx_smoke.lua
Normal file
@ -0,0 +1,34 @@
|
||||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local minetest, nodecore
|
||||
= minetest, nodecore
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
|
||||
local smoking = {}
|
||||
|
||||
function nodecore.smoke(pos, time)
|
||||
local now = minetest.get_us_time() / 1000000
|
||||
local key = minetest.hash_node_position(pos)
|
||||
local old = smoking[key]
|
||||
if old and now < old.exp then minetest.delete_particlespawner(old.id) end
|
||||
if (not time) or (time <= 0) then
|
||||
smoking[key] = nil
|
||||
return
|
||||
end
|
||||
smoking[key] = {
|
||||
id = minetest.add_particlespawner({
|
||||
texture = "nc_api_smoke.png",
|
||||
collisiondetection = true,
|
||||
amount = 4 * time,
|
||||
time = time,
|
||||
minpos = {x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4},
|
||||
maxpos = {x = pos.x + 0.4, y = pos.y + 0.4, z = pos.z + 0.4},
|
||||
minvel = {x = -0.1, y = 0.3, z = -0.1},
|
||||
maxvel = {x = 0.1, y = 0.7, z = 0.1},
|
||||
minexptime = 1,
|
||||
maxexptime = 5,
|
||||
minsize = 1,
|
||||
maxsize = 3
|
||||
}),
|
||||
exp = now + time
|
||||
}
|
||||
end
|
@ -34,6 +34,7 @@ include("util_facedir")
|
||||
include("match")
|
||||
|
||||
include("fx_digparticles")
|
||||
include("fx_smoke")
|
||||
|
||||
include("register_limited_abm")
|
||||
include("mapgen_shared")
|
||||
|
BIN
mods/nc_api/textures/nc_api_smoke.png
Normal file
BIN
mods/nc_api/textures/nc_api_smoke.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 256 B |
@ -78,7 +78,7 @@ local function heated(pos)
|
||||
if f >= 3 then return true end
|
||||
end
|
||||
|
||||
local function timecounter(meta, max, check)
|
||||
local function timecounter(meta, max, check, smokepos)
|
||||
if not check then
|
||||
local t = meta:to_table()
|
||||
t.fields.time = nil
|
||||
@ -86,8 +86,12 @@ local function timecounter(meta, max, check)
|
||||
return
|
||||
end
|
||||
local t = (meta:get_int("time") or 0) + 1
|
||||
if t >= max then return true end
|
||||
if t >= max then
|
||||
if smokepos then nodecore.smoke(smokepos) end
|
||||
return true
|
||||
end
|
||||
meta:set_int("time", t)
|
||||
if smokepos then nodecore.smoke(smokepos, 1) end
|
||||
end
|
||||
|
||||
local logadj = math_log(2)
|
||||
@ -106,7 +110,8 @@ nodecore.register_limited_abm({
|
||||
action = function(pos, node)
|
||||
local below = {x = pos.x, y = pos.y - 1, z = pos.z}
|
||||
if timecounter(minetest:get_meta(pos), 30,
|
||||
not nodecore.match(below, {walkable = true}) and heated(pos)) then
|
||||
not nodecore.match(below, {walkable = true}) and heated(pos),
|
||||
pos) then
|
||||
nodecore.item_eject(below, modname .. ":prill_hot " .. exporand())
|
||||
minetest:get_meta(pos):from_table({})
|
||||
return nodecore.set_node(pos, {name = "nc_terrain:cobble"})
|
||||
@ -138,7 +143,7 @@ nodecore.register_limited_abm({
|
||||
return replacestack(pos, def.metal_alt_annealed, stack)
|
||||
end
|
||||
elseif (def.metal_temper_annealed or def.metal_temper_tempered)
|
||||
and timecounter(stack:get_meta(), 30, heated(pos)) then
|
||||
and timecounter(stack:get_meta(), 30, heated(pos), pos) then
|
||||
return replacestack(pos, def.metal_alt_hot, stack)
|
||||
end
|
||||
return nodecore.stack_set(pos, stack)
|
||||
|
@ -21,16 +21,20 @@ local function heated(pos)
|
||||
if f >= 3 then return true end
|
||||
end
|
||||
|
||||
local function timecounter(meta, max, check)
|
||||
local function timecounter(meta, max, check, smokepos)
|
||||
if not check then
|
||||
local t = meta:to_table()
|
||||
t.fields.glasscook = nil
|
||||
t.fields.time = nil
|
||||
meta:from_table(t)
|
||||
return
|
||||
end
|
||||
local t = (meta:get_int("glasscook") or 0) + 1
|
||||
if t >= max then return true end
|
||||
meta:set_int("glasscook", t)
|
||||
local t = (meta:get_int("time") or 0) + 1
|
||||
if t >= max then
|
||||
if smokepos then nodecore.smoke(smokepos) end
|
||||
return true
|
||||
end
|
||||
meta:set_int("time", t)
|
||||
if smokepos then nodecore.smoke(smokepos, 1) end
|
||||
end
|
||||
|
||||
nodecore.register_limited_abm({
|
||||
@ -40,7 +44,7 @@ nodecore.register_limited_abm({
|
||||
nodenames = {"nc_terrain:sand_loose"},
|
||||
neighbors = {"group:flame"},
|
||||
action = function(pos, node)
|
||||
if timecounter(minetest:get_meta(pos), 20, heated(pos)) then
|
||||
if timecounter(minetest:get_meta(pos), 20, heated(pos), pos) then
|
||||
minetest:get_meta(pos):from_table({})
|
||||
return minetest.set_node(pos, {name = modname .. ":glass_hot_source"})
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user