Skip to content

Commit

Permalink
Merge branch 'dev' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
maddie480 committed Apr 11, 2023
2 parents 491f999 + 61b7b99 commit ba1ad65
Show file tree
Hide file tree
Showing 65 changed files with 6,301 additions and 861 deletions.
10 changes: 5 additions & 5 deletions azure-pipelines.yml → .azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ steps:
command: 'restore'
projects: '**/*.csproj'
- task: PowerShell@2
displayName: 'Run azure-pipelines-prebuild.ps1'
displayName: 'Run .azure-pipelines/prebuild.ps1'
inputs:
filePath: 'azure-pipelines-prebuild.ps1'
filePath: '.azure-pipelines/prebuild.ps1'

# Build.
- task: DotNetCoreCLI@2
Expand Down Expand Up @@ -65,7 +65,7 @@ steps:
condition: succeeded()
displayName: 'Verify patches'
inputs:
filePath: 'azure-pipelines-verify.ps1'
filePath: '.azure-pipelines/verify.ps1'
env:
BIN_URL: $(BIN_URL)
BIN_USERNAME: $(BIN_USERNAME)
Expand All @@ -75,10 +75,10 @@ steps:
- task: PowerShell@2
name: PostBuild
condition: succeeded()
displayName: 'Run azure-pipelines-postbuild.ps1'
displayName: 'Run .azure-pipelines/postbuild.ps1'
continueOnError: true
inputs:
filePath: 'azure-pipelines-postbuild.ps1'
filePath: '.azure-pipelines/postbuild.ps1'
env:
BIN_URL: $(BIN_URL)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions Celeste.Mod.mm/Celeste.Mod.mm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DiscordGameSDK\DiscordGameSDK.csproj" />
</ItemGroup>

</Project>
23 changes: 21 additions & 2 deletions Celeste.Mod.mm/Content/Dialog/English.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
MODOPTIONS_COREMODULE_USEKEYBOARDFORTEXTINPUT= Use Keyboard for Text Input
MODOPTIONS_COREMODULE_WARNONEVERESTYAMLERRORS= Warn On everest.yaml Errors
MODOPTIONS_COREMODULE_WARNONEVERESTYAMLERRORS_DESC= Useful for mod makers
MODOPTIONS_COREMODULE_DISCORDRICHPRESENCE= Discord Rich Presence
MODOPTIONS_COREMODULE_MENUNAV_SUBHEADER= MENU NAVIGATION
MODOPTIONS_COREMODULE_MENUPAGEUP= Page Up in Menus
MODOPTIONS_COREMODULE_MENUPAGEDOWN= Page Down in Menus
Expand All @@ -100,6 +99,16 @@
MODOPTIONS_COREMODULE_SOUNDTEST= Sound Test
MODOPTIONS_COREMODULE_OOBE= Redo Initial Setup
MODOPTIONS_COREMODULE_TOGGLEMODS= Enable or Disable Mods

MODOPTIONS_COREMODULE_DISCORDRICHPRESENCE= Discord Rich Presence
MODOPTIONS_COREMODULE_DISCORDRICHPRESENCEOPTIONS= Rich Presence Options
MODOPTIONS_COREMODULE_DISCORDSHOWICON= Show Icon
MODOPTIONS_COREMODULE_DISCORDSHOWMAP= Show Map
MODOPTIONS_COREMODULE_DISCORDSHOWSIDE= Show Side (A, B...)
MODOPTIONS_COREMODULE_DISCORDSHOWROOM= Show Room Name
MODOPTIONS_COREMODULE_DISCORDSHOWBERRIES= Show Berry Count
MODOPTIONS_COREMODULE_DISCORDSHOWDEATHS= Show Death Count
MODOPTIONS_COREMODULE_DISCORDFAILED= Could not connect to Discord. Turn off and back on to retry.

MODOPTIONS_COREMODULE_NOTLOADED_A= Some mods failed loading.
MODOPTIONS_COREMODULE_NOTLOADED_B= Please check your log.txt for more info.
Expand Down Expand Up @@ -141,9 +150,19 @@

UPDATER_VERSIONS_ERR_DOWNLOAD= Failed downloading version list.
UPDATER_VERSIONS_ERR_FORMAT= Unknown format.

UPDATER_CURRENT_BRANCH= Current branch

UPDATER_SRC_STABLE= STABLE
UPDATER_SRC_BETA= BETA
UPDATER_SRC_DEV= DEV

UPDATER_SRC_RELEASE_GITHUB= Tagged releases (GitHub)
UPDATER_SRC_BUILDBOT_AZURE= Automatic builds (Azure)

# currently unused
UPDATER_SRC_BUILDBOT= Automatic builds

# Everest Updater
EVERESTUPDATER_NOTSUPPORTED= Updating not supported on this platform - cancelling.
EVERESTUPDATER_NOUPDATE= No update - cancelling.
Expand Down
10 changes: 10 additions & 0 deletions Celeste.Mod.mm/Content/Dialog/French.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
MODOPTIONS_COREMODULE_SOUNDTEST= Test sons
MODOPTIONS_COREMODULE_OOBE= Ouvrir l'écran de premier démarrage
MODOPTIONS_COREMODULE_TOGGLEMODS= Activer ou désactiver des mods

MODOPTIONS_COREMODULE_DISCORDRICHPRESENCE= Discord Rich Presence
MODOPTIONS_COREMODULE_DISCORDRICHPRESENCEOPTIONS= Options Rich Presence
MODOPTIONS_COREMODULE_DISCORDSHOWICON= Montrer le logo
MODOPTIONS_COREMODULE_DISCORDSHOWMAP= Montrer la map
MODOPTIONS_COREMODULE_DISCORDSHOWSIDE= Montrer la face (A, B...)
MODOPTIONS_COREMODULE_DISCORDSHOWROOM= Montrer le nom de la salle
MODOPTIONS_COREMODULE_DISCORDSHOWBERRIES= Montrer le nombre de fraises
MODOPTIONS_COREMODULE_DISCORDSHOWDEATHS= Montrer le nombre de morts
MODOPTIONS_COREMODULE_DISCORDFAILED= La connexion à Discord a échoué. Désactiver et réactiver pour réessayer.

MODOPTIONS_COREMODULE_NOTLOADED_A= Certains mods n'ont pas pu être chargés.
MODOPTIONS_COREMODULE_NOTLOADED_B= Vérifiez votre log.txt pour plus d'informations.
Expand Down
5 changes: 3 additions & 2 deletions Celeste.Mod.mm/Mod/Core/CoreModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ public override void LoadSettings() {
base.LoadSettings();

// The field can be set to true by default without the setter being called by YamlDotNet.
if (Settings.DiscordRichPresence)
Everest.Discord.Initialize();
if (Settings.DiscordRichPresence) {
Everest.DiscordSDK.CreateInstance();
}

// If we're running in an environment that prefers this flag, forcibly enable them.
Settings.LazyLoading |= Everest.Flags.PreferLazyLoading;
Expand Down
121 changes: 102 additions & 19 deletions Celeste.Mod.mm/Mod/Core/CoreModuleSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Monocle;
using MonoMod;
using System;
Expand Down Expand Up @@ -249,29 +250,20 @@ public bool WarnOnEverestYamlErrors {
}
}

private bool _DiscordRichPresence = true;
public bool DiscordRichPresence {
get => _DiscordRichPresence;
set {
_DiscordRichPresence = value;
if (value) {
Everest.Discord.Initialize();
} else {
Everest.Discord.Disable();
}
}
}
public bool DiscordRichPresence { get; set; } = true;

[SettingIgnore]
public string DiscordLib { get; set; } = "";
public bool DiscordShowIcon { get; set; } = true;
[SettingIgnore]
public bool DiscordShowMap { get; set; } = true;
[SettingIgnore]
public string DiscordID { get; set; } = "";
public bool DiscordShowSide { get; set; } = true;
[SettingIgnore]
public string DiscordTextInMenu { get; set; } = "📋 Menu";
public bool DiscordShowRoom { get; set; } = false;
[SettingIgnore]
public string DiscordTextInGame { get; set; } = "🗻 ((area)) 📼 ((side))";
public bool DiscordShowBerries { get; set; } = true;
[SettingIgnore]
public string DiscordSubtextInGame { get; set; } = "((deaths)) x 💀 | ((strawberries)) x 🍓";
public bool DiscordShowDeaths { get; set; } = true;

[SettingIgnore]
public int DebugRCPort { get; set; } = 32270;
Expand Down Expand Up @@ -313,7 +305,7 @@ public bool CodeReload {
[SettingInGame(false)]
[DefaultButtonBinding(0, Keys.OemPeriod)]
public ButtonBinding DebugConsole { get; set; }

[SettingInGame(false)]
[DefaultButtonBinding(0, Keys.F6)]
public ButtonBinding DebugMap { get; set; }
Expand Down Expand Up @@ -420,6 +412,97 @@ public void CreateMainMenuModeEntry(TextMenu menu, bool inGame) {
}
}

public void CreateDiscordRichPresenceEntry(TextMenu menu, bool inGame) {
Session session = (Engine.Scene as Level)?.Session;

TextMenu.Option<bool> showSide = new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_discordshowside"), DiscordShowSide)
.Change(value => {
DiscordShowSide = value;
Everest.DiscordSDK.Instance?.UpdatePresence(session);
});

TextMenu.Option<bool> showRoom = new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_discordshowroom"), DiscordShowRoom)
.Change(value => {
DiscordShowRoom = value;
Everest.DiscordSDK.Instance?.UpdatePresence(session);
});

TextMenu.Item showMap = new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_discordshowmap"), DiscordShowMap)
.Change(value => {
DiscordShowMap = value;
Everest.DiscordSDK.Instance?.UpdatePresence(session);

showSide.Disabled = !DiscordShowMap;
showRoom.Disabled = !DiscordShowMap;

if (!DiscordShowMap) {
showSide.Index = 0;
showRoom.Index = 0;
DiscordShowSide = false;
DiscordShowRoom = false;
}
});

TextMenu.Item showIcon = new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_discordshowicon"), DiscordShowIcon)
.Change(value => {
DiscordShowIcon = value;
Everest.DiscordSDK.Instance?.UpdatePresence(session);
});

TextMenu.Item showDeaths = new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_discordshowdeaths"), DiscordShowDeaths)
.Change(value => {
DiscordShowDeaths = value;
Everest.DiscordSDK.Instance?.UpdatePresence(session);
});

TextMenu.Item showBerries = new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_discordshowberries"), DiscordShowBerries)
.Change(value => {
DiscordShowBerries = value;
Everest.DiscordSDK.Instance?.UpdatePresence(session);
});

TextMenuExt.SubMenu submenu = new TextMenuExt.SubMenu(Dialog.Clean("modoptions_coremodule_discordrichpresenceoptions"), false)
.Add(showIcon)
.Add(showMap)
.Add(showSide)
.Add(showRoom)
.Add(showDeaths)
.Add(showBerries);

TextMenuExt.EaseInSubHeaderExt failureWarning = new TextMenuExt.EaseInSubHeaderExt(Dialog.Clean("modoptions_coremodule_discordfailed"), false, menu) {
TextColor = Color.Goldenrod,
HeightExtra = 0f
};

TextMenu.Item masterSwitch = new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_discordrichpresence"), DiscordRichPresence)
.Change(value => {
DiscordRichPresence = value;
if (DiscordRichPresence) {
Everest.DiscordSDK.CreateInstance()?.UpdatePresence(session);
} else {
Everest.DiscordSDK.Instance?.Dispose();
}
submenu.Disabled = !value;
failureWarning.FadeVisible = DiscordRichPresence && Everest.DiscordSDK.Instance == null;
});

masterSwitch.OnEnter += delegate {
failureWarning.FadeVisible = DiscordRichPresence && Everest.DiscordSDK.Instance == null;
};
masterSwitch.OnLeave += delegate {
failureWarning.FadeVisible = false;
};

menu.Add(masterSwitch);
menu.Add(failureWarning);

submenu.Disabled = !DiscordRichPresence;
showSide.Disabled = !DiscordShowMap;
showRoom.Disabled = !DiscordShowMap;

menu.Add(submenu);
}

public enum VanillaTristate {
Never,
Everest,
Expand Down
42 changes: 42 additions & 0 deletions Celeste.Mod.mm/Mod/Entities/AmbienceTrigger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Microsoft.Xna.Framework;

namespace Celeste.Mod.Entities {
/// <summary>
/// A trigger to change the current ambience track.
///
/// Attributes:
/// - `track`: the audio event to set the ambience to
/// - `resetOnLeave`: if true, remembers what the ambience was before entering the trigger, and restores it after leaving
/// </summary>
[CustomEntity("everest/ambienceTrigger", "Sardine7/AmbienceTrigger")]
public class AmbienceTrigger : Trigger {

private string Track;
private bool ResetOnLeave;

private string oldTrack;

public AmbienceTrigger(EntityData data, Vector2 offset) : base(data, offset) {
Track = data.Attr("track");
ResetOnLeave = data.Bool("resetOnLeave", defaultValue: false);
}

public override void OnEnter(Player player) {
if (ResetOnLeave) {
oldTrack = Audio.GetEventName(Audio.CurrentAmbienceEventInstance);
}

Session session = SceneAs<Level>().Session;
session.Audio.Ambience.Event = SFX.EventnameByHandle(Track);
session.Audio.Apply();
}

public override void OnLeave(Player player) {
if (ResetOnLeave) {
Session session = SceneAs<Level>().Session;
session.Audio.Ambience.Event = oldTrack;
session.Audio.Apply();
}
}
}
}
27 changes: 27 additions & 0 deletions Celeste.Mod.mm/Mod/Entities/AmbienceVolumeTrigger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.Xna.Framework;
using Monocle;

namespace Celeste.Mod.Entities {
/// <summary>
/// A trigger to change the volume of the current ambience track.
/// </summary>
[CustomEntity("everest/ambienceVolumeTrigger", "MaxHelpingHand/AmbienceVolumeTrigger")]
public class AmbienceVolumeTrigger : Trigger {

private float from;
private float to;
private PositionModes positionMode;

public AmbienceVolumeTrigger(EntityData data, Vector2 offset) : base(data, offset) {
from = data.Float("from");
to = data.Float("to");
positionMode = data.Enum("direction", PositionModes.NoEffect);
}

public override void OnStay(Player player) {
float ambienceVolume = Calc.ClampedMap(GetPositionLerp(player, positionMode), 0f, 1f, from, to);
((patch_AudioState) SceneAs<Level>().Session.Audio).AmbienceVolume = ambienceVolume;
Audio.CurrentAmbienceEventInstance?.setVolume(ambienceVolume);
}
}
}
8 changes: 6 additions & 2 deletions Celeste.Mod.mm/Mod/Entities/CrystalShatterTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ public override void OnEnter(Player player) {
if (mode == Modes.All)
Audio.Play("event:/game/06_reflection/boss_spikes_burst");

foreach (CrystalStaticSpinner spinner in spinners)
if (CollideCheck(spinner) || mode == Modes.All)
foreach (CrystalStaticSpinner spinner in spinners) {
bool wasCollidable = spinner.Collidable;
spinner.Collidable = true;
if (mode == Modes.All || CollideCheck(spinner))
spinner.Destroy();
spinner.Collidable = wasCollidable;
}
}

RemoveSelf();
Expand Down
Loading

0 comments on commit ba1ad65

Please sign in to comment.