adamo-physics/data-final-fixes.lua

245 lines
6.4 KiB
Lua
Raw Normal View History

2020-05-21 11:36:04 +00:00
require("factsheet")
-- Updates to rocket physics.
data.raw.ammo["rocket"].ammo_type.action.action_delivery.starting_speed = 0.95
data.raw.ammo["explosive-rocket"].ammo_type.action.action_delivery.starting_speed = .95
data.raw.projectile["rocket"].acceleration=0.8
data.raw.projectile["explosive-rocket"].acceleration=0.8
if data.raw.gun["rocket-launcher"] then
data.raw.gun["rocket-launcher"].attack_parameters.range=38
end
-- Reduce electric-turret drain by factor of 24.
for _,turret in pairs(data.raw["electric-turret"]) do
if turret.energy_source
and turret.energy_source.type
and turret.energy_source.type == "electric" then
turret.energy_source.drain =
energy_div(
(turret.energy_source.drain or "24kW"),
24
)
end
end
-- Pre rocket launcher
if data.raw["ammo-turret"]["pre-rocket-turret"] then
data.raw["ammo-turret"]["pre-rocket-turret"].attack_parameters.range=60
data.raw["ammo-turret"]["pre-rocket-turret"].attack_parameters.min_range=25
end
-- Aircraft mod launcher.
if data.raw.gun["aircraft-rocket-launcher"] then
data.raw.gun["aircraft-rocket-launcher"].
attack_parameters.range=60
end
-- Helicopter mod launcher
if data.raw.gun["heli-rocket-launcher-item"] then
data.raw.gun["heli-rocket-launcher-item"].attack_parameters.range=60
end
-- Predictabowl's vehicle rocket launcher
if data.raw.gun["vehicle-rocket-launcher"] then
data.raw.gun["vehicle-rocket-launcher"].attack_parameters.range=50
end
if data.raw.gun["vehicle-rocket-launcher-2"] then
data.raw.gun["vehicle-rocket-launcher-2"].attack_parameters.range=60
end
for _,heatpipe in pairs(data.raw["heat-pipe"]) do
heatpipe.heat_buffer.specific_heat =
energy_div(
heatpipe.heat_buffer.specific_heat,
nuke_fuel_quotient
)
heatpipe.heat_buffer.max_transfer =
energy_div(
heatpipe.heat_buffer.max_transfer,
gen_eff
)
end
local set_burner_colors = function(entity)
local entity = entity_or_bust(entity)
if not entity then return end
local burner = table_or_bust(get_energy_source(entity))
if not burner then return end
local color
if burner.type == "fluid" and burner.burns_fluid then
color = colors.gas_fire_glow
elseif uses_fuel_type("chemical",entity) then
color = colors.chemical_fire_glow
elseif burner.type == "heat" then
color = colors.chemical_fire_glow
else return end
local min_size = 0.05*get_collision_hypotenuse(entity)
local glow_num = 0.3*get_collision_hypotenuse(entity)
burner.light_flicker = {
color = color,
minimum_light_size = min_size,
light_intensity_to_size_coefficient = glow_num
}
local viz = table_or_bust(entity.working_visualisations)
if viz then
for _,subtab in pairs(viz) do
if type(subtab.light) == "table" then
subtab.light.color = color
end
end
end
log("Made physical burner colors for "
..entity.name
.." ("
..tostring(color.r)
.." "
..tostring(color.g)
.." "
..tostring(color.b)
..")"
)
end
for _,boiler in pairs(data.raw.boiler) do
boiler.target_temperature = chem_temp_max
boiler.fluid_box.height =
(boiler.fluid_box.height or 1)/gen_eff
boiler.output_fluid_box.height =
(boiler.output_fluid_box.height or 1)/gen_eff
boiler.energy_consumption = energy_div(
boiler.energy_consumption,gen_eff
)
if boiler.burner
and type(boiler.burner) == "table" then
boiler.burner.effectivity =
(boiler.burner.effectivity or 1)
*boiler_eff
end
if boiler.energy_source
and type(boiler.energy_source) == "table" then
boiler.energy_source.effectivity =
(boiler.energy_source.effectivity or 1)
*boiler_eff
if boiler.energy_source.type == "heat" then
boiler.target_temperature = nuke_temp_max
elseif boiler.energy_source.type == "electric" then
boiler.target_temperature = 100
else
set_burner_colors(boiler)
end
end
end
for _,generator in pairs(data.raw.generator) do
generator.effectivity =
(generator.effectivity or 1)
*gen_eff
if generator.fluid_box then
generator.fluid_box.height =
(generator.fluid_box.height or 1)/gen_eff
end
if generator.name:find "steam" then
if generator.name:find "turbine" then
generator.maximum_temperature = nuke_temp_max
else
generator.maximum_temperature = chem_temp_max
end
end
end
for _,item in pairs(data.raw.item) do
if item.fuel_value then
if item.fuel_category == "chemical" then
item.fuel_value = energy_div(
item.fuel_value,chem_fuel_quotient
)
elseif item.fuel_category == "nuclear"
or item.fuel_category
== "adamo-nuclear-thermal-reaction" then
item.fuel_value = energy_div(
item.fuel_value,nuke_fuel_quotient
)
end
end
end
for _,fluid in pairs(data.raw.fluid) do
if fluid.fuel_value then
fluid.fuel_value = energy_div(
fluid.fuel_value,chem_fuel_quotient
)
end
end
for _,furnace in pairs(data.raw.furnace) do
set_burner_colors(furnace)
if furnace.energy_source
and (
furnace.energy_source.type == "burner"
or furnace.energy_source.type == "fluid"
) then
furnace.energy_source.effectivity =
(furnace.energy_source.effectivity or 1)
*furnace_eff
elseif furnace.burner then
furnace.burner.effectivity =
(furnace.burner.effectivity or 1)
*furnace_eff
end
end
for _,machine in pairs(data.raw["assembling-machine"]) do
if machine.energy_source.type == "burner" then
set_burner_colors(machine)
machine.energy_source.effectivity =
(machine.energy_source.effectivity or 1)
*(furnace_eff)
elseif machine.burner then
set_burner_colors(machine)
machine.burner.effectivity =
(machine.burner.effectivity or 1)
*(furnace_eff)
end
end
-- nuclear fuel items must have their fuel_values
-- adjusted elsewhere to compenstate for this increase
for _,reactor in pairs(data.raw.reactor) do
reactor.consumption =
energy_mult(reactor.consumption,reactor_consump_mult)
reactor.energy_source.effectivity = reactor_eff
reactor.heat_buffer.max_transfer = energy_div(
reactor.heat_buffer.max_transfer,gen_eff
)
end
for _,panel in pairs(data.raw["solar-panel"]) do
panel.production =
energy_mult(
panel.production,
solar_panel_eff
)
end
for _,battery in pairs(data.raw["accumulator"]) do
local energy_source = get_energy_source(battery)
if energy_source then
energy_source.input_flow_limit =
energy_mult(
energy_source.input_flow_limit,
solar_panel_eff
)
energy_source.output_flow_limit =
energy_mult(
energy_source.output_flow_limit,
solar_panel_eff
)
end
end
-- This should only set colors on burner inserters.
for _,inserter in pairs(data.raw["inserter"]) do
set_burner_colors(inserter)
end