From f25b39a8da03cd2b31b020f6355aeb07c57238d5 Mon Sep 17 00:00:00 2001 From: Itamar Ivri Date: Sat, 31 Jan 2026 09:17:06 +0200 Subject: [PATCH] a bunch of changes inorder to get it to compile on the latest schedule one stable verison its not amazing as im new here and just wanted to use the api, sorry for the bad code. --- S1API.sln | 46 ++++++++++++++++++++++++------- S1API/Entities/NPC.cs | 33 +++++++++++----------- S1API/GameTime/TimeManager.cs | 7 ++--- S1API/Quests/Quest.cs | 2 +- S1API/S1API.csproj | 14 +++++----- S1API/Storages/StorageInstance.cs | 12 +++++--- github.build.props | 4 +-- 7 files changed, 74 insertions(+), 44 deletions(-) diff --git a/S1API.sln b/S1API.sln index 72b17c00..703937d6 100644 --- a/S1API.sln +++ b/S1API.sln @@ -1,32 +1,58 @@  Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36915.13 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S1API", "S1API\S1API.csproj", "{D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S1APILoader", "S1APILoader\S1APILoader.csproj", "{B97277C2-27FE-4BB9-AB5A-D479C8DF6827}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - MonoBepInEx|Any CPU = MonoBepInEx|Any CPU + Il2CppBepInEx|Any CPU = Il2CppBepInEx|Any CPU + Il2CppBepInEx|x64 = Il2CppBepInEx|x64 Il2CppMelon|Any CPU = Il2CppMelon|Any CPU + Il2CppMelon|x64 = Il2CppMelon|x64 + MonoBepInEx|Any CPU = MonoBepInEx|Any CPU + MonoBepInEx|x64 = MonoBepInEx|x64 MonoMelon|Any CPU = MonoMelon|Any CPU - Il2CppBepInEx|Any CPU = Il2CppBepInEx|Any CPU + MonoMelon|x64 = MonoMelon|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoBepInEx|Any CPU.ActiveCfg = MonoBepInEx|Any CPU - {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoBepInEx|Any CPU.Build.0 = MonoBepInEx|Any CPU + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppBepInEx|Any CPU.ActiveCfg = Il2CppMelon|Any CPU + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppBepInEx|Any CPU.Build.0 = Il2CppMelon|Any CPU + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppBepInEx|x64.ActiveCfg = Il2CppBepInEx|x64 + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppBepInEx|x64.Build.0 = Il2CppBepInEx|x64 {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppMelon|Any CPU.ActiveCfg = Il2CppMelon|Any CPU {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppMelon|Any CPU.Build.0 = Il2CppMelon|Any CPU + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppMelon|x64.ActiveCfg = Il2CppMelon|x64 + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppMelon|x64.Build.0 = Il2CppMelon|x64 + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoBepInEx|Any CPU.ActiveCfg = MonoBepInEx|Any CPU + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoBepInEx|Any CPU.Build.0 = MonoBepInEx|Any CPU + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoBepInEx|x64.ActiveCfg = MonoBepInEx|x64 + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoBepInEx|x64.Build.0 = MonoBepInEx|x64 {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoMelon|Any CPU.ActiveCfg = MonoMelon|Any CPU {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoMelon|Any CPU.Build.0 = MonoMelon|Any CPU - {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppBepInEx|Any CPU.ActiveCfg = Il2CppBepInEx|Any CPU - {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.Il2CppBepInEx|Any CPU.Build.0 = Il2CppBepInEx|Any CPU - {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoBepInEx|Any CPU.ActiveCfg = MonoBepInEx|Any CPU - {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoBepInEx|Any CPU.Build.0 = MonoBepInEx|Any CPU + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoMelon|x64.ActiveCfg = MonoMelon|x64 + {D2C9A6B1-B9E0-4E6D-AE65-B5264C2A4E04}.MonoMelon|x64.Build.0 = MonoMelon|x64 + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppBepInEx|Any CPU.ActiveCfg = MonoMelon|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppBepInEx|Any CPU.Build.0 = MonoMelon|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppBepInEx|x64.ActiveCfg = Il2CppBepInEx|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppBepInEx|x64.Build.0 = Il2CppBepInEx|Any CPU {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppMelon|Any CPU.ActiveCfg = Il2CppMelon|Any CPU {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppMelon|Any CPU.Build.0 = Il2CppMelon|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppMelon|x64.ActiveCfg = Il2CppMelon|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppMelon|x64.Build.0 = Il2CppMelon|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoBepInEx|Any CPU.ActiveCfg = MonoBepInEx|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoBepInEx|Any CPU.Build.0 = MonoBepInEx|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoBepInEx|x64.ActiveCfg = MonoBepInEx|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoBepInEx|x64.Build.0 = MonoBepInEx|Any CPU {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoMelon|Any CPU.ActiveCfg = MonoMelon|Any CPU {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoMelon|Any CPU.Build.0 = MonoMelon|Any CPU - {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppBepInEx|Any CPU.ActiveCfg = Il2CppBepInEx|Any CPU - {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.Il2CppBepInEx|Any CPU.Build.0 = Il2CppBepInEx|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoMelon|x64.ActiveCfg = MonoMelon|Any CPU + {B97277C2-27FE-4BB9-AB5A-D479C8DF6827}.MonoMelon|x64.Build.0 = MonoMelon|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/S1API/Entities/NPC.cs b/S1API/Entities/NPC.cs index 36ed3868..b1d1ab29 100644 --- a/S1API/Entities/NPC.cs +++ b/S1API/Entities/NPC.cs @@ -116,16 +116,16 @@ protected NPC( // Awareness behaviour GameObject awarenessObject = new GameObject("NPCAwareness"); awarenessObject.transform.SetParent(gameObject.transform); - S1NPC.awareness = awarenessObject.AddComponent(); - S1NPC.awareness.onExplosionHeard = new UnityEvent(); - S1NPC.awareness.onGunshotHeard = new UnityEvent(); - S1NPC.awareness.onHitByCar = new UnityEvent(); - S1NPC.awareness.onNoticedDrugDealing = new UnityEvent(); - S1NPC.awareness.onNoticedGeneralCrime = new UnityEvent(); - S1NPC.awareness.onNoticedPettyCrime = new UnityEvent(); - S1NPC.awareness.onNoticedPlayerViolatingCurfew = new UnityEvent(); - S1NPC.awareness.onNoticedSuspiciousPlayer = new UnityEvent(); - S1NPC.awareness.Listener = gameObject.AddComponent(); + S1NPC.Awareness = awarenessObject.AddComponent(); + S1NPC.Awareness.onExplosionHeard = new UnityEvent(); + S1NPC.Awareness.onGunshotHeard = new UnityEvent(); + S1NPC.Awareness.onHitByCar = new UnityEvent(); + S1NPC.Awareness.onNoticedDrugDealing = new UnityEvent(); + S1NPC.Awareness.onNoticedGeneralCrime = new UnityEvent(); + S1NPC.Awareness.onNoticedPettyCrime = new UnityEvent(); + S1NPC.Awareness.onNoticedPlayerViolatingCurfew = new UnityEvent(); + S1NPC.Awareness.onNoticedSuspiciousPlayer = new UnityEvent(); + S1NPC.Awareness.Listener = gameObject.AddComponent(); /////// START BEHAVIOUR CODE //////// // NPCBehaviours behaviour @@ -143,27 +143,28 @@ protected NPC( behaviour.CoweringBehaviour = coweringBehaviour; behaviour.FleeBehaviour = fleeBehaviour; - S1NPC.behaviour = behaviour; + S1NPC.Behaviour = behaviour; /////// END BEHAVIOUR CODE //////// // Response to actions like gunshots, drug deals, etc. GameObject responsesObject = new GameObject("NPCResponses"); responsesObject.transform.SetParent(gameObject.transform); - S1NPC.awareness.Responses = responsesObject.AddComponent(); + S1NPC.Awareness.Responses = responsesObject.AddComponent(); // Vision cone object and behaviour GameObject visionObject = new GameObject("VisionCone"); visionObject.transform.SetParent(gameObject.transform); S1Vision.VisionCone visionCone = visionObject.AddComponent(); - visionCone.StatesOfInterest.Add(new S1Vision.VisionCone.StateContainer + visionCone.DefaultStatesOfInterest.Add(new S1Vision.VisionCone.StateContainer { - state = S1PlayerScripts.PlayerVisualState.EVisualState.PettyCrime, RequiredNoticeTime = 0.1f + state = S1Vision.EVisualState.PettyCrime, + NoticeTimeMultiplier = 0.1f }); - S1NPC.awareness.VisionCone = visionCone; + S1NPC.Awareness.VisionCone = visionCone; // Suspicious ? icon in world space - S1NPC.awareness.VisionCone.QuestionMarkPopup = gameObject.AddComponent(); + S1NPC.Awareness.VisionCone.QuestionMarkPopup = gameObject.AddComponent(); // Interaction behaviour #if (IL2CPPMELON || IL2CPPBEPINEX) diff --git a/S1API/GameTime/TimeManager.cs b/S1API/GameTime/TimeManager.cs index a176c9f0..bafbad08 100644 --- a/S1API/GameTime/TimeManager.cs +++ b/S1API/GameTime/TimeManager.cs @@ -32,7 +32,7 @@ public static class TimeManager /// Called when the player finishes sleeping. /// Parameter: total minutes skipped during sleep. /// - public static Action OnSleepEnd = delegate { }; + public static Action OnSleepEnd = delegate { }; static TimeManager() { @@ -40,10 +40,9 @@ static TimeManager() { S1GameTime.TimeManager.Instance.onDayPass += (Action)(() => OnDayPass()); S1GameTime.TimeManager.Instance.onWeekPass += (Action)(() => OnWeekPass()); + S1GameTime.TimeManager.Instance.onSleepStart += (Action)(() => OnSleepStart()); + S1GameTime.TimeManager.Instance.onSleepEnd += (Action)(() => OnSleepEnd()); } - - S1GameTime.TimeManager.onSleepStart += (Action)(() => OnSleepStart()); - S1GameTime.TimeManager.onSleepEnd += (Action)(minutes => OnSleepEnd(minutes)); } diff --git a/S1API/Quests/Quest.cs b/S1API/Quests/Quest.cs index b42aa3b6..53bdd7df 100644 --- a/S1API/Quests/Quest.cs +++ b/S1API/Quests/Quest.cs @@ -57,7 +57,7 @@ public abstract class Quest : Saveable /// /// The current quest state for this quest /// - protected QuestState QuestState => (QuestState)S1Quest.QuestState; + protected QuestState QuestState => (QuestState)S1Quest.State; // ReSharper disable once MemberCanBePrivate.Global /// diff --git a/S1API/S1API.csproj b/S1API/S1API.csproj index f43e2958..6104efb8 100644 --- a/S1API/S1API.csproj +++ b/S1API/S1API.csproj @@ -14,7 +14,7 @@ MIT enable MonoMelon;MonoBepInEx;Il2CppMelon;Il2CppBepInEx - AnyCPU + AnyCPU;x64 S1API true @@ -97,14 +97,14 @@ - - - + + + - - - + + + diff --git a/S1API/Storages/StorageInstance.cs b/S1API/Storages/StorageInstance.cs index 2c5e712b..50239714 100644 --- a/S1API/Storages/StorageInstance.cs +++ b/S1API/Storages/StorageInstance.cs @@ -54,8 +54,10 @@ public void AddItem(ItemInstance itemInstance) => /// public event Action OnOpened { - add => EventHelper.AddListener(value, S1Storage.onOpened); - remove => EventHelper.RemoveListener(value, S1Storage.onOpened); + add => S1Storage.onOpened += (Action)(() => value()); + //add => EventHelper.AddListener(value, S1Storage.onOpened); + //remove => EventHelper.RemoveListener(value, S1Storage.onOpened); + remove => S1Storage.onOpened -= (Action)(() => value()); } /// @@ -63,8 +65,10 @@ public event Action OnOpened /// public event Action OnClosed { - add => EventHelper.AddListener(value, S1Storage.onClosed); - remove => EventHelper.RemoveListener(value, S1Storage.onClosed); + //add => EventHelper.AddListener(value, S1Storage.onClosed); + add => S1Storage.onClosed += (Action)(() => value()); + //remove => EventHelper.RemoveListener(value, S1Storage.onClosed); + remove => S1Storage.onClosed -= (Action)(() => value()); } } } diff --git a/github.build.props b/github.build.props index 2c4c39ec..de3b04bd 100644 --- a/github.build.props +++ b/github.build.props @@ -10,7 +10,7 @@ false - ..\ScheduleOneAssemblies\MelonLoader + C:\Program Files (x86)\Steam\steamapps\common\Schedule I\MelonLoader\net6 ..\ScheduleOneAssemblies\BepInEx @@ -27,6 +27,6 @@ null - ..\ScheduleOneAssemblies\Il2CppAssemblies + C:\Program Files (x86)\Steam\steamapps\common\Schedule I\MelonLoader\Il2CppAssemblies \ No newline at end of file