Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "night vision" character parameter #14530

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,17 @@ void DrawHalo(Character character)
//ambient light decreases the brightness of the halo (no need for a bright halo if the ambient light is bright enough)
float ambientBrightness = (AmbientLight.R + AmbientLight.B + AmbientLight.G) / 255.0f / 3.0f;
Color haloColor = Color.White.Multiply(0.3f - ambientBrightness);
if (character.HasNightVision && character == Character.Controlled)
{
haloColor.A = 180;
}
if (haloColor.A > 0)
{
float scale = 512.0f / LightSource.LightTexture.Width;
if (character.HasNightVision && character == Character.Controlled)
{
scale = 5120.0f;
}
spriteBatch.Draw(
LightSource.LightTexture, haloDrawPos, null, haloColor, 0.0f,
new Vector2(LightSource.LightTexture.Width, LightSource.LightTexture.Height) / 2, scale, SpriteEffects.None, 0.0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ public bool CanSpeak
set => Params.CanSpeak = value;
}

public bool HasNightVision
{
get => Params.HasNightVision;
set => Params.HasNightVision = value;
}

public bool NeedsAir
{
get => Params.NeedsAir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public string Tags
[Serialize("", IsPropertySaveable.Yes, description: "Identifier or tag of the item the character's items are placed inside when the character despawns."), Editable]
public Identifier DespawnContainer { get; private set; }

[Serialize(false, IsPropertySaveable.Yes, description: "Does this character have night vision when player controlled?"), Editable]
public bool HasNightVision { get; set; }

public readonly CharacterFile File;

public XDocument VariantFile { get; private set; }
Expand Down