Differences From
Artifact [1c1e9dd876]:
32 32 return items, charges
33 33 end
34 34
35 35 return function(user, ctx)
36 36 local function cleanup()
37 37 user.action.prog.shred = nil
38 38 if user.action.sfx.shred then
39 - minetest.sound_fade(user.action.sfx.shred, 1, 0)
39 + core.sound_fade(user.action.sfx.shred, 1, 0)
40 40 user.action.sfx.shred = nil
41 41 end
42 42 if user.action.fx.shred then
43 43 user.action.fx.shred.abort()
44 44 end
45 45 end
46 46
................................................................................
50 50 cleanup()
51 51 return false
52 52 end
53 53 local shredTime = 1.0
54 54 local soundPitch = 1.0 -- TODO
55 55 local pdraw = prop.powerDraw or 0
56 56
57 - if minetest.is_protected(what, user.entity:get_player_name()) then return end
58 - local node = minetest.get_node(what)
59 - local nd = minetest.registered_nodes[node.name]
57 + if core.is_protected(what, user.entity:get_player_name()) then return end
58 + local node = core.get_node(what)
59 + local nd = core.registered_nodes[node.name]
60 60 local elt, fab, vary
61 61 if nd._starlit then
62 62 fab = nd._starlit.recover or nd._starlit.fab
63 63 vary = nd._starlit.recover_vary
64 64 end
65 65 if fab then
66 66 if fab.flag then
................................................................................
86 86 if p < pdx then
87 87 cleanup()
88 88 return false
89 89 elseif not user.action.prog.shred then
90 90 cleanup() -- kill danglers
91 91 -- begin
92 92 user.action.prog.shred = 0
93 - user.action.sfx.shred = minetest.sound_play('starlit-nano-shred', {
93 + user.action.sfx.shred = core.sound_play('starlit-nano-shred', {
94 94 object = user.entity;
95 95 max_hear_distance = prop.range*2;
96 96 loop = true;
97 97 pitch = soundPitch;
98 98 })
99 99 user.action.fx.shred = starlit.fx.nano.shred(user, what, prop, shredTime, node)
100 100 else
101 101 user.action.prog.shred = user.action.prog.shred + ctx.how.delta or 0
102 102 end
103 103 --print('shred progress: ', user.action.prog.shred)
104 104 if user.action.prog.shred >= shredTime then
105 - minetest.remove_node(what)
106 - minetest.check_for_falling(what)
105 + core.remove_node(what)
106 + core.check_for_falling(what)
107 107 --print('shred complete')
108 108 user:suitSound 'starlit-success'
109 109 if fab then
110 110 local vf = fab
111 111 if vary then
112 - local rng = (starlit.world.seedbank+0xa891f62)[minetest.hash_node_position(what)]
112 + local rng = (starlit.world.seedbank+0xa891f62)[core.hash_node_position(what)]
113 113 vf = vf + vary(rng, {})
114 114 end
115 115 local items, charges = fabToItemsAndCharges(vf)
116 116 for i, it in ipairs(items) do user:give(it) end
117 117 -- TODO give gasses, liquids
118 118 end
119 119 cleanup()
................................................................................
253 253 run = function(user, ctx)
254 254 end;
255 255 --[[
256 256 bgProc = function(user, ctx, interval, runState)
257 257 if runState.flags.compiled == true then return false end
258 258 -- only so many nanides to go around
259 259 runState.flags.compiled = true
260 - local time = minetest.get_gametime()
260 + local time = core.get_gametime()
261 261 local cyclesLeft = ctx.comp.cycles * interval
262 262
263 263 for id, e in ipairs(ctx.file.body.conf) do
264 264 if e.key == 'job' then
265 265 local t = J.dec(e.value)
266 266 local remove = false
267 267 local r = starlit.item.sw.db[t.schematic]