Release v4.1.9

This commit is contained in:
ivan tkachenko 2026-01-25 21:07:15 +02:00
parent a68e8c7194
commit 11b26bb693
20 changed files with 343 additions and 55 deletions

6
.gitignore vendored
View File

@ -482,3 +482,9 @@ $RECYCLE.BIN/
# Vim temporary swap files
*.swp
# VS Code
.vscode
# Build artifacts
Packages/

View File

@ -0,0 +1,158 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using System.Windows;
public class HookahAssetBuilder
{
static readonly string ModManagerProfilesPath =
@"C:\Users\user\AppData\Roaming\com.kesomannen.gale\lethal-company\profiles";
static readonly string ModPackProfileName = "HookahPlace Test";
static readonly string ModPackModName = "HookahPlace-DEV";
static readonly string ModPackProfilePath = $@"{ModManagerProfilesPath}/{ModPackProfileName}";
static readonly string ModPackHookahPlacePath = @$"{ModPackProfilePath}/BepInEx/plugins/{ModPackModName}";
static readonly string ModProjectPath = @"D:\Code\LC-Decompiled\Mods\HookahPlace";
static readonly string DllName = "Ratijas.HookahPlace.dll";
static readonly string DllSourcePath = $@"{ModProjectPath}/HookahPlace/bin/Debug/netstandard2.1/{DllName}";
static readonly string[] DllDestinationPaths = new string[]
{
// relative to Unity project
$@"Assets/LethalCompany/Mods/plugins/HookahPlace/Dependencies/{ModPackModName}",
ModPackHookahPlacePath,
};
static readonly string AssetBundlesPath = "Assets/LethalCompany/Mods/plugins/HookahPlace/AssetBundles";
static readonly string[] AssetBundlesNames = new string[]
{
"hookahplaceasset",
"hookahunlockableassets",
};
static readonly string[] AssetBundlesDestinationPaths = new string[]
{
@$"{ModPackHookahPlacePath}/Assets",
@$"{ModProjectPath}/HookahPlace/res",
};
[MenuItem("HookahPlace/All")]
public static void DoAll()
{
CompileScripts();
BuildAssetBundles();
InstallAssetBundles();
LaunchGame();
}
[MenuItem("HookahPlace/1. Compile Scripts")]
public static void CompileScripts()
{
var psi = new ProcessStartInfo
{
FileName = "dotnet",
Arguments = "build",
UseShellExecute = false,
};
var proc = Process.Start(psi);
proc.WaitForExit();
if (proc.ExitCode != 0)
{
UnityEngine.Debug.Log($"Process exited with non-zero code: {proc.ExitCode}");
// proc.StandardOutput
return;
}
foreach (var destinationPath in DllDestinationPaths)
{
Directory.CreateDirectory(destinationPath);
var sourceFileName = DllSourcePath;
var destFileName = $"{destinationPath}/{DllName}";
FileCopy(sourceFileName, destFileName);
}
}
[MenuItem("HookahPlace/2. Build Asset Bundles")]
public static void BuildAssetBundles()
{
UnityEngine.Debug.Log("Building asset bundles for HookahPlace...");
Directory.CreateDirectory(AssetBundlesPath);
BuildPipeline.BuildAssetBundles(AssetBundlesPath, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneWindows);
if (Application.isBatchMode)
{
EditorApplication.Exit(0);
}
}
[MenuItem("HookahPlace/3. Install Asset Bundles")]
public static void InstallAssetBundles()
{
UnityEngine.Debug.Log("Installing asset bundles for HookahPlace...");
foreach (var destinationPath in AssetBundlesDestinationPaths)
{
Directory.CreateDirectory(destinationPath);
foreach (var name in AssetBundlesNames)
{
var sourceFileName = $"{AssetBundlesPath}/{name}";
var destFileName = $"{destinationPath}/{name}";
FileCopy(sourceFileName, destFileName);
}
}
}
[MenuItem("HookahPlace/4. Launch Game")]
public static void LaunchGame()
{
UnityEngine.Debug.Log($"Launching Gale profile with profile '{ModPackProfileName}'...");
string BepInExPreloaderDllPath = $@"{ModPackProfilePath}/BepInEx/core/BepInEx.Preloader.dll";
string[] args = new string[]
{
@"C:\Program Files (x86)\Steam\steam.exe",
"-applaunch",
"1966720",
"--doorstop-enabled",
"true",
"--doorstop-target-assembly",
BepInExPreloaderDllPath,
};
var psi = new ProcessStartInfo
{
FileName = args[0],
Arguments = string.Join(" ", args.Skip(1).Select(QuoteArgument)),
UseShellExecute = false,
};
Process.Start(psi);
GUIUtility.systemCopyBuffer = "hookah";
}
static void FileCopy(string sourceFileName, string destFileName)
{
UnityEngine.Debug.Log($"File.Copy {sourceFileName} => {destFileName}");
File.Copy(sourceFileName, destFileName, overwrite: true);
}
static string QuoteArgument(string arg)
{
if (string.IsNullOrEmpty(arg))
return "\"\"";
if (arg.IndexOfAny(new char[] { ' ', '\t', '"' }) == -1)
return arg;
return "\"" + arg.Replace("\"", "\\\"") + "\"";
}
}

1
Editor/README.md Normal file
View File

@ -0,0 +1 @@
This folder contains C# scripts for Unity project with the decompiled game.

View File

@ -0,0 +1,5 @@
# Development
- Keep in sync versions of DawnLib in `thunderstore.toml` and `*.csproj`.
- Build AssetBundles in Unity, and copy them to the `res` folder.
- Build in the `Release` configuration to create the zip

View File

@ -4,13 +4,12 @@
<PropertyGroup>
<AssemblyName>Ratijas.HookahPlace</AssemblyName>
<Product>HookahPlace</Product>
<!-- Change to whatever version you're currently on. -->
<Version>1.0.0</Version>
<Version>4.1.9</Version>
</PropertyGroup>
<!-- Project Properties -->
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>CRLib._ModTemplate</RootNamespace>
<RootNamespace>HookahPlace</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
</PropertyGroup>
@ -37,16 +36,15 @@
<!-- Embed Debug Symbols for Easier Debugging -->
<PropertyGroup>
<DebugSymbols>true</DebugSymbols>
<!-- NetcodePatch requires anything but 'full' -->
<DebugType>embedded</DebugType>
<!--
Trim the project path to prevent players from potentially
viewing Private Information in stack traces.
-->
<PathMap>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./</PathMap>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration) == 'Release'">
<PathMap>$(UserProfile)=~,$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=$(PackageId)/</PathMap>
</PropertyGroup>
<PropertyGroup>
<DawnLibVersion>0.4.*</DawnLibVersion>
<DawnLibVersion>0.7.3</DawnLibVersion>
</PropertyGroup>
<!-- Primary Package References - BepInEx -->
@ -58,7 +56,7 @@
<PackageReference Include="LethalCompany.GameLibs.Steam" Version="*-*" PrivateAssets="all"/>
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" PrivateAssets="all"/>
<PackageReference Include="TeamXiaolan.DawnLib" Version="$(DawnLibVersion)" PrivateAssets="all"/>
<PackageReference Include="TeamXiaolan.DawnLib.DuskMod" Version="$(DawnLibVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">

View File

@ -1,17 +1,11 @@
<Project>
<!-- Custom Variables -->
<PropertyGroup>
<!--#if (BepInExPluginLocation != "") -->
<CopyToDirectory>.../Lethal Company/BepInEx/plugins/</CopyToDirectory>
<!--#endif -->
<!--#if (MMHOOKLocation != "") -->
<MMHOOKDirectory>.../Lethal Comapny/BepInEx/plugins/MMHOOK/</MMHOOKDirectory>
<!--#endif -->
</PropertyGroup>
<!--#if (BepInExPluginLocation != "") -->
<!-- Copy to Plugin Directory for Quicker Testing -->
<!--#if (UseNetcodePatcher) -->
<Target Name="CopyFiles" DependsOnTargets="NetcodePatch" AfterTargets="PostBuildEvent">
<MakeDir
Directories="$(CopyToDirectory)$(Product)-DEV/Assets"
@ -26,5 +20,4 @@
</ItemGroup>
<Copy SourceFiles="@(AssetBundles)" DestinationFolder="$(CopyToDirectory)$(Product)-DEV/Assets/"/>
</Target>
<!--#endif -->
</Project>

View File

@ -1,12 +1,21 @@
# TODO before release:
- `thunderstore.toml`:
- **Important**: Set `namespace` (this is your author name) and `description`
- Set `websiteUrl`
- Update `DawnLib` version
- Note that the name of your mod is determined by the name of the project, and the version is determined in your `.csproj`
- `.csproj`:
- Update `DawnLib` version
- `HookahPlaceKeys.cs`:
- Look in this file
- Update this README! (it gets used to generate your mods readme)
- Finally, build in the `Release` configuration to create the zip
# Hookah Place
_Relaxing hookah as a ship upgrade_
Welcome to your very own Lethal Hookah Place!
Become a ship-mom (or a ship-dad) and smoke shisha while guiding your crew over a walkie-talkie. Let 'em know you're having a good time! 🗣💯💭
![Hookah at ship](https://ratijas.me/share/public/LC/HookahPlace/HookahPlace-demo-1.jpg)
## Store
The mod adds a ship decor/furniture to the store called "Hookah".
The store rotates between random 4-6 entries every quota. To make the hookah always available in the store, use another mod like [`StoreRotationConfig` by `pacoito`](https://thunderstore.io/c/lethal-company/p/pacoito/StoreRotationConfig/) with the `stockAll` option toggled ON.
## Made by Ratijas
Also check out my other mod, 🎵 [Muzika Gromche — The ultimate Jester party music mod](https://thunderstore.io/c/lethal-company/p/Ratijas/MuzikaGromche/)!
Hookah model made in Blender: [HookahPlace.blend](https://ratijas.me/share/public/LC/HookahPlace/HookahPlace.blend)

View File

@ -1,2 +1,3 @@
# 1.0.0
# 4.1.9
Inital release

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -2,13 +2,16 @@
schemaVersion = "0.0.1"
[package]
namespace = ""
description = ""
websiteUrl = ""
namespace = "Ratijas"
name = "HookahPlace"
versionNumber = "4.1.9"
description = "Relaxing hookah as a ship upgrade"
websiteUrl = "https://git.vilunov.me/ratijas/HookahPlace"
containsNsfwContent = false
[package.dependencies]
BepInEx-BepInExPack = "5.4.2100"
TeamXiaolan-DawnLib = "0.4.0"
BepInEx-BepInExPack = "5.4.2304"
TeamXiaolan-DawnLib = "0.7.3"
[build]
icon = "./icon.png"
@ -29,6 +32,7 @@ target = "/"
[publish]
repository = "https://thunderstore.io"
communities = [ "lethal-company", ]
communities = [ "lethal-company" ]
[publish.categories]
lethal-company = [ "mods", "tools", "libraries", "clientside", "serverside" ]
# https://thunderstore.io/api/experimental/community/lethal-company/category/
lethal-company = [ "mods", "furniture", "clientside", "serverside" ]

Binary file not shown.

Binary file not shown.

View File

@ -1,13 +0,0 @@
using Dawn;
using Dusk;
namespace HookahPlace.Content;
// REMOVE THIS FILE IF NOT USING DUSK
public class ExampleContentHandler : ContentHandler<ExampleContentHandler>
{
public ExampleContentHandler(DuskMod mod) : base(mod)
{
RegisterContent("content bundle name here", out DefaultBundle? bundle);
}
}

View File

@ -0,0 +1,19 @@
using Dusk;
namespace HookahPlace.Content;
public class HookahContentHandler : ContentHandler<HookahContentHandler>
{
const int HOOKAH_PRICE = 130;
public HookahContentHandler(DuskMod mod) : base(mod)
{
NukeDawnLibConfig.NukeUnlockable(HookahPlace.Config, "HookahUnlockable", "Hookah", HOOKAH_PRICE);
if (!RegisterContent("hookahunlockableassets", out DefaultBundle? bundle, forceEnabled: true) || bundle == null)
{
HookahPlace.Logger.LogError($"Failed to register content");
return;
}
}
}

View File

@ -0,0 +1,22 @@
using BepInEx.Configuration;
using Dusk;
namespace HookahPlace.Content;
internal static class NukeDawnLibConfig
{
static internal void NukeUnlockable(ConfigFile config, string heading, string name, int cost)
{
heading = $"{heading} Options";
var costName = $"{name} | Cost";
var disclaimer = "Sorry, this is not configurable. This is a dirty hack to suppress DawnLib/DuskMod from allowing any configurability here.";
var ctx = new ConfigContext(config, heading);
var enabledEntry = ctx.Bind("Enabled", disclaimer, true);
enabledEntry.Value = true;
var costEntry = ctx.Bind(costName, disclaimer, cost);
costEntry.Value = cost;
}
}

View File

@ -0,0 +1,78 @@
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
namespace HookahPlace;
class HookahBehaviour : NetworkBehaviour
{
public Transform? smokePosition;
public GameObject? smokePrefab;
public Color[] Palette = [];
private Color? ApplyLaterSmokeColor = null;
private LocalVolumetricFog? ApplyLaterSmokeVolumetricFog;
// Hookah smoke animation emits an event that invokes this method.
// The prefab that it spawns self-destructs at the end of its animation.
//
// The fog works through LocalVolumetricFog components.
// Inside the ship and under any roof outdoors there are placed FogExclusionZone objects,
// with Blending set to Override which essentially removes the fog in those zones.
//
// The solution is to set your Hookah smoke blending to Additive (to preserve seamless transitions when fading out),
// but crank up priority to something unreasonably high like 9001, so that it adds to that Override layer.
public void SpawnSmoke()
{
if (smokePosition == null || smokePrefab == null)
{
return;
}
var ship = transform.parent.parent;
var smoke = Instantiate(smokePrefab, smokePosition.position, Quaternion.identity, ship);
var fog = smoke.GetComponentInChildren<LocalVolumetricFog>();
// Randomize smoke color.
// Clients set a client-side random color just in case, but it should be overridden by server rpc shortly.
var index = Random.RandomRangeInt(0, Palette.Length);
Color randomColor = Palette[index];
if (IsServer)
{
SetSmokeColorClientRpc(randomColor);
ApplySmokeColor(fog, randomColor);
}
else if (ApplyLaterSmokeColor is { } serverColor)
{
ApplySmokeColor(fog, serverColor);
ApplyLaterSmokeColor = null;
}
else
{
// color has not arrived from server (yet), for now set local random color
ApplySmokeColor(fog, randomColor);
ApplyLaterSmokeVolumetricFog = fog;
}
}
[Rpc(SendTo.NotServer)]
public void SetSmokeColorClientRpc(Color color)
{
if (ApplyLaterSmokeVolumetricFog is { } fog)
{
ApplySmokeColor(fog, color);
ApplyLaterSmokeVolumetricFog = null;
}
else
{
// smoke has not been spawned (yet), remember the color for later.
ApplyLaterSmokeColor = color;
}
}
private static void ApplySmokeColor(LocalVolumetricFog fog, Color color)
{
var parameters = fog.parameters;
parameters.albedo = color;
fog.parameters = parameters;
}
}

View File

@ -4,6 +4,9 @@ using System.Reflection;
using UnityEngine;
using Dawn;
using Dawn.Utils;
using HarmonyLib;
using Dusk;
using BepInEx.Configuration;
namespace HookahPlace;
@ -12,16 +15,18 @@ namespace HookahPlace;
public class HookahPlace : BaseUnityPlugin
{
internal new static ManualLogSource Logger { get; private set; } = null!;
internal new static ConfigFile Config { get; private set; } = null!;
internal static PersistentDataContainer PersistentData { get; private set; } = null!;
internal static DuskMod Mod { get; private set; } = null!;
private void Awake()
{
Logger = base.Logger;
Config = base.Config;
// Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), MyPluginInfo.PLUGIN_GUID) // uncomment if using Harmony to patch
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), MyPluginInfo.PLUGIN_GUID);
// Example Persistent Data Container Usage
// You can do anything you want with this DataContainer, there are a few additonal ones under the DawnLib class that pertain to actual save files
@ -31,6 +36,10 @@ public class HookahPlace : BaseUnityPlugin
// if you want to do config migration you should use DawnLib.GetCurrentInstallSave instead.
PersistentData.Set(HookahPlaceKeys.LastVersion, MyPluginInfo.PLUGIN_VERSION);
AssetBundle mainBundle = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "hookahplaceasset");
Mod = DuskMod.RegisterMod(this, mainBundle);
Mod.RegisterContentHandlers();
Logger.LogInfo($"{MyPluginInfo.PLUGIN_GUID} v{MyPluginInfo.PLUGIN_VERSION} has loaded!");
}
}

View File

@ -12,8 +12,6 @@ namespace HookahPlace;
// If you contain lots of keys, you might want to use child classes e.g: HookahPlaceKeys.Items.MyItem
// Note: the use of `partial` here is because of the DawnLib SourceGenerator, which you might not be using.
public static partial class HookahPlaceKeys {
// You may want to update this namespace. It should be "Snake case", e.g: FacilityMeltdown's namespace should be `facility_meltdown`
// You can also shorten it if you want, e.g: `meltdown`
public const string Namespace = "hookah_place";
// Data Keys