1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00
RedMew/map_gen/maps/space_race/market_handler.lua

35 lines
758 B
Lua
Raw Normal View History

2019-10-09 21:36:11 +02:00
local Retailer = require 'features.retailer'
local Events = require 'utils.event'
local function on_market_purchase(event)
local item = event.item
local name = item.name
local player = event.player
local force = player.force
if name == 'tank' then
player.insert('tank')
return
end
local research = force.technologies[name]
if research and research.valid then
research.enabled = true
Retailer.remove_item(event.group_name, name)
end
end
Events.add(Retailer.events.on_market_purchase, on_market_purchase)
--[[
raise_event(Retailer.events.on_market_purchase, {
item = item,
count = stack_count,
player = player,
group_name = market_group,
})
]]