1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-03 13:12:11 +02:00

market update

This commit is contained in:
MewMew 2019-04-19 23:06:45 +02:00
parent 1b85c9deb9
commit 1a97d501d9
4 changed files with 63 additions and 18 deletions

View File

@ -43,7 +43,7 @@ local function bounce(surface, position, ammo)
valid_entities = shuffle(valid_entities)
for c = 1, math.random(2,4), 1 do
for c = 1, math.random(3,5), 1 do
if not valid_entities[c] then return end
create_projectile(surface, position, valid_entities[c].position, ammo)
end

View File

@ -0,0 +1,31 @@
local event = require 'utils.event'
local radius = 32
local function on_player_used_capsule(event)
if not global.laser_pointer_unlocked then return end
local player = game.players[event.player_index]
local position = event.position
local used_item = event.item
if used_item.name ~= "artillery-targeting-remote" then return end
for _, unit in pairs(player.surface.find_enemy_units(position, radius, "player")) do
if math.random(1,2) == 1 then
unit.set_command({
type = defines.command.go_to_location,
destination = position,
radius = 2,
distraction = defines.distraction.none,
pathfind_flags = {
allow_destroy_friendly_entities = false,
prefer_straight_paths = false,
low_priority = false
}
})
end
end
end
event.add(defines.events.on_player_used_capsule, on_player_used_capsule)

View File

@ -3,6 +3,8 @@ require 'maps.fish_defender.trapped_capsules'
require 'maps.fish_defender.ultra_mines'
require 'maps.fish_defender.crumbly_walls'
require 'maps.fish_defender.vehicle_nanobots'
require 'maps.fish_defender.laser_pointer'
require 'maps.fish_defender.multi_rockets'
local event = require 'utils.event'
@ -22,7 +24,8 @@ local special_descriptions = {
["ultra-mines"] = "Unlock Ultra Mines - Careful with these...",
["railgun-enhancer"] = "Unlock Railgun Enhancer - Turns the railgun into a powerful forking gun.",
["crumbly-walls"] = "Unlock Crumbly Walls - Fortifications which crumble, may turn into rocks.",
["vehicle-nanobots"] = "Unlock Vehicle Nanobots - Your vehicles repair rapidly while driving.",
["vehicle-nanobots"] = "Unlock Vehicle Nanobots - Vehicles repair rapidly while driving.",
["laser-pointer"] = "Unlock Laser Pointer - The biters are on a quest to slay the red (artillery) dot."
}
local function refresh_market_offers()
@ -100,6 +103,7 @@ local function refresh_market_offers()
{price = {{"coin", 200}}, offer = {type = 'give-item', item = 'belt-immunity-equipment', count = 1}},
{price = {{"coin", 250}}, offer = {type = 'give-item', item = 'personal-roboport-equipment', count = 1}},
{price = {{"coin", 35}}, offer = {type = 'give-item', item = 'construction-robot', count = 1}},
{price = {{"coin", 25}}, offer = {type = 'give-item', item = 'cliff-explosives', count = 1}},
{price = {{"coin", 80}}, offer = {type = 'nothing', effect_description = special_descriptions["flame-boots"]}}
}
@ -107,26 +111,29 @@ local function refresh_market_offers()
global.market.add_market_item(item)
end
if not global.railgun_enhancer_unlocked then
global.market.add_market_item({price = {{"coin", 1500}}, offer = {type = 'nothing', effect_description = special_descriptions["railgun-enhancer"]}})
end
if not global.trapped_capsules_unlocked then
global.market.add_market_item({price = {{"coin", 3500}}, offer = {type = 'nothing', effect_description = special_descriptions["trapped-capsules"]}})
end
if not global.explosive_bullets_unlocked then
global.market.add_market_item({price = {{"coin", 5000}}, offer = {type = 'nothing', effect_description = special_descriptions["explosive-bullets"]}})
end
if not global.bouncy_shells_unlocked then
global.market.add_market_item({price = {{"coin", 7500}}, offer = {type = 'nothing', effect_description = special_descriptions["bouncy-shells"]}})
end
if not global.trapped_capsules_unlocked then
global.market.add_market_item({price = {{"coin", 2500}}, offer = {type = 'nothing', effect_description = special_descriptions["trapped-capsules"]}})
end
if not global.ultra_mines_unlocked then
global.market.add_market_item({price = {{"coin", 10000}}, offer = {type = 'nothing', effect_description = special_descriptions["ultra-mines"]}})
end
if not global.railgun_enhancer_unlocked then
global.market.add_market_item({price = {{"coin", 1500}}, offer = {type = 'nothing', effect_description = special_descriptions["railgun-enhancer"]}})
global.market.add_market_item({price = {{"coin", 10000}}, offer = {type = 'nothing', effect_description = special_descriptions["bouncy-shells"]}})
end
if not global.vehicle_nanobots_unlocked then
global.market.add_market_item({price = {{"coin", 15000}}, offer = {type = 'nothing', effect_description = special_descriptions["vehicle-nanobots"]}})
end
if not global.crumbly_walls_unlocked then
global.market.add_market_item({price = {{"coin", 25000}}, offer = {type = 'nothing', effect_description = special_descriptions["crumbly-walls"]}})
end
if not global.vehicle_nanobots_unlocked then
global.market.add_market_item({price = {{"coin", 12500}}, offer = {type = 'nothing', effect_description = special_descriptions["vehicle-nanobots"]}})
if not global.ultra_mines_unlocked then
global.market.add_market_item({price = {{"coin", 45000}}, offer = {type = 'nothing', effect_description = special_descriptions["ultra-mines"]}})
end
if not global.laser_pointer_unlocked then
global.market.add_market_item({price = {{"coin", 65000}}, offer = {type = 'nothing', effect_description = special_descriptions["laser-pointer"]}})
end
end
@ -213,6 +220,13 @@ local function on_market_item_purchased(event)
return
end
if bought_offer.effect_description == special_descriptions["laser-pointer"] then
game.print(player.name .. " has unleashed the quest to slay the red dot!", {r = 0.22, g = 0.77, b = 0.44})
global.laser_pointer_unlocked = true
refresh_market_offers()
return
end
if bought_offer.effect_description == special_descriptions["railgun-enhancer"] then
game.print(player.name .. " has unlocked the enhanced railgun!", {r = 0.22, g = 0.77, b = 0.44})
global.railgun_enhancer_unlocked = true

View File

@ -3,9 +3,9 @@ local event = require 'utils.event'
local radius = 20
local whitelist = {
["defender"] = true,
["distractor"] = true,
["destroyer"] = true
["defender"] = "explosive-cannon-projectile",
["distractor"] = "explosive-uranium-cannon-projectile",
["destroyer"] = "explosive-uranium-cannon-projectile"
}
local function on_entity_died(event)
@ -29,7 +29,7 @@ local function on_entity_died(event)
if not valid_targets[1] then return end
event.entity.surface.create_entity({
name = "explosive-cannon-projectile",
name = whitelist[event.entity.name],
position = position,
force = "player",
source = position,