1
0
mirror of https://github.com/veden/Rampant.git synced 2025-03-17 20:58:35 +02:00

FACTO-107: added hive colors to faction mod settings

This commit is contained in:
Aaron Veden 2022-04-15 21:49:50 -07:00
parent 9014b05d0d
commit d2f578a9ac
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
4 changed files with 99 additions and 56 deletions

View File

@ -454,13 +454,13 @@ local function hexToRGBA(hex)
end
local function convertHexPairs(hexPairString)
if #hexPairString ~= 17 then
if #hexPairString ~= 26 then
error(
"Invalid rgba hex value for Rampant new enemy color, each color needs to have `rrggbbaa rrggbbaa`:" .. hexPairString
"Invalid rgba hex value for Rampant new enemy color, each color needs to have `rrggbbaa rrggbbaa rrggbbaa`:" .. hexPairString
)
end
local index = 1
local a = {"tint", "tint2"}
local a = {"tint", "tint2", "tint3"}
local tints = {}
for hex in string.gmatch(hexPairString, "%x%x%x%x%x%x%x%x") do
tints[a[index]] = hexToRGBA(hex)
@ -531,6 +531,7 @@ constants.FACTION_SET[#constants.FACTION_SET+1] = {
type = "neutral",
tint = neutralTints.tint,
tint2 = neutralTints.tint2,
tint3 = neutralTints.tint3,
acceptRate = {1, 7, 0.3, 0.1},
evo = 0,
units = {
@ -616,6 +617,7 @@ if settings.startup["rampant--acidEnemy"].value then
type = "acid",
tint = acidTints.tint,
tint2 = acidTints.tint2,
tint3 = acidTints.tint3,
acceptRate = {1, 10, 0.1, 0.2},
evo = 0,
units = {
@ -700,6 +702,7 @@ if settings.startup["rampant--laserEnemy"].value then
type = "laser",
tint = laserTints.tint,
tint2 = laserTints.tint2,
tint3 = laserTints.tint3,
acceptRate = {2, 10, 0.1, 0.15},
evo = 0.10,
units = {
@ -778,6 +781,7 @@ if settings.startup["rampant--fireEnemy"].value then
type = "fire",
tint = fireTints.tint,
tint2 = fireTints.tint2,
tint3 = fireTints.tint3,
acceptRate = {2, 10, 0.1, 0.15},
evo = 0.12,
units = {
@ -862,6 +866,7 @@ if settings.startup["rampant--infernoEnemy"].value then
type = "inferno",
tint = infernoTints.tint,
tint2 = infernoTints.tint2,
tint3 = infernoTints.tint3,
acceptRate = {3, 10, 0.1, 0.125},
evo = 0.2,
units = {
@ -924,6 +929,7 @@ if settings.startup["rampant--waspEnemy"].value then
type = "wasp",
tint = waspTints.tint,
tint2 = waspTints.tint2,
tint3 = waspTints.tint3,
acceptRate = {3, 10, 0.1, 0.125},
evo = 0.2,
units = {
@ -994,6 +1000,7 @@ if settings.startup["rampant--spawnerEnemy"].value then
type = "spawner",
tint = spawnerTints.tint,
tint2 = spawnerTints.tint2,
tint3 = spawnerTints.tint3,
acceptRate = {3, 10, 0.1, 0.125},
evo = 0.2,
units = {
@ -1069,6 +1076,7 @@ if settings.startup["rampant--electricEnemy"].value then
type = "electric",
tint = electricTints.tint,
tint2 = electricTints.tint2,
tint3 = electricTints.tint3,
acceptRate = {2, 10, 0.1, 0.15},
evo = 0.1,
units = {
@ -1132,6 +1140,7 @@ if settings.startup["rampant--physicalEnemy"].value then
type = "physical",
tint = physicalTints.tint,
tint2 = physicalTints.tint2,
tint3 = physicalTints.tint3,
acceptRate = {2, 10, 0.1, 0.15},
evo = 0.12,
units = {
@ -1195,6 +1204,7 @@ if settings.startup["rampant--trollEnemy"].value then
type = "troll",
tint = trollTints.tint,
tint2 = trollTints.tint2,
tint3 = trollTints.tint3,
acceptRate = {3, 10, 0.1, 0.125},
evo = 0.17,
units = {
@ -1259,6 +1269,7 @@ if settings.startup["rampant--poisonEnemy"].value then
type = "poison",
tint = poisonTints.tint,
tint2 = poisonTints.tint2,
tint3 = poisonTints.tint3,
acceptRate = {2, 10, 0.1, 0.15},
evo = 0.17,
units = {
@ -1325,6 +1336,7 @@ if settings.startup["rampant--suicideEnemy"].value then
type = "suicide",
tint = suicideTints.tint,
tint2 = suicideTints.tint2,
tint3 = suicideTints.tint3,
acceptRate = {2, 10, 0.05, 0.15},
evo = 0.35,
units = {
@ -1387,6 +1399,7 @@ if settings.startup["rampant--nuclearEnemy"].value then
type = "nuclear",
tint = nuclearTints.tint,
tint2 = nuclearTints.tint2,
tint3 = nuclearTints.tint3,
acceptRate = {4, 10, 0.1, 0.125},
evo = 0.45,
units = {
@ -1448,6 +1461,7 @@ if settings.startup["rampant--energyThiefEnemy"].value then
type = "energy-thief",
tint = energyThiefTints.tint,
tint2 = energyThiefTints.tint2,
tint3 = energyThiefTints.tint3,
acceptRate = {3, 10, 0.1, 0.125},
evo = 0.2,
units = {
@ -1510,6 +1524,7 @@ if settings.startup["rampant--fastEnemy"].value then
type = "fast",
tint = fastTints.tint,
tint2 = fastTints.tint2,
tint3 = fastTints.tint3,
acceptRate = {2, 10, 0.1, 0.15},
evo = 0.12,
units = {

View File

@ -300,21 +300,21 @@ rampant--acidEnemy=Acid Biter Faction, Major resistance to Acid, Minor resistanc
rampant--energyThiefEnemy=Sapper Biter Faction, Major resistance to Electric, Minor resistance to Laser. Destroying powered structures creates draining crystals.
rampant--poisonEnemy=Poison Biter Faction, Only Biters. On death creates a cloud that heals biters and hurts player objects. Major resistance to Poison, Minor weakness to Electric, Minor weakness to Explosive, Minor weakness to Laser, Minor resistance to Fire.
rampant--neutralTints=Both colors should have 8 hex characters rrggbbaa
rampant--laserTints=Both colors should have 8 hex characters rrggbbaa
rampant--waspTints=Both colors should have 8 hex characters rrggbbaa
rampant--spawnerTints=Both colors should have 8 hex characters rrggbbaa
rampant--trollTints=Both colors should have 8 hex characters rrggbbaa
rampant--fastTints=Both colors should have 8 hex characters rrggbbaa
rampant--infernoTints=Both colors should have 8 hex characters rrggbbaa
rampant--nuclearTints=Both colors should have 8 hex characters rrggbbaa
rampant--electricTints=Both colors should have 8 hex characters rrggbbaa
rampant--fireTints=Both colors should have 8 hex characters rrggbbaa
rampant--suicideTints=Both colors should have 8 hex characters rrggbbaa
rampant--physicalTints=Both colors should have 8 hex characters rrggbbaa
rampant--acidTints=Both colors should have 8 hex characters rrggbbaa
rampant--energyThiefTints=Both colors should have 8 hex characters rrggbbaa
rampant--poisonTints=Both colors should have 8 hex characters rrggbbaa
rampant--neutralTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--laserTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--waspTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--spawnerTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--trollTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--fastTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--infernoTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--nuclearTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--electricTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--fireTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--suicideTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--physicalTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--acidTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--energyThiefTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--poisonTints=All colors should have 8 hex characters rrggbbaa, first color is the base color, second color is the tinting color, third color is the hives color
rampant--disableCollidingProjectiles=Biter projectiles no longer collide with other biters, worms or nests. Everything else still collides with biter projectiles.
rampant--enableFullMapScan=This setting causes the game map to slowly be scanned for entities created or destroyed outside of the factorio event system. (If a mod isnt using script_raised_built or script_raised_destroyed this will cause Rampant to still eventually be consistent with the game map)

View File

@ -889,11 +889,20 @@ local function generateApperance(unit, invert)
local scale = gaussianRandomRangeRG(scaleValue, scaleValue * 0.20, scaleValue * 0.50, scaleValue * 1.30, xorRandom)
unit.scale = scale
end
if unit.tint then
unit.tint = calculateRGBa(unit.tint, tier, true, invert)
end
if unit.tint2 then
unit.tint2 = calculateRGBa(unit.tint2, tier, true)
if invert then
if unit.tint then
unit.tint = calculateRGBa(unit.tint3, tier, true) -- calculateRGBa(unit.tint2, tier, true, true)
end
if unit.tint2 then
unit.tint2 = {r=1,g=1,b=1,a=1}
end
else
if unit.tint then
unit.tint = calculateRGBa(unit.tint, tier, true)
end
if unit.tint2 then
unit.tint2 = calculateRGBa(unit.tint2, tier, true)
end
end
end
@ -1391,6 +1400,7 @@ local function buildUnitTemplate(faction, unit)
template.isRampant = true
template.tint = faction.tint
template.tint2 = faction.tint2
template.tint3 = faction.tint3
template.faction = faction.type
@ -1428,6 +1438,7 @@ local function buildTurretTemplate(faction, turret)
template.isRampant = true
template.tint = faction.tint
template.tint2 = faction.tint2
template.tint3 = faction.tint3
template.faction = faction.type
@ -1467,6 +1478,7 @@ local function buildUnitSpawnerTemplate(faction, incomingTemplate, unitSets)
template.isRampant = true
template.tint = faction.tint
template.tint2 = faction.tint2
template.tint3 = faction.tint3
template.faction = faction.type
@ -1526,6 +1538,7 @@ local function buildHiveTemplate(faction, incomingTemplate)
template.isRampant = true
template.tint = faction.tint
template.tint2 = faction.tint2
template.tint3 = faction.tint3
template.faction = faction.type

View File

@ -1024,100 +1024,115 @@ end
-- Sets the default value of the faction tint settings.
-- Change this function if the formating of the tint settings changes.
local function setDefaultValue(tint, tint2)
return rgbaToHex(tint) .. " " .. rgbaToHex(tint2)
local function setDefaultValue(tint, tint2, tint3)
return rgbaToHex(tint) .. " " .. rgbaToHex(tint2) .. " " .. rgbaToHex(tint3)
end
local FACTIONS = {
{
-- Neutral faction
type = "neutral",
tint = {r = 0.90, g = 0.90, b = 0.90, a = 1},
tint2 = {r = 1, g = 1, b = 1, a = 1}
tint = {r = 0.90, g = 0.90, b = 0.90, a = 1.00},
tint2 = {r = 1.00, g = 1.00, b = 1.00, a = 1.00},
tint3 = {r = 0.50, g = 0.50, b = 0.50, a = 0.20}
},
{
-- Acidic faction
type = "acid",
tint = {r = 1, g = 1, b = 1, a = 1},
tint2 = {r = 0.40, g = 0.90, b = 0.40, a = 1}
tint = {r = 1.00, g = 1.00, b = 1.00, a = 1.00},
tint2 = {r = 0.40, g = 0.90, b = 0.40, a = 1.00},
tint3 = {r = 0.40, g = 0.60, b = 0.40, a = 0.20}
},
{
-- Laser faction
type = "laser",
tint = {r = 0.60, g = 0.60, b = 0.84, a = 1},
tint2 = {r = 0.60, g = 0.60, b = 0.84, a = 1}
tint = {r = 0.60, g = 0.60, b = 0.84, a = 1.00},
tint2 = {r = 0.60, g = 0.60, b = 0.84, a = 1.00},
tint3 = {r = 0.30, g = 0.30, b = 0.70, a = 0.20}
},
{
-- Fire faction
type = "fire",
tint = {r = 1, g = 1, b = 1, a = 1},
tint2 = {r = 0.90, g = 0.20, b = 0.20, a = 1}
tint = {r = 1.00, g = 1.00, b = 1.00, a = 1.00},
tint2 = {r = 0.90, g = 0.20, b = 0.20, a = 1.00},
tint3 = {r = 0.90, g = 0.70, b = 0.70, a = 0.20}
},
{
-- Inferno faction
type = "inferno",
tint = {r = 0.90, g = 0.75, b = 0.75, a = 1},
tint2 = {r = 0.70, g = 0.30, b = 0.30, a = 1}
tint = {r = 0.90, g = 0.75, b = 0.75, a = 1.00},
tint2 = {r = 0.70, g = 0.30, b = 0.30, a = 1.00},
tint3 = {r = 0.50, g = 0.00, b = 0.00, a = 0.20}
},
{
-- Wasp faction
type = "wasp",
tint = {r = 1, g = 1, b = 0.70, a = 1},
tint2 = {r = 0.50, g = 0.50, b = 0, a = 1}
tint = {r = 1.00, g = 1.00, b = 0.70, a = 1.00},
tint2 = {r = 0.50, g = 0.50, b = 0.00, a = 1.00},
tint3 = {r = 0.80, g = 0.80, b = 0.00, a = 0.20}
},
{
-- Spawner faction
type = "spawner",
tint = {r = 1, g = 0.80, b = 1, a = 1},
tint2 = {r = 0.90, g = 0.30, b = 0.90, a = 1}
tint = {r = 1.00, g = 0.80, b = 1.00, a = 1.00},
tint2 = {r = 0.90, g = 0.30, b = 0.90, a = 1.00},
tint3 = {r = 0.60, g = 0.10, b = 0.60, a = 0.20}
},
{
-- Electric faction
type = "electric",
tint = {r = 0.80, g = 0.80, b = 1, a = 1},
tint2 = {r = 0.30, g = 0.30, b = 1, a = 1}
tint = {r = 0.80, g = 0.80, b = 1.00, a = 1.00},
tint2 = {r = 0.30, g = 0.30, b = 1.00, a = 1.00},
tint3 = {r = 0.10, g = 0.10, b = 0.70, a = 0.20}
},
{
-- Brutal faction
type = "physical",
tint = {r = 0.90, g = 0.90, b = 0.90, a = 1},
tint2 = {r = 0.80, g = 0.80, b = 0.80, a = 1}
tint = {r = 0.90, g = 0.90, b = 0.90, a = 1.00},
tint2 = {r = 0.80, g = 0.80, b = 0.80, a = 1.00},
tint3 = {r = 0.20, g = 0.20, b = 0.20, a = 0.20}
},
{
-- Regenerative faction
type = "troll",
tint = {r = 0.55, g = 0.55, b = 0.55, a = 1},
tint2 = {r = 1, g = 0.30, b = 0.30, a = 1}
tint = {r = 0.55, g = 0.55, b = 0.55, a = 1.00},
tint2 = {r = 1.00, g = 0.30, b = 0.30, a = 1.00},
tint3 = {r = 0.30, g = 0.10, b = 0.10, a = 0.20}
},
{
-- Poison faction
type = "poison",
tint = {r = 0.50, g = 0.70, b = 0.60, a = 1},
tint2 = {r = 0.30, g = 0.90, b = 0.30, a = 1}
tint = {r = 0.50, g = 0.70, b = 0.60, a = 1.00},
tint2 = {r = 0.30, g = 0.90, b = 0.30, a = 1.00},
tint3 = {r = 0.05, g = 0.30, b = 0.05, a = 0.20}
},
{
-- Suicide faction
type = "suicide",
tint = {r = 0.80, g = 0.80, b = 0.80, a = 1},
tint2 = {r = 1, g = 0.50, b = 0, a = 1}
tint = {r = 0.80, g = 0.80, b = 0.80, a = 1.00},
tint2 = {r = 1.00, g = 0.50, b = 0.00, a = 1.00},
tint3 = {r = 0.55, g = 0.30, b = 0.15, a = 0.20}
},
{
-- Nuclear faction
type = "nuclear",
tint = {r = 0.10, g = 0.95, b = 0.10, a = 1},
tint2 = {r = 1, g = 0.50, b = 0, a = 1}
tint = {r = 0.10, g = 0.95, b = 0.10, a = 1.00},
tint2 = {r = 1.00, g = 0.50, b = 0.00, a = 1.00},
tint3 = {r = 0.50, g = 0.75, b = 0.00, a = 0.20}
},
{
-- Sapper faction
type = "energyThief",
tint = {r = 0.50, g = 0.50, b = 0.70, a = 1},
tint2 = {r = 0.40, g = 0.40, b = 0.40, a = 1}
tint = {r = 0.50, g = 0.50, b = 0.70, a = 1.00},
tint2 = {r = 0.40, g = 0.40, b = 0.40, a = 1.00},
tint3 = {r = 0.10, g = 0.10, b = 0.40, a = 0.20}
},
{
-- Fast faction
type = "fast",
tint = {r = 0.90, g = 0.90, b = 0.90, a = 1},
tint2 = {r = 1, g = 1, b = 0.10, a = 1}
tint = {r = 0.90, g = 0.90, b = 0.90, a = 1.00},
tint2 = {r = 1.00, g = 1.00, b = 0.10, a = 1.00},
tint3 = {r = 0.50, g = 0.50, b = 0.00, a = 0.20}
}
}
@ -1131,7 +1146,7 @@ for i = 1, #FACTIONS do
name = setting,
description = setting,
setting_type = "startup",
default_value = setDefaultValue(entry.tint, entry.tint2),
default_value = setDefaultValue(entry.tint, entry.tint2, entry.tint3),
order = "p[modifier]-r[zzunit]",
},
})