mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-03 14:53:01 +02:00
Update control.lua
This commit is contained in:
parent
2c1d0bf077
commit
3ff389c9d4
24
control.lua
24
control.lua
@ -226,24 +226,6 @@ end
|
|||||||
global.cheated_items = {}
|
global.cheated_items = {}
|
||||||
global.cheated_items_by_timestamp = {}
|
global.cheated_items_by_timestamp = {}
|
||||||
|
|
||||||
local Token = require 'utils.global_token'
|
|
||||||
local Task = require 'utils.Task'
|
|
||||||
|
|
||||||
local remove_token =
|
|
||||||
Token.register(
|
|
||||||
function(data)
|
|
||||||
local p = data.player
|
|
||||||
local stack = data.stack
|
|
||||||
|
|
||||||
local removed = p.remove_item(stack)
|
|
||||||
|
|
||||||
if removed > 0 then
|
|
||||||
stack.count = removed
|
|
||||||
p.surface.spill_item_stack(p.position, stack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_player_crafted_item,
|
defines.events.on_player_crafted_item,
|
||||||
function(event)
|
function(event)
|
||||||
@ -268,12 +250,6 @@ Event.add(
|
|||||||
local count = user_item_record.count
|
local count = user_item_record.count
|
||||||
local time = user_item_record['time'] or format_time(game.tick)
|
local time = user_item_record['time'] or format_time(game.tick)
|
||||||
data[name] = {count = stack.count + count, time = time}
|
data[name] = {count = stack.count + count, time = time}
|
||||||
|
|
||||||
if _DEBUG then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
Task.set_timeout_in_ticks(1, remove_token, {player = p, stack = stack})
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user