Skip to content
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
46 changes: 36 additions & 10 deletions S1API.sln
Original file line number Diff line number Diff line change
@@ -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
33 changes: 17 additions & 16 deletions S1API/Entities/NPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ protected NPC(
// Awareness behaviour
GameObject awarenessObject = new GameObject("NPCAwareness");
awarenessObject.transform.SetParent(gameObject.transform);
S1NPC.awareness = awarenessObject.AddComponent<S1NPCs.NPCAwareness>();
S1NPC.awareness.onExplosionHeard = new UnityEvent<S1Noise.NoiseEvent>();
S1NPC.awareness.onGunshotHeard = new UnityEvent<S1Noise.NoiseEvent>();
S1NPC.awareness.onHitByCar = new UnityEvent<S1Vehicles.LandVehicle>();
S1NPC.awareness.onNoticedDrugDealing = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.awareness.onNoticedGeneralCrime = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.awareness.onNoticedPettyCrime = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.awareness.onNoticedPlayerViolatingCurfew = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.awareness.onNoticedSuspiciousPlayer = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.awareness.Listener = gameObject.AddComponent<S1Noise.Listener>();
S1NPC.Awareness = awarenessObject.AddComponent<S1NPCs.NPCAwareness>();
S1NPC.Awareness.onExplosionHeard = new UnityEvent<S1Noise.NoiseEvent>();
S1NPC.Awareness.onGunshotHeard = new UnityEvent<S1Noise.NoiseEvent>();
S1NPC.Awareness.onHitByCar = new UnityEvent<S1Vehicles.LandVehicle>();
S1NPC.Awareness.onNoticedDrugDealing = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.Awareness.onNoticedGeneralCrime = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.Awareness.onNoticedPettyCrime = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.Awareness.onNoticedPlayerViolatingCurfew = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.Awareness.onNoticedSuspiciousPlayer = new UnityEvent<S1PlayerScripts.Player>();
S1NPC.Awareness.Listener = gameObject.AddComponent<S1Noise.Listener>();

/////// START BEHAVIOUR CODE ////////
// NPCBehaviours behaviour
Expand All @@ -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<S1Responses.NPCResponses_Civilian>();
S1NPC.Awareness.Responses = responsesObject.AddComponent<S1Responses.NPCResponses_Civilian>();

// Vision cone object and behaviour
GameObject visionObject = new GameObject("VisionCone");
visionObject.transform.SetParent(gameObject.transform);
S1Vision.VisionCone visionCone = visionObject.AddComponent<S1Vision.VisionCone>();
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<S1WorkspacePopup.WorldspacePopup>();
S1NPC.Awareness.VisionCone.QuestionMarkPopup = gameObject.AddComponent<S1WorkspacePopup.WorldspacePopup>();

// Interaction behaviour
#if (IL2CPPMELON || IL2CPPBEPINEX)
Expand Down
7 changes: 3 additions & 4 deletions S1API/GameTime/TimeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,17 @@ public static class TimeManager
/// Called when the player finishes sleeping.
/// Parameter: total minutes skipped during sleep.
/// </summary>
public static Action<int> OnSleepEnd = delegate { };
public static Action OnSleepEnd = delegate { };

static TimeManager()
{
if (S1GameTime.TimeManager.Instance != null)
{
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<int>)(minutes => OnSleepEnd(minutes));
}


Expand Down
2 changes: 1 addition & 1 deletion S1API/Quests/Quest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public abstract class Quest : Saveable
/// <summary>
/// The current quest state for this quest
/// </summary>
protected QuestState QuestState => (QuestState)S1Quest.QuestState;
protected QuestState QuestState => (QuestState)S1Quest.State;

// ReSharper disable once MemberCanBePrivate.Global
/// <summary>
Expand Down
14 changes: 7 additions & 7 deletions S1API/S1API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Nullable>enable</Nullable>
<Configurations>MonoMelon;MonoBepInEx;Il2CppMelon;Il2CppBepInEx</Configurations>
<Platforms>AnyCPU</Platforms>
<Platforms>AnyCPU;x64</Platforms>
<RootNamespace>S1API</RootNamespace>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Expand Down Expand Up @@ -97,14 +97,14 @@

<!-- Automated local deployment -->
<Target Name="PostBuildIl2Cpp" AfterTargets="Build" Condition=" '$(AutomateLocalDeployment)' == 'true' and ('$(Configuration)' == 'Il2CppMono' or '$(Configuration)' == 'Il2CppBepInEx') ">
<Message Text="Deploying S1API to local Il2Cpp plugins folder" Importance="high"/>
<Copy SourceFiles=".\bin\Il2CppMelon\net6.0\S1API.dll" DestinationFiles="$(LocalIl2CppDeploymentPath)\Plugins\S1API\S1API.Il2Cpp.dll"/>
<Copy SourceFiles=".\bin\MonoMelon\netstandard2.1\S1API.dll" DestinationFiles="$(LocalIl2CppDeploymentPath)\Plugins\S1API\S1API.Mono.dll"/>
<Message Text="Deploying S1API to local Il2Cpp plugins folder" Importance="high" />
<Copy SourceFiles=".\bin\Il2CppMelon\net6.0\S1API.dll" DestinationFiles="$(LocalIl2CppDeploymentPath)\Plugins\S1API\S1API.Il2Cpp.dll" />
<Copy SourceFiles=".\bin\MonoMelon\netstandard2.1\S1API.dll" DestinationFiles="$(LocalIl2CppDeploymentPath)\Plugins\S1API\S1API.Mono.dll" />
</Target>

<Target Name="PostBuildMono" AfterTargets="Build" Condition=" '$(AutomateLocalDeployment)' == 'true' and ('$(Configuration)' == 'MonoMelon' or '$(Configuration)' == 'MonoBepInEx') ">
<Message Text="Deploying S1API to local Mono plugins folder" Importance="high"/>
<Copy SourceFiles=".\bin\Il2CppMelon\net6.0\S1API.dll" DestinationFiles="$(LocalMonoDeploymentPath)\Plugins\S1API\S1API.Il2Cpp.dll"/>
<Copy SourceFiles=".\bin\MonoMelon\netstandard2.1\S1API.dll" DestinationFiles="$(LocalMonoDeploymentPath)\Plugins\S1API\S1API.Mono.dll"/>
<Message Text="Deploying S1API to local Mono plugins folder" Importance="high" />
<Copy SourceFiles=".\bin\Il2CppMelon\net6.0\S1API.dll" DestinationFiles="$(LocalMonoDeploymentPath)\Plugins\S1API\S1API.Il2Cpp.dll" />
<Copy SourceFiles=".\bin\MonoMelon\netstandard2.1\S1API.dll" DestinationFiles="$(LocalMonoDeploymentPath)\Plugins\S1API\S1API.Mono.dll" />
</Target>
</Project>
12 changes: 8 additions & 4 deletions S1API/Storages/StorageInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,21 @@ public void AddItem(ItemInstance itemInstance) =>
/// </summary>
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());
}

/// <summary>
/// An action fired when the storage container is closed by the player.
/// </summary>
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());
}
}
}
4 changes: 2 additions & 2 deletions github.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AutomateLocalDeployment>false</AutomateLocalDeployment>

<!-- Used when building both Il2Cpp and Mono. Typically located at `steamapps/Schedule I/MelonLoader/net6` -->
<MelonLoaderAssembliesPath>..\ScheduleOneAssemblies\MelonLoader</MelonLoaderAssembliesPath>
<MelonLoaderAssembliesPath>C:\Program Files (x86)\Steam\steamapps\common\Schedule I\MelonLoader\net6</MelonLoaderAssembliesPath>
<BepInExAssembliesPath>..\ScheduleOneAssemblies\BepInEx</BepInExAssembliesPath>

<!-- Mono Configuration -->
Expand All @@ -27,6 +27,6 @@
<LocalIl2CppDeploymentPath>null</LocalIl2CppDeploymentPath>

<!-- Used only when building against Il2Cpp. Typically located at `steamapps/Schedule I/MelonLoader/Il2CppAssemblies` -->
<Il2CppAssembliesPath>..\ScheduleOneAssemblies\Il2CppAssemblies</Il2CppAssembliesPath>
<Il2CppAssembliesPath>C:\Program Files (x86)\Steam\steamapps\common\Schedule I\MelonLoader\Il2CppAssemblies</Il2CppAssembliesPath>
</PropertyGroup>
</Project>