1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Market item settable in config

This commit is contained in:
grilledham 2018-08-21 11:50:14 +01:00
parent cde2ae60ab
commit f465e653ac
6 changed files with 84 additions and 76 deletions

View File

@ -1,4 +1,5 @@
_DEBUG = false
MARKET_ITEM = 'raw-fish'
global.scenario = {}
global.scenario.variables = {}

View File

@ -36,7 +36,7 @@ local function player_created(event)
return
end
player.insert {name = 'coin', count = 10}
player.insert {name = MARKET_ITEM, count = 10}
player.insert {name = 'iron-gear-wheel', count = 8}
player.insert {name = 'iron-plate', count = 16}
player.print('Welcome to our Server. You can join our Discord at: redmew.com/discord')

View File

@ -21,7 +21,8 @@ local Token = require 'utils.global_token'
local Task = require 'utils.Task'
local PlayerStats = require 'player_stats'
local market_items = require 'resources.market_items'
local Market_items = require 'resources.market_items'
local market_item = Market_items.market_item
local function spawn_market(cmd)
local player = game.player
@ -38,14 +39,14 @@ local function spawn_market(cmd)
local market = surface.create_entity {name = 'market', position = pos}
market.destructible = false
for _, item in ipairs(market_items) do
for _, item in ipairs(Market_items) do
market.add_market_item(item)
end
force.add_chart_tag(
surface,
{
icon = {type = 'item', name = 'coin'},
icon = {type = 'item', name = market_item},
position = pos,
text = ' Market'
}
@ -115,7 +116,7 @@ local function fish_earned(event, amount)
local player_index = event.player_index
local player = game.players[player_index]
local stack = {name = 'coin', count = amount}
local stack = {name = market_item, count = amount}
local inserted = player.insert(stack)
local diff = amount - inserted
@ -169,7 +170,7 @@ local entity_drop_amount = {
local spill_items =
Token.register(
function(data)
local stack = {name = 'coin', count = data.count}
local stack = {name = market_item, count = data.count}
data.surface.spill_item_stack(data.position, stack, true)
end
)

View File

@ -249,4 +249,7 @@ Gui.on_custom_close(
)
local market_items = require 'resources.market_items'
table.insert(market_items, {price = {{'coin', 100}}, offer = {type = 'give-item', item = 'infinity-chest'}})
table.insert(
market_items,
{price = {{market_items.market_item, 100}}, offer = {type = 'give-item', item = 'infinity-chest'}}
)

View File

@ -1,70 +1,73 @@
return {
{
price = {{'coin', 10}},
offer = {type = 'nothing', effect_description = 'Temporary speed bonus - Price 10 Fish'}
},
{
price = {{'coin', 10}},
offer = {type = 'nothing', effect_description = 'Temporary mining bonus - Price 10 Fish'}
},
{price = {{'coin', 2}}, offer = {type = 'give-item', item = 'raw-fish'}},
{price = {{'coin', 15}}, offer = {type = 'give-item', item = 'steel-axe'}},
{price = {{'coin', 15}}, offer = {type = 'give-item', item = 'submachine-gun'}},
{price = {{'coin', 15}}, offer = {type = 'give-item', item = 'shotgun'}},
{price = {{'coin', 250}}, offer = {type = 'give-item', item = 'combat-shotgun'}},
{price = {{'coin', 25}}, offer = {type = 'give-item', item = 'railgun'}},
{price = {{'coin', 250}}, offer = {type = 'give-item', item = 'flamethrower'}},
{price = {{'coin', 175}}, offer = {type = 'give-item', item = 'rocket-launcher'}},
{price = {{'coin', 250}}, offer = {type = 'give-item', item = 'tank-cannon'}},
{price = {{'coin', 750}}, offer = {type = 'give-item', item = 'tank-machine-gun'}},
{price = {{'coin', 75}}, offer = {type = 'give-item', item = 'tank-flamethrower'}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'artillery-wagon-cannon'}},
{price = {{'coin', 1}}, offer = {type = 'give-item', item = 'firearm-magazine'}},
{price = {{'coin', 5}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine'}},
{price = {{'coin', 20}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine'}},
{price = {{'coin', 2}}, offer = {type = 'give-item', item = 'shotgun-shell'}},
{price = {{'coin', 10}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell'}},
{price = {{'coin', 5}}, offer = {type = 'give-item', item = 'railgun-dart'}},
{price = {{'coin', 25}}, offer = {type = 'give-item', item = 'flamethrower-ammo'}},
{price = {{'coin', 15}}, offer = {type = 'give-item', item = 'rocket'}},
{price = {{'coin', 25}}, offer = {type = 'give-item', item = 'explosive-rocket'}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'atomic-bomb'}},
{price = {{'coin', 20}}, offer = {type = 'give-item', item = 'cannon-shell'}},
{price = {{'coin', 30}}, offer = {type = 'give-item', item = 'explosive-cannon-shell'}},
{price = {{'coin', 75}}, offer = {type = 'give-item', item = 'explosive-uranium-cannon-shell'}},
{price = {{'coin', 100}}, offer = {type = 'give-item', item = 'artillery-shell'}},
{price = {{'coin', 1}}, offer = {type = 'give-item', item = 'land-mine'}},
{price = {{'coin', 5}}, offer = {type = 'give-item', item = 'grenade'}},
{price = {{'coin', 35}}, offer = {type = 'give-item', item = 'cluster-grenade'}},
{price = {{'coin', 5}}, offer = {type = 'give-item', item = 'defender-capsule'}},
--{price = {{'coin', 15}}, offer = {type = 'give-item', item = 'distractor-capsule'}}, Removed so we dont have 51 items and they are useless anyways
{price = {{'coin', 75}}, offer = {type = 'give-item', item = 'destroyer-capsule'}},
{price = {{'coin', 35}}, offer = {type = 'give-item', item = 'poison-capsule'}},
{price = {{'coin', 35}}, offer = {type = 'give-item', item = 'slowdown-capsule'}},
{price = {{'coin', 50}}, offer = {type = 'give-item', item = 'artillery-targeting-remote'}},
{price = {{'coin', 1000}}, offer = {type = 'give-item', item = 'artillery-turret'}},
{price = {{'coin', 350}}, offer = {type = 'give-item', item = 'modular-armor'}},
{price = {{'coin', 875}}, offer = {type = 'give-item', item = 'power-armor'}},
{price = {{'coin', 40}}, offer = {type = 'give-item', item = 'solar-panel-equipment'}},
{price = {{'coin', 875}}, offer = {type = 'give-item', item = 'fusion-reactor-equipment'}},
{price = {{'coin', 100}}, offer = {type = 'give-item', item = 'battery-equipment'}},
{price = {{'coin', 625}}, offer = {type = 'give-item', item = 'battery-mk2-equipment'}},
{price = {{'coin', 250}}, offer = {type = 'give-item', item = 'belt-immunity-equipment'}},
{price = {{'coin', 100}}, offer = {type = 'give-item', item = 'night-vision-equipment'}},
{price = {{'coin', 150}}, offer = {type = 'give-item', item = 'exoskeleton-equipment'}},
{price = {{'coin', 250}}, offer = {type = 'give-item', item = 'personal-roboport-equipment'}},
{price = {{'coin', 25}}, offer = {type = 'give-item', item = 'construction-robot'}},
{price = {{'coin', 350}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
{price = {{'coin', 350}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
{price = {{'coin', 1}}, offer = {type = 'give-item', item = 'refined-hazard-concrete'}},
{price = {{'coin', 75}}, offer = {type = 'give-item', item = 'loader'}},
{price = {{'coin', 150}}, offer = {type = 'give-item', item = 'fast-loader'}},
{price = {{'coin', 225}}, offer = {type = 'give-item', item = 'express-loader'}},
local market_item = MARKET_ITEM or 'coin'
--[[ {price = {{'coin', 5}}, offer = {type = 'give-item', item = 'science-pack-1'}},
{price = {{'coin', 10}}, offer = {type = 'give-item', item = 'science-pack-2'}},
{price = {{'coin', 15}}, offer = {type = 'give-item', item = 'science-pack-3'}},
{price = {{'coin', 15}}, offer = {type = 'give-item', item = 'military-science-pack'}},
{price = {{'coin', 20}}, offer = {type = 'give-item', item = 'production-science-pack'}},
{price = {{'coin', 25}}, offer = {type = 'give-item', item = 'high-tech-science-pack'}}, ]]
return {
market_item = market_item,
{
price = {{market_item, 10}},
offer = {type = 'nothing', effect_description = 'Temporary speed bonus - Price 10 ' .. market_item}
},
{
price = {{market_item, 10}},
offer = {type = 'nothing', effect_description = 'Temporary mining bonus - Price 10 ' .. market_item}
},
{price = {{market_item, 2}}, offer = {type = 'give-item', item = 'raw-fish'}},
{price = {{market_item, 15}}, offer = {type = 'give-item', item = 'steel-axe'}},
{price = {{market_item, 15}}, offer = {type = 'give-item', item = 'submachine-gun'}},
{price = {{market_item, 15}}, offer = {type = 'give-item', item = 'shotgun'}},
{price = {{market_item, 250}}, offer = {type = 'give-item', item = 'combat-shotgun'}},
{price = {{market_item, 25}}, offer = {type = 'give-item', item = 'railgun'}},
{price = {{market_item, 250}}, offer = {type = 'give-item', item = 'flamethrower'}},
{price = {{market_item, 175}}, offer = {type = 'give-item', item = 'rocket-launcher'}},
{price = {{market_item, 250}}, offer = {type = 'give-item', item = 'tank-cannon'}},
{price = {{market_item, 750}}, offer = {type = 'give-item', item = 'tank-machine-gun'}},
{price = {{market_item, 75}}, offer = {type = 'give-item', item = 'tank-flamethrower'}},
{price = {{market_item, 2500}}, offer = {type = 'give-item', item = 'artillery-wagon-cannon'}},
{price = {{market_item, 1}}, offer = {type = 'give-item', item = 'firearm-magazine'}},
{price = {{market_item, 5}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine'}},
{price = {{market_item, 20}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine'}},
{price = {{market_item, 2}}, offer = {type = 'give-item', item = 'shotgun-shell'}},
{price = {{market_item, 10}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell'}},
{price = {{market_item, 5}}, offer = {type = 'give-item', item = 'railgun-dart'}},
{price = {{market_item, 25}}, offer = {type = 'give-item', item = 'flamethrower-ammo'}},
{price = {{market_item, 15}}, offer = {type = 'give-item', item = 'rocket'}},
{price = {{market_item, 25}}, offer = {type = 'give-item', item = 'explosive-rocket'}},
{price = {{market_item, 2500}}, offer = {type = 'give-item', item = 'atomic-bomb'}},
{price = {{market_item, 20}}, offer = {type = 'give-item', item = 'cannon-shell'}},
{price = {{market_item, 30}}, offer = {type = 'give-item', item = 'explosive-cannon-shell'}},
{price = {{market_item, 75}}, offer = {type = 'give-item', item = 'explosive-uranium-cannon-shell'}},
{price = {{market_item, 100}}, offer = {type = 'give-item', item = 'artillery-shell'}},
{price = {{market_item, 1}}, offer = {type = 'give-item', item = 'land-mine'}},
{price = {{market_item, 5}}, offer = {type = 'give-item', item = 'grenade'}},
{price = {{market_item, 35}}, offer = {type = 'give-item', item = 'cluster-grenade'}},
{price = {{market_item, 5}}, offer = {type = 'give-item', item = 'defender-capsule'}},
--{price = {{market_item, 15}}, offer = {type = 'give-item', item = 'distractor-capsule'}}, Removed so we dont have 51 items and they are useless anyways
{price = {{market_item, 75}}, offer = {type = 'give-item', item = 'destroyer-capsule'}},
{price = {{market_item, 35}}, offer = {type = 'give-item', item = 'poison-capsule'}},
{price = {{market_item, 35}}, offer = {type = 'give-item', item = 'slowdown-capsule'}},
{price = {{market_item, 50}}, offer = {type = 'give-item', item = 'artillery-targeting-remote'}},
{price = {{market_item, 1000}}, offer = {type = 'give-item', item = 'artillery-turret'}},
{price = {{market_item, 350}}, offer = {type = 'give-item', item = 'modular-armor'}},
{price = {{market_item, 875}}, offer = {type = 'give-item', item = 'power-armor'}},
{price = {{market_item, 40}}, offer = {type = 'give-item', item = 'solar-panel-equipment'}},
{price = {{market_item, 875}}, offer = {type = 'give-item', item = 'fusion-reactor-equipment'}},
{price = {{market_item, 100}}, offer = {type = 'give-item', item = 'battery-equipment'}},
{price = {{market_item, 625}}, offer = {type = 'give-item', item = 'battery-mk2-equipment'}},
{price = {{market_item, 250}}, offer = {type = 'give-item', item = 'belt-immunity-equipment'}},
{price = {{market_item, 100}}, offer = {type = 'give-item', item = 'night-vision-equipment'}},
{price = {{market_item, 150}}, offer = {type = 'give-item', item = 'exoskeleton-equipment'}},
{price = {{market_item, 250}}, offer = {type = 'give-item', item = 'personal-roboport-equipment'}},
{price = {{market_item, 25}}, offer = {type = 'give-item', item = 'construction-robot'}},
{price = {{market_item, 350}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
{price = {{market_item, 350}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
{price = {{market_item, 1}}, offer = {type = 'give-item', item = 'refined-hazard-concrete'}},
{price = {{market_item, 75}}, offer = {type = 'give-item', item = 'loader'}},
{price = {{market_item, 150}}, offer = {type = 'give-item', item = 'fast-loader'}},
{price = {{market_item, 225}}, offer = {type = 'give-item', item = 'express-loader'}}
--[[ {price = {{market_item, 5}}, offer = {type = 'give-item', item = 'science-pack-1'}},
{price = {{market_item, 10}}, offer = {type = 'give-item', item = 'science-pack-2'}},
{price = {{market_item, 15}}, offer = {type = 'give-item', item = 'science-pack-3'}},
{price = {{market_item, 15}}, offer = {type = 'give-item', item = 'military-science-pack'}},
{price = {{market_item, 20}}, offer = {type = 'give-item', item = 'production-science-pack'}},
{price = {{market_item, 25}}, offer = {type = 'give-item', item = 'high-tech-science-pack'}}, ]]
}

View File

@ -5,7 +5,7 @@ local Global = require 'utils.global'
local saviour_token_name = 'small-plane' -- item name for what saves players
local saviour_timeout = 180 -- number of ticks players are train immune after getting hit (roughly)
table.insert(Market_items, {price = {{'coin', 100}}, offer = {type = 'give-item', item = saviour_token_name}})
table.insert(Market_items, {price = {{Market_items.market_item, 100}}, offer = {type = 'give-item', item = saviour_token_name}})
local remove_stack = {name = saviour_token_name, count = 1}