1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Additional ways to earn fish by contributing to the factory

This commit is contained in:
TWLTriston 2017-10-15 07:33:51 -04:00
parent 3d6a105dd2
commit f4f644d721

View File

@ -57,7 +57,7 @@ function spawn_market(cmd)
local market = surface.create_entity{name="market", position=market_location, force=force}
market.destructible = false
market.add_market_item{price={{"raw-fish", 10}}, offer={type="give-item", item="exoskeleton-equipment"}}
market.add_market_item{price={{"raw-fish", 10}}, offer={type="give-item", item="discharge-defense-remote"}}
market.add_market_item{price={{"raw-fish", 30}}, offer={type="give-item", item="small-plane"}}
market.add_market_item{price={{"raw-fish", 1}}, offer={type="give-item", item="rail", count=2}}
market.add_market_item{price={{"raw-fish", 2}}, offer={type="give-item", item="rail-signal"}}
@ -79,11 +79,13 @@ function spawn_market(cmd)
market.add_market_item{price={{"raw-fish", 15}}, offer={type="give-item", item="rocket"}}
market.add_market_item{price={{"raw-fish", 20}}, offer={type="give-item", item="explosive-rocket"}}
market.add_market_item{price={{"raw-fish", 2500}}, offer={type="give-item", item="atomic-bomb"}}
market.add_market_item{price={{"raw-fish", 25}}, offer={type="give-item", item="railgun"}}
market.add_market_item{price={{"raw-fish", 10}}, offer={type="give-item", item="railgun-dart", count=10}}
market.add_market_item{price={{"raw-fish", 100}}, offer={type="give-item", item="loader"}}
market.add_market_item{price={{"raw-fish", 175}}, offer={type="give-item", item="fast-loader"}}
market.add_market_item{price={{"raw-fish", 250}}, offer={type="give-item", item="express-loader"}}
market.add_market_item{price={{"raw-fish", 1000}}, offer={type="give-item", item="belt-immunity-equipment"}}
market.add_market_item{price={{"raw-fish", 100}}, offer={type="give-item", item="modular-armor"}}
market.add_market_item{price={{"raw-fish", 200}}, offer={type="give-item", item="modular-armor"}}
market.add_market_item{price={{"raw-fish", 500}}, offer={type="give-item", item="power-armor"}}
market.add_market_item{price={{"raw-fish", 2000}}, offer={type="give-item", item="power-armor-mk2"}}
market.add_market_item{price={{"raw-fish", 150}}, offer={type="give-item", item="personal-roboport-equipment"}}
@ -242,7 +244,7 @@ local function market_item_purchased(event)
market_item = market_items[event.offer_index]
fish_cost = market_item.price[1].amount * event.count
global.fish_market_fish_spent[event.player_index] = global.fish_market_fish_spent[event.player_index] + fish_cost
if event.offer_index == 1 then -- exoskeleton-equipment
player.get_inventory(defines.inventory.player_main).remove({name="exoskeleton-equipment", count=event.count})
boost_player_runningspeed(player)
@ -339,7 +341,35 @@ function fish_market_on_180_ticks()
end
end
function fish_built_entity (event)
entity = event.created_entity
if entity.type == "entity-ghost" then
-- No reward for ghosts / bps
return
end
-- player_index = event.player_index
if entity.type == "furnace" then
local x = math.random(1,5)
if x == 1 then
fish_earned(event, 5)
end
elseif entity.type == "assembling-machine" then
local x = math.random(1,5)
if x == 1 then
fish_earned(event, 5)
end
elseif entity.type == "mining-drill" then
local x = math.random(1,5)
if x == 1 then
fish_earned(event, 5)
end
end
end
Event.register(defines.events.on_preplayer_mined_item, preplayer_mined_item)
Event.register(defines.events.on_entity_died, fish_drop_entity_died)
Event.register(defines.events.on_market_item_purchased, market_item_purchased)
Event.register(defines.events.on_built_entity, fish_built_entity)