Skip to content

Add color customization options - #5

Open
cooperbarth wants to merge 2 commits into
CommunalHelper:devfrom
cooperbarth:dev
Open

Add color customization options#5
cooperbarth wants to merge 2 commits into
CommunalHelper:devfrom
cooperbarth:dev

Conversation

@cooperbarth

@cooperbarth cooperbarth commented Apr 21, 2024

Copy link
Copy Markdown

Although batteries and battery switches can be easily resprited, their particle and death effect colors are hardcoded into the entity, which made non-green reskins mismatch. This is a proposal to expose particle colors for the 4 battery states, the battery's death effect color, and battery switch particle and glow colors for customization in Lonn and Ahorn. This contribution adds the following options:

Batteries

  • Particle Color (Infinite)
  • Particle Color (Full)
  • Particle Color (Half)
  • Particle Color (Low)
  • Death Effect Color

Battery Switch

  • Particle Color 1
  • Particle Color 2
  • Glow Color
particle_customization.mp4

@cooperbarth cooperbarth changed the title Add particle color customization options Add color customization options Apr 21, 2024

@catapillie catapillie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the PR, i think there's a confusion with how the particle structs should be stored in the BatterySwitch class
Also, you may have forgotten the tooltips in Ahorn/lang/en_gb.lang (not big deal no one uses Ahorn anymore)

Comment thread Code/BatterySwitch.cs
Comment on lines +11 to +12
private static ParticleType P_Signal_A = new(DashSwitch.P_PressA);
private static ParticleType P_Signal_B = new(DashSwitch.P_PressA);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since particles are now customizable for each BatterySwitch entity, these fields should be marked as static.

Comment thread Code/BatterySwitch.cs

private static bool particlesSetup = false;
private static ParticleType P_Signal_A = new(DashSwitch.P_PressA);
private static ParticleType P_Signal_B = new(DashSwitch.P_PressA);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably intended this:

Suggested change
private static ParticleType P_Signal_B = new(DashSwitch.P_PressA);
private static ParticleType P_Signal_B = new(DashSwitch.P_PressB);

Comment thread Code/BatterySwitch.cs
P_Signal.LifeMin = 0.3f;
P_Signal.SpeedMultiplier = 0.1f;
P_Signal.DirectionRange = (float)(Math.PI / 5);
private static void SetupParticles(EntityData e) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should no longer be a staticmethod

Suggested change
private static void SetupParticles(EntityData e) {
private void SetupParticles(EntityData e) {

Comment on lines +3 to +7
local COLOR_CYAN = "00ffff"
local COLOR_FOREST_GREEN = "228b22"
local COLOR_LIGHT_GOLDENROD_YELLOW = "fafad2"
local COLOR_LIME = "00ff00"
local COLOR_ORANGE_RED = "ff4500"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to redefine these XNA colors, they are available in consts/xna_colors.lua in the Lönn repository. (they are defined as RGBA values, not hex codes, but IIRC Lönn converts them automatically)

you may import the constants and use them as follows

local xna_colors = require "consts.xna_colors"

xna_colors.Cyan
xna_colors.ForestGreen
-- etc..

Comment on lines +6 to +8
local COLOR_AQUA = "00ffff"
local COLOR_LIME = "00ff00"
local COLOR_WHITE = "ffffff"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about XNA colors here.

Comment thread Loenn/lang/en_gb.lang
entities.batteries/battery_switch.placements.name.left=Battery Switch (Left)
entities.batteries/battery_switch.placements.name.right=Battery Switch (Right)
entities.batteries/battery_switch.attributes.name.particleColorA=Particle Color 1
entities.batteries/battery_switch.attributes.name.particleColorB=Particle Color 2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit.) more precise description would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants