Commit f86ae6d7 authored by Rob Nelson's avatar Rob Nelson
Browse files

initial commit

parents
{
"startup": {
"rampant-useDumbProjectiles": {
"value": true
},
"rampant-useNEUnitLaunchers": {
"value": true
},
"angels-infinite-ores-yield": {
"value": 20
},
"angels-oil-gas-yield": {
"value": 20
},
"angels-fissure-yield": {
"value": 20
},
"angels-lower-infinite-yield": {
"value": 1
},
"angels-enablefluidreq": {
"value": true
},
"angels-enableinfiniteiron": {
"value": true
},
"angels-enableinfinitecopper": {
"value": true
},
"angels-enableinfinitestone": {
"value": true
},
"angels-enableinfinitecoal": {
"value": true
},
"angels-enableinfiniteuranium": {
"value": true
},
"angels-enableinfiniteangelsore1": {
"value": true
},
"angels-enableinfiniteangelsore2": {
"value": true
},
"angels-enableinfiniteangelsore3": {
"value": true
},
"angels-enableinfiniteangelsore4": {
"value": true
},
"angels-enableinfiniteangelsore5": {
"value": true
},
"angels-enableinfiniteangelsore6": {
"value": true
},
"angels-enableinfinitebobbauxite": {
"value": true
},
"angels-enableinfinitebobcobalt": {
"value": true
},
"angels-enableinfinitebobgems": {
"value": true
},
"angels-enableinfinitebobgold": {
"value": true
},
"angels-enableinfiniteboblead": {
"value": true
},
"angels-enableinfinitebobnickel": {
"value": true
},
"angels-enableinfinitebobquartz": {
"value": true
},
"angels-enableinfinitebobrutile": {
"value": true
},
"angels-enableinfinitebobsilver": {
"value": true
},
"angels-enableinfinitebobsulfur": {
"value": true
},
"angels-enableinfinitebobtin": {
"value": true
},
"angels-enableinfinitebobtungsten": {
"value": true
},
"angels-enableinfinitebobzinc": {
"value": true
},
"angels-enableinfiniteyuoki": {
"value": true
},
"angels-enableinfiniteuraniumpower": {
"value": true
},
"angels-enableinfinitedarkmatter": {
"value": true
},
"angels-hide-converter": {
"value": true
},
"angels-enable-acids": {
"value": true
},
"angels-enable-auto-barreling": {
"value": false
},
"bobmods-assembly-chemicalplants": {
"value": true
},
"bobmods-assembly-electrolysers": {
"value": true
},
"bobmods-assembly-electronicmachines": {
"value": true
},
"bobmods-assembly-furnaces": {
"value": true
},
"bobmods-assembly-multipurposefurnaces": {
"value": true
},
"bobmods-assembly-oilrefineries": {
"value": true
},
"bobmods-enemies-aliensdropartifacts": {
"value": true
},
"bobmods-enemies-enableartifacts": {
"value": true
},
"bobmods-enemies-enablenewartifacts": {
"value": true
},
"bobmods-enemies-enablesmallartifacts": {
"value": true
},
"bobmods-logistics-drainlessinserters": {
"value": false
},
"bobmods-logistics-extremelyfastbelt": {
"value": true
},
"bobmods-logistics-flyingrobotframes": {
"value": true
},
"bobmods-logistics-roboportrecipeupdate": {
"value": true
},
"bobmods-logistics-robotparts": {
"value": true
},
"bobmods-logistics-robotrequireprevious": {
"value": true
},
"bobmods-mining-areadrills": {
"value": true
},
"bobmods-mining-miningaxes": {
"value": true
},
"bobmods-mining-miningdrills": {
"value": true
},
"bobmods-mining-pumpjacks": {
"value": true
},
"bobmods-mining-waterminers": {
"value": true
},
"bobmods-modules-enablegodmodules": {
"value": false
},
"bobmods-modules-enablegreenmodules": {
"value": true
},
"bobmods-modules-enableproductivitylimitation": {
"value": true
},
"bobmods-modules-enablerawproductivitymodules": {
"value": true
},
"bobmods-modules-enablerawspeedmodules": {
"value": true
},
"bobmods-modules-perlevel-bonus-consumption": {
"value": 0.1
},
"bobmods-modules-perlevel-bonus-pollution": {
"value": 0.15
},
"bobmods-modules-perlevel-bonus-pollutioncreate": {
"value": 0.5
},
"bobmods-modules-perlevel-bonus-productivity": {
"value": 0.05
},
"bobmods-modules-perlevel-bonus-speed": {
"value": 0.2
},
"bobmods-modules-perlevel-penalty-consumption": {
"value": 0.1
},
"bobmods-modules-perlevel-penalty-pollution": {
"value": 0.15
},
"bobmods-modules-perlevel-penalty-speed": {
"value": 0.05
},
"bobmods-modules-productivityhasspeed": {
"value": false
},
"bobmods-modules-start-bonus-consumption": {
"value": 0
},
"bobmods-modules-start-bonus-pollution": {
"value": 0
},
"bobmods-modules-start-bonus-pollutioncreate": {
"value": 0
},
"bobmods-modules-start-bonus-productivity": {
"value": 0
},
"bobmods-modules-start-bonus-speed": {
"value": 0
},
"bobmods-modules-start-penalty-consumption": {
"value": 0
},
"bobmods-modules-start-penalty-pollution": {
"value": 0
},
"bobmods-modules-start-penalty-speed": {
"value": 0.2
},
"bobmods-modules-transmitproductivity": {
"value": false
},
"bobmods-gems-amethystratio": {
"value": 0.5
},
"bobmods-gems-diamondratio": {
"value": 0.2
},
"bobmods-gems-emeraldratio": {
"value": 0.6
},
"bobmods-gems-rubyratio": {
"value": 1
},
"bobmods-gems-sapphireratio": {
"value": 0.8
},
"bobmods-gems-topazratio": {
"value": 0.4
},
"bobmods-ores-enablebauxite": {
"value": false
},
"bobmods-ores-enablecobaltore": {
"value": false
},
"bobmods-ores-enablegemsore": {
"value": false
},
"bobmods-ores-enablegoldore": {
"value": false
},
"bobmods-ores-enableleadore": {
"value": false
},
"bobmods-ores-enablenickelore": {
"value": false
},
"bobmods-ores-enablequartz": {
"value": false
},
"bobmods-ores-enablerutile": {
"value": false
},
"bobmods-ores-enablesilverore": {
"value": false
},
"bobmods-ores-enablesulfur": {
"value": false
},
"bobmods-ores-enablethoriumore": {
"value": false
},
"bobmods-ores-enabletinore": {
"value": false
},
"bobmods-ores-enabletungstenore": {
"value": false
},
"bobmods-ores-enablewaterores": {
"value": false
},
"bobmods-ores-enablezincore": {
"value": false
},
"bobmods-ores-enhancestone": {
"value": true
},
"bobmods-ores-gemprobability": {
"value": 0.05
},
"bobmods-ores-gemsfromotherores": {
"value": false
},
"bobmods-ores-infiniteore": {
"value": true
},
"bobmods-ores-leadgivesnickel": {
"value": false
},
"bobmods-ores-leadnickelratio": {
"value": 0.6
},
"bobmods-ores-nickelcobaltratio": {
"value": 0.4
},
"bobmods-ores-nickelgivescobalt": {
"value": false
},
"bobmods-ores-unsortedgemore": {
"value": true
},
"bobmods-plates-batteryupdate": {
"value": true
},
"bobmods-plates-cheapersteel": {
"value": true
},
"bobmods-plates-inventorysize": {
"value": 60
},
"bobmods-plates-oreoverride": {
"value": true
},
"bobmods-vehicleequipment-enablevehiclegrids": {
"value": true
},
"bobmods-warfare-drainlesslaserturrets": {
"value": false
},
"bobmods-warfare-robotupdate": {
"value": true
},
"rso-vanilla-biter-generation": {
"value": false
}
},
"runtime-global": {
"rampant-attackWaveGenerationUsePollution": {
"value": true
},
"rampant-attackWaveGenerationUsePlayerProximity": {
"value": true
},
"rampant-attackWaveGenerationThresholdMin": {
"value": 0
},
"rampant-attackPlayerThreshold": {
"value": 7
},
"rampant-attackWaveGenerationThresholdMax": {
"value": 20
},
"rampant-attackWaveMaxSize": {
"value": 150
},
"rampant-safeBuildings": {
"value": true
},
"rampant-safeBuildings-curvedRail": {
"value": true
},
"rampant-safeBuildings-straightRail": {
"value": true
},
"rampant-safeBuildings-bigElectricPole": {
"value": true
},
"rampant-safeBuildings-railSignals": {
"value": true
},
"rampant-safeBuildings-railChainSignals": {
"value": true
},
"rampant-safeBuildings-trainStops": {
"value": true
},
"weed-radius": {
"value": 2
},
"nixie-tubes-enable-color-black": {
"value": false
},
"nixie-tubes-enable-color-grey": {
"value": false
},
"nixie-tubes-enable-color-white": {
"value": false
},
"nixie-tube-update-speed-alpha": {
"value": 10
},
"nixie-tube-update-speed-numeric": {
"value": 5
},
"rso-region-size": {
"value": 7
},
"rso-starting-richness-mult": {
"value": 1
},
"rso-resource-chance": {
"value": 0.5
},
"rso-global-richness-mult": {
"value": 1
},
"rso-global-size-mult": {
"value": 1
},
"rso-biter-generation": {
"value": true
},
"rso-enemy-chance": {
"value": 0.25
},
"rso-enemy-base-size": {
"value": 1
},
"rso-use-donuts": {
"value": false
},
"rso-remove-trees": {
"value": false
},
"rso-infinite-ores-in-start-area": {
"value": true
},
"rso-infinite-ore-threshold": {
"value": 0.7
},
"rso-reveal-spawned-resources": {
"value": true
}
},
"runtime-per-user": {}
}
require "util"
require "config"
local function find_resources(surface, position, range, resource_category)
local resource_category = resource_category or 'basic-solid'
local top_left = {x = position.x - range, y = position.y - range}
local bottom_right = {x = position.x + range, y = position.y + range}
local resources = surface.find_entities_filtered{area={top_left, bottom_right}, type='resource'}
categorized = {}
for _, resource in pairs(resources) do
if resource.prototype.resource_category == resource_category then
table.insert(categorized, resource)
end
end
return categorized
end
local function find_all_entities(entity_type)
local surface = game.surfaces['nauvis']
local entities = {}
for chunk in surface.get_chunks() do
local chunk_area = {lefttop = {x = chunk.x*32, y = chunk.y*32}, rightbottom = {x = chunk.x*32+32, y = chunk.y*32+32}}
local chunk_entities = surface.find_entities_filtered({area = chunk_area, type = entity_type})
for i = 1, #chunk_entities do
entities[#entities + 1] = chunk_entities[i]
end
end
return entities
end
local function find_target(entity)
if entity.drop_target then
return entity.drop_target
else
local entities = entity.surface.find_entities_filtered{position=entity.drop_position}
if global.debug then msg_all({"autodeconstruct-debug", "found " .. entities[1].name .. " at " .. util.positiontostr(entities[1].position)}) end
return entities[1]
end
end
local function find_targeting(entity)
local range = global.max_radius
local position = entity.position
local top_left = {x = position.x - range, y = position.y - range}
local bottom_right = {x = position.x + range, y = position.y + range}
local surface = entity.surface
local entities = {}
local targeting = {}
local entities = surface.find_entities_filtered{area={top_left, bottom_right}, type='mining-drill'}
for i = 1, #entities do
if find_target(entities[i]) == entity then
targeting[#targeting + 1] = entities[i]
end
end
entities = surface.find_entities_filtered{area={top_left, bottom_right}, type='inserter'}
for i = 1, #entities do
if find_target(entities[i]) == entity then
targeting[#targeting + 1] = entities[i]
end
end
if global.debug then msg_all({"autodeconstruct-debug", "found " .. #targeting .. " targeting"}) end
return targeting
end
local function find_drills(entity)
local position = entity.position
local surface = entity.surface
local top_left = {x = position.x - global.max_radius, y = position.y - global.max_radius}
local bottom_right = {x = position.x + global.max_radius, y = position.y + global.max_radius}
local entities = {}
local targeting = {}
local entities = surface.find_entities_filtered{area={top_left, bottom_right}, type='mining-drill'}
if global.debug then msg_all({"autodeconstruct-debug", "found " .. #entities .. " drills"}) end
for i = 1, #entities do
if math.abs(entities[i].position.x - position.x) < entities[i].prototype.mining_drill_radius and math.abs(entities[i].position.y - position.y) < entities[i].prototype.mining_drill_radius then
autodeconstruct.check_drill(entities[i])
end
end
end
function autodeconstruct.init_globals()
global.max_radius = 0.99
drill_entities = find_all_entities('mining-drill')
for _, drill_entity in pairs(drill_entities) do
autodeconstruct.check_drill(drill_entity)
end
end
function autodeconstruct.on_resource_depleted(event)
if event.entity.prototype.resource_category ~= 'basic-solid' or event.entity.prototype.infinite_resource ~= false then
if global.debug then msg_all({"autodeconstruct-debug", "on_resource_depleted", game.tick .. " amount " .. event.entity.amount .. " resource_category " .. event.entity.prototype.resource_category .. " infinite_resource " .. (event.entity.prototype.infinite_resource == true and "true" or "false" )}) end
return
end
drill = find_drills(event.entity)
end
function autodeconstruct.check_drill(drill)
if drill.mining_target ~= nil and drill.mining_target.valid then
if drill.mining_target.amount > 0 then return end -- this should also filter out pumpjacks and infinite resources
end
local mining_drill_radius = drill.prototype.mining_drill_radius
if mining_drill_radius > global.max_radius then
global.max_radius = mining_drill_radius
end
if mining_drill_radius == nil then return end
resources = find_resources(drill.surface, drill.position, mining_drill_radius)
for i = 1, #resources do
if resources[i].amount > 0 then return end
end
if global.debug then msg_all({"autodeconstruct-debug", util.positiontostr(drill.position) .. " found no resources, deconstructing"}) end
autodeconstruct.order_deconstruction(drill)
end
function autodeconstruct.on_canceled_deconstruction(event)
if event.player_index ~= nil or event.entity.type ~= 'mining-drill' then return end
if global.debug then msg_all({"autodeconstruct-debug", "on_canceled_deconstruction", util.positiontostr(event.entity.position) .. " deconstruction timed out, checking again"}) end
autodeconstruct.check_drill(event.entity)
end
function autodeconstruct.on_built_entity(event)
if event.created_entity.type ~= 'mining-drill' then return end
if event.created_entity.prototype.mining_drill_radius > global.max_radius then
global.max_radius = event.created_entity.prototype.mining_drill_radius
if global.debug then msg_all({"autodeconstruct-debug", "on_built_entity", "global.max_radius updated to " .. global.max_radius}) end
end
end
function autodeconstruct.order_deconstruction(drill)
if drill.to_be_deconstructed(drill.force) then
if global.debug then msg_all({"autodeconstruct-debug", util.positiontostr(drill.position) .. " already marked"}) end
return
end
local deconstruct = false
--[[ #TODO