Skip to content

Commit

Permalink
code polish
Browse files Browse the repository at this point in the history
  • Loading branch information
Govorunb committed Dec 17, 2023
1 parent c052d00 commit 344c328
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 47 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ SCHIZO/Resources/AssetBundles/* merge=ours
*.asset text eol=lf
*.prefab text eol=lf
*.meta text eol=lf
*.asmdef text eol=lf
*.asmdef text eol=lf
FMOD Project/**/*.xml text eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@
<relationship name="markerTracks">
<destination>{ffcde3d2-a590-422e-b66b-7f4ae6420e7a}</destination>
</relationship>
<relationship name="groupTracks">
<destination>{be0c1090-ddc8-47c9-a0cc-a8239b29b00e}</destination>
</relationship>
<relationship name="timeline">
<destination>{12032229-6fd3-48fb-8248-fd442b00a139}</destination>
</relationship>
<relationship name="parameters">
<destination>{e35b7b12-b54d-4e05-a30e-7929664dbfae}</destination>
<destination>{2f19ed91-ae76-4949-8341-65e96d7289b0}</destination>
<destination>{cc5dbe11-70b2-48b5-a896-bf8e14911818}</destination>
</relationship>
<relationship name="banks">
<destination>{6f6c823e-9073-439e-9503-3b2b490ddbfb}</destination>
Expand All @@ -44,6 +43,10 @@
</relationship>
</object>
<object class="MasterTrack" id="{a47bfef0-c5b5-486d-b506-a310ea301523}">
<relationship name="automationTracks">
<destination>{ce472bdb-9441-4589-a135-2382c2dec4ef}</destination>
<destination>{e36e2359-e1e5-446e-8940-df0180669392}</destination>
</relationship>
<relationship name="modules">
<destination>{2d0ff93e-e9de-4501-b4d8-d92b3833977f}</destination>
</relationship>
Expand All @@ -64,11 +67,6 @@
</object>
<object class="EventAutomatableProperties" id="{139abf40-40a1-4619-893c-704ff8aebc4d}" />
<object class="MarkerTrack" id="{ffcde3d2-a590-422e-b66b-7f4ae6420e7a}" />
<object class="GroupTrack" id="{be0c1090-ddc8-47c9-a0cc-a8239b29b00e}">
<relationship name="mixerGroup">
<destination>{edf25067-7c68-4bae-a562-28adb0421faa}</destination>
</relationship>
</object>
<object class="Timeline" id="{12032229-6fd3-48fb-8248-fd442b00a139}">
<property name="isProxyEnabled">
<value>false</value>
Expand All @@ -79,6 +77,16 @@
<destination>{2d0ff93e-e9de-4501-b4d8-d92b3833977f}</destination>
</relationship>
</object>
<object class="ParameterProxy" id="{2f19ed91-ae76-4949-8341-65e96d7289b0}">
<relationship name="preset">
<destination>{540cf702-5f8a-4a1d-99f5-d9a31a53c833}</destination>
</relationship>
</object>
<object class="ParameterProxy" id="{cc5dbe11-70b2-48b5-a896-bf8e14911818}">
<relationship name="preset">
<destination>{255c0af3-d82c-48de-970b-933bda576119}</destination>
</relationship>
</object>
<object class="EventMixerMaster" id="{7f6d89a1-e8a7-4ba1-a645-d5a9ca507315}">
<relationship name="effectChain">
<destination>{8e46e64e-457f-4893-948d-f2f11df92fb3}</destination>
Expand All @@ -90,8 +98,19 @@
<destination>{9f603c91-fa81-4542-bce8-c4de1133487c}</destination>
</relationship>
</object>
<object class="AutomationTrack" id="{ce472bdb-9441-4589-a135-2382c2dec4ef}">
<relationship name="automator">
<destination>{7057829f-97fc-4dba-b6ca-62909f5e8d69}</destination>
</relationship>
</object>
<object class="AutomationTrack" id="{e36e2359-e1e5-446e-8940-df0180669392}">
<relationship name="automator">
<destination>{d0dd02e5-0744-4c06-9a12-193db7e36922}</destination>
</relationship>
</object>
<object class="MultiSound" id="{2d0ff93e-e9de-4501-b4d8-d92b3833977f}">
<relationship name="sounds">
<destination>{baa35633-7c5f-4801-8218-2ca20461e2b4}</destination>
<destination>{4828a929-4152-46e5-b98c-945a7a7ea1b1}</destination>
</relationship>
</object>
Expand All @@ -101,27 +120,18 @@
</relationship>
</object>
<object class="MixerBusPanner" id="{675a631e-e622-4409-9cf2-be7dc212b8c2}" />
<object class="EventMixerGroup" id="{edf25067-7c68-4bae-a562-28adb0421faa}">
<property name="name">
<value>Audio 1</value>
</property>
<relationship name="effectChain">
<destination>{68b83339-e8c6-49c6-8d91-d80b3f5d42f4}</destination>
</relationship>
<relationship name="panner">
<destination>{9bfa4f8e-25cc-42df-a016-9e16357452c9}</destination>
</relationship>
<relationship name="output">
<destination>{7f6d89a1-e8a7-4ba1-a645-d5a9ca507315}</destination>
</relationship>
</object>
<object class="MixerBusEffectChain" id="{8e46e64e-457f-4893-948d-f2f11df92fb3}">
<relationship name="effects">
<destination>{9069bddd-ad6f-43a1-aabc-485a75f1a42f}</destination>
<destination>{d939376b-d3e4-4e6b-9d4d-92ff8cbd617f}</destination>
</relationship>
</object>
<object class="MixerBusPanner" id="{b5fdb9be-c232-4697-9ff4-32c337ca9cfa}" />
<object class="SilenceSound" id="{baa35633-7c5f-4801-8218-2ca20461e2b4}">
<relationship name="automators">
<destination>{7057829f-97fc-4dba-b6ca-62909f5e8d69}</destination>
</relationship>
</object>
<object class="MultiSound" id="{4828a929-4152-46e5-b98c-945a7a7ea1b1}">
<relationship name="sounds">
<destination>{4dffe96f-ae99-4cac-b298-7eeb65e521e0}</destination>
Expand All @@ -136,12 +146,6 @@
</relationship>
</object>
<object class="MixerBusFader" id="{5f07e29d-e0a6-4823-a857-e7ffb0c64ac9}" />
<object class="MixerBusEffectChain" id="{68b83339-e8c6-49c6-8d91-d80b3f5d42f4}">
<relationship name="effects">
<destination>{7db1ee88-2e2c-458f-86a3-4707c6e1d1d3}</destination>
</relationship>
</object>
<object class="MixerBusPanner" id="{9bfa4f8e-25cc-42df-a016-9e16357452c9}" />
<object class="MixerBusFader" id="{9069bddd-ad6f-43a1-aabc-485a75f1a42f}" />
<object class="SpatialiserEffect" id="{d939376b-d3e4-4e6b-9d4d-92ff8cbd617f}">
<property name="userStereoSeparation">
Expand All @@ -151,6 +155,14 @@
<destination>{d0dd02e5-0744-4c06-9a12-193db7e36922}</destination>
</relationship>
</object>
<object class="Automator" id="{7057829f-97fc-4dba-b6ca-62909f5e8d69}">
<property name="nameOfPropertyBeingAutomated">
<value>duration</value>
</property>
<relationship name="automationCurves">
<destination>{2a8988d0-789f-411d-aa48-d9d033b17f54}</destination>
</relationship>
</object>
<object class="SingleSound" id="{4dffe96f-ae99-4cac-b298-7eeb65e521e0}">
<relationship name="audioFile">
<destination>{bdba604e-eb1c-4dec-8a23-2df5dc12f1db}</destination>
Expand Down Expand Up @@ -196,7 +208,6 @@
<destination>{91075e86-d92e-42ae-a719-7c70cc11cb68}</destination>
</relationship>
</object>
<object class="MixerBusFader" id="{7db1ee88-2e2c-458f-86a3-4707c6e1d1d3}" />
<object class="Automator" id="{d0dd02e5-0744-4c06-9a12-193db7e36922}">
<property name="nameOfPropertyBeingAutomated">
<value>panBlend</value>
Expand All @@ -206,6 +217,15 @@
<destination>{2654bb0b-10ce-41cf-af83-58ed41c0bfe6}</destination>
</relationship>
</object>
<object class="AutomationCurve" id="{2a8988d0-789f-411d-aa48-d9d033b17f54}">
<relationship name="parameter">
<destination>{255c0af3-d82c-48de-970b-933bda576119}</destination>
</relationship>
<relationship name="automationPoints">
<destination>{fcb31373-130a-4d8d-88e2-97f29331d23c}</destination>
<destination>{6f444e49-8cd2-4993-8736-15f5eb488fe0}</destination>
</relationship>
</object>
<object class="AutomationCurve" id="{11089163-3c00-4d47-b46b-d05812aea332}">
<relationship name="parameter">
<destination>{12032229-6fd3-48fb-8248-fd442b00a139}</destination>
Expand All @@ -220,6 +240,22 @@
<destination>{242edb1b-6363-4528-8f9f-9078bf04bfc6}</destination>
</relationship>
</object>
<object class="AutomationPoint" id="{fcb31373-130a-4d8d-88e2-97f29331d23c}">
<property name="position">
<value>0</value>
</property>
<property name="value">
<value>0</value>
</property>
</object>
<object class="AutomationPoint" id="{6f444e49-8cd2-4993-8736-15f5eb488fe0}">
<property name="position">
<value>60</value>
</property>
<property name="value">
<value>60000</value>
</property>
</object>
<object class="AutomationPoint" id="{0c5c18ab-264b-49e9-a767-ca7b449c5a05}">
<property name="position">
<value>0</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@
<object class="MixerBusFader" id="{dec92e77-c810-49a8-9a4f-55b174e7cea6}" />
<object class="SpatialiserEffect" id="{8f75545a-661d-4356-bf9f-e41179c15338}" />
<object class="EventSound" id="{1a609f3f-4ffb-4bb4-b5fc-3b144c6a6aca}">
<relationship name="parameters">
<destination>{bd0a1f98-e9b3-4358-bd8d-8dc673720bcc}</destination>
<destination>{8d4e9391-e0ab-4bf2-8ae1-2cb8b2fcc6e6}</destination>
</relationship>
<relationship name="event">
<destination>{14de5335-ec95-49af-ba08-f9f994d198c7}</destination>
</relationship>
Expand All @@ -148,4 +152,14 @@
</relationship>
</object>
<object class="MixerBusFader" id="{81b6e169-1935-4860-9048-40dea48559b1}" />
<object class="ParameterProperty" id="{bd0a1f98-e9b3-4358-bd8d-8dc673720bcc}">
<relationship name="parameter">
<destination>{2f19ed91-ae76-4949-8341-65e96d7289b0}</destination>
</relationship>
</object>
<object class="ParameterProperty" id="{8d4e9391-e0ab-4bf2-8ae1-2cb8b2fcc6e6}">
<relationship name="parameter">
<destination>{cc5dbe11-70b2-48b5-a896-bf8e14911818}</destination>
</relationship>
</object>
</objects>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<relationship name="parameters">
<destination>{03a87551-be1b-495b-b05d-596221f5f706}</destination>
<destination>{ba9ad230-e03d-4506-b5a0-2aeb5a8b9751}</destination>
<destination>{f76091f1-08f6-4ac7-b703-6a06ed1d3a1f}</destination>
</relationship>
<relationship name="banks">
<destination>{6f6c823e-9073-439e-9503-3b2b490ddbfb}</destination>
Expand All @@ -43,7 +44,8 @@
</object>
<object class="MasterTrack" id="{97666c14-ec19-4fb3-acc3-db569c4d65d1}">
<relationship name="automationTracks">
<destination>{be5f00d7-2aee-4c35-adac-2f857328417d}</destination>
<destination>{2015b7cc-f957-411f-9b91-c7ce3da1e8f0}</destination>
<destination>{5432be53-62b7-4e57-877f-2a372869711b}</destination>
</relationship>
<relationship name="modules">
<destination>{1833eab9-d3ed-495c-8dc6-6ced02d0023d}</destination>
Expand Down Expand Up @@ -80,6 +82,11 @@
<destination>{540cf702-5f8a-4a1d-99f5-d9a31a53c833}</destination>
</relationship>
</object>
<object class="ParameterProxy" id="{f76091f1-08f6-4ac7-b703-6a06ed1d3a1f}">
<relationship name="preset">
<destination>{255c0af3-d82c-48de-970b-933bda576119}</destination>
</relationship>
</object>
<object class="EventMixerMaster" id="{af33f200-e755-4d69-9597-5def46c40c4a}">
<relationship name="effectChain">
<destination>{c7cefa86-ef7f-4549-ac6b-a01dcb464825}</destination>
Expand All @@ -91,13 +98,19 @@
<destination>{34f7799d-ca7f-42a0-aabd-c904ec571a55}</destination>
</relationship>
</object>
<object class="AutomationTrack" id="{be5f00d7-2aee-4c35-adac-2f857328417d}">
<object class="AutomationTrack" id="{2015b7cc-f957-411f-9b91-c7ce3da1e8f0}">
<relationship name="automator">
<destination>{b09ba597-cbdf-4c77-8cdf-6e210bc409e1}</destination>
</relationship>
</object>
<object class="AutomationTrack" id="{5432be53-62b7-4e57-877f-2a372869711b}">
<relationship name="automator">
<destination>{d5383c60-dc96-4ca5-9d32-674ada81bc22}</destination>
</relationship>
</object>
<object class="MultiSound" id="{1833eab9-d3ed-495c-8dc6-6ced02d0023d}">
<relationship name="sounds">
<destination>{cedd8c48-2509-46fe-91a2-5f8d57040cb6}</destination>
<destination>{2f9a26db-71a7-4215-8bf3-b669341beb9d}</destination>
</relationship>
</object>
Expand All @@ -114,6 +127,11 @@
</relationship>
</object>
<object class="MixerBusPanner" id="{f9e19d4b-40d9-4e37-926b-5dba8bc3880d}" />
<object class="SilenceSound" id="{cedd8c48-2509-46fe-91a2-5f8d57040cb6}">
<relationship name="automators">
<destination>{d5383c60-dc96-4ca5-9d32-674ada81bc22}</destination>
</relationship>
</object>
<object class="MultiSound" id="{2f9a26db-71a7-4215-8bf3-b669341beb9d}">
<relationship name="sounds">
<destination>{9b9dc9e9-2435-4359-97fd-535e67ae46bc}</destination>
Expand Down Expand Up @@ -144,6 +162,14 @@
<destination>{b09ba597-cbdf-4c77-8cdf-6e210bc409e1}</destination>
</relationship>
</object>
<object class="Automator" id="{d5383c60-dc96-4ca5-9d32-674ada81bc22}">
<property name="nameOfPropertyBeingAutomated">
<value>duration</value>
</property>
<relationship name="automationCurves">
<destination>{0122cb9d-2fe0-4d33-836d-09088d51f3a8}</destination>
</relationship>
</object>
<object class="SingleSound" id="{9b9dc9e9-2435-4359-97fd-535e67ae46bc}">
<relationship name="audioFile">
<destination>{f0408717-954e-4a6b-8161-a0076e16d9c2}</destination>
Expand Down Expand Up @@ -233,6 +259,15 @@
<destination>{342c4ac6-3526-4f26-a652-9915c4d066a5}</destination>
</relationship>
</object>
<object class="AutomationCurve" id="{0122cb9d-2fe0-4d33-836d-09088d51f3a8}">
<relationship name="parameter">
<destination>{255c0af3-d82c-48de-970b-933bda576119}</destination>
</relationship>
<relationship name="automationPoints">
<destination>{dbbc3a4f-fb9b-4358-987e-6cfd51e536c8}</destination>
<destination>{14161fee-c0aa-4126-a8e4-4ebe4e06bcab}</destination>
</relationship>
</object>
<object class="AutomationCurve" id="{c93455ec-3a36-4fd2-aa53-dcf60d66ecfe}">
<relationship name="parameter">
<destination>{6eb3d9cb-e5b9-4596-b62f-b8b1c991c45b}</destination>
Expand All @@ -247,6 +282,22 @@
<destination>{75f0e939-b147-4d77-93a0-6c4a74102569}</destination>
</relationship>
</object>
<object class="AutomationPoint" id="{dbbc3a4f-fb9b-4358-987e-6cfd51e536c8}">
<property name="position">
<value>0</value>
</property>
<property name="value">
<value>0</value>
</property>
</object>
<object class="AutomationPoint" id="{14161fee-c0aa-4126-a8e4-4ebe4e06bcab}">
<property name="position">
<value>60</value>
</property>
<property name="value">
<value>60000</value>
</property>
</object>
<object class="AutomationPoint" id="{4170eeb1-c752-4cda-9a74-2fe978b45050}">
<property name="position">
<value>0</value>
Expand Down
14 changes: 5 additions & 9 deletions SCHIZO/Jukebox/CustomJukeboxDisk.BelowZero.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
using Nautilus.Handlers;
using Nautilus.Utility;

namespace SCHIZO.Jukebox;

public sealed class CustomJukeboxDisk : JukeboxDisk
{
public string unlockFmodEvent;

public new void Start()
{
if (track == default) LOGGER.LogWarning($"Jukebox disk {name} at {transform.position} was not assigned a track");

if (!string.IsNullOrEmpty(unlockFmodEvent))
acquireSound = AudioUtils.GetFmodAsset(unlockFmodEvent);
if (track == default)
{
LOGGER.LogError($"Jukebox disk {name} at {transform.position} was not assigned a track, self-destructing");
Destroy(this);
}

base.Start();
}
Expand Down
3 changes: 2 additions & 1 deletion SCHIZO/Jukebox/CustomJukeboxTrack.BelowZero.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using FMOD;
using Nautilus.Handlers;
using Nautilus.Utility;
using SCHIZO.Helpers;
using UnityEngine;
using BZJukebox = Jukebox;

Expand Down Expand Up @@ -145,7 +146,7 @@ private void SpawnDisk(BZJukebox.UnlockableTrack trackId, Vector3 position, Vect

CustomJukeboxDisk diskComp = disk.EnsureComponent<CustomJukeboxDisk>();
diskComp.track = trackId;
diskComp.unlockFmodEvent = unlockFmodEvent;
diskComp.acquireSound = AudioUtils.GetFmodAsset(unlockFmodEvent, FMODHelpers.GetId(unlockFmodEvent));

disk.GetComponent<LargeWorldEntity>().enabled = false; // don't save

Expand Down
7 changes: 2 additions & 5 deletions SCHIZO/Sounds/Patches/ItemSoundsPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,11 @@ private static void Patch(GameObject useObj)
}
}

// TODO get the first inventory item with the ingredients' techtype
// the techtype passed to the function is actually the craft result
// how did this ever work in the first place holy
private static float delayPerItem = 0.2f;
[HarmonyPatch(typeof(Crafter), nameof(Crafter.OnCraftingBegin))]
[HarmonyPostfix]
public static void PlayCustomCookSound(Crafter __instance, TechType techType)
public static void PlayCustomCookSound(Crafter __instance, TechType techType) // the craft result
{
const float delayPerItem = 0.1f;
#if BELOWZERO
IEnumerable<NIngredient> ingredients = TechData.GetIngredients(techType);
#else
Expand Down

0 comments on commit 344c328

Please sign in to comment.