mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2026-01-01 14:17:31 +00:00
mass commit of laziness
This commit is contained in:
parent
ce992c70ee
commit
6d4fc549d9
167 changed files with 5471 additions and 675 deletions
|
|
@ -96,6 +96,9 @@ public static partial class BTKUIAddon
|
|||
|
||||
public static void OnStickerRestrictionUpdated(bool isRestricted = false) //TODO: add Icon changing, Bono needs to expose the value first.
|
||||
{
|
||||
if (_rootPage == null || _placeStickersButton == null)
|
||||
return;
|
||||
|
||||
if (isRestricted)
|
||||
{
|
||||
_rootPage.MenuSubtitle = "Stickers... are sadly disabled in this world.";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using BTKUILib.UIObjects;
|
|||
using NAK.Stickers.Networking;
|
||||
using NAK.Stickers.Utilities;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NAK.Stickers.Integrations;
|
||||
|
||||
|
|
@ -50,10 +49,10 @@ public static partial class BTKUIAddon
|
|||
{
|
||||
_rootPage = new Page(ModSettings.ModName, ModSettings.SM_SettingsCategory, true, "Stickers-Puzzle") // sticker icon will be left blank as it is updated on world join, AFTER Icon value is exposed..
|
||||
{
|
||||
MenuTitle = ModSettings.SM_SettingsCategory,
|
||||
MenuTitle = ModSettings.SM_SettingsCategory + $" (Network Version v{ModNetwork.NetworkVersion})",
|
||||
MenuSubtitle = "", // left this blank as it is defined when the world loads
|
||||
};
|
||||
|
||||
|
||||
_rootPageElementID = _rootPage.ElementID;
|
||||
|
||||
QuickMenuAPI.OnTabChange += OnTabChange;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using BTKUILib;
|
||||
using BTKUILib;
|
||||
using BTKUILib.UIObjects;
|
||||
using BTKUILib.UIObjects.Components;
|
||||
using MTJobSystem;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
using ABI_RC.Core;
|
||||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.UI.UIRework.Managers;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using MelonLoader;
|
||||
using NAK.Stickers.Integrations;
|
||||
|
|
@ -55,8 +53,8 @@ public class StickerMod : MelonMod
|
|||
if (!Input.GetKeyDown((KeyCode)ModSettings.Entry_PlaceBinding.Value))
|
||||
return;
|
||||
|
||||
if (CVRInputManager.Instance.textInputFocused
|
||||
|| ViewManager.Instance.textInputFocused) // BRUH
|
||||
if (CVRInputManager.Instance.EventSystemOverwritten
|
||||
|| KeyboardManager.Instance.IsViewShown) // BRUH
|
||||
return; // prevent placing stickers while typing
|
||||
|
||||
StickerSystem.Instance.PlaceStickerFromControllerRay(PlayerSetup.Instance.activeCam.transform);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,12 @@ public static class ModSettings
|
|||
internal static readonly MelonPreferences_Entry<bool> Entry_FriendsOnly =
|
||||
Category.CreateEntry("friends_only", false, "Friends Only", "Only allow friends to use stickers.");
|
||||
|
||||
internal static readonly MelonPreferences_Entry<StickerSize> Entry_StickerSize =
|
||||
Category.CreateEntry("sticker_size", StickerSize.Chonk, "Sticker Size", "The size of the sticker when placed.");
|
||||
|
||||
internal static readonly MelonPreferences_Entry<float> Entry_StickerOpacity =
|
||||
Category.CreateEntry("opacity", 1f, "Opacity", "The opacity of the sticker when placed.");
|
||||
|
||||
#endregion Stickers Mod Settings
|
||||
|
||||
#region Debug Settings
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ using System.Reflection;
|
|||
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/Stickers"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||
[assembly: MelonGame("ChilloutVR", "ChilloutVR")]
|
||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
[assembly: MelonColor(255, 246, 25, 99)] // red-pink
|
||||
|
|
@ -27,6 +27,6 @@ using System.Reflection;
|
|||
namespace NAK.Stickers.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.9";
|
||||
public const string Author = "NotAKidoS, SketchFoxsky";
|
||||
public const string Version = "1.1.1";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
||||
34
Stickers/Stickers/Enums/StickerSize.cs
Normal file
34
Stickers/Stickers/Enums/StickerSize.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
namespace NAK.Stickers;
|
||||
|
||||
public enum StickerSize
|
||||
{
|
||||
Jarret,
|
||||
Bean,
|
||||
Smol,
|
||||
ChonkLite,
|
||||
Chonk, // Default (was Medium)
|
||||
HeckinChonk,
|
||||
DoubleHeckinChonk,
|
||||
TripleCursedUnit,
|
||||
RealityTearingAbomination,
|
||||
}
|
||||
|
||||
public static class StickerSizeExtensions
|
||||
{
|
||||
public static float GetSizeModifier(this StickerSize size)
|
||||
{
|
||||
return size switch
|
||||
{
|
||||
StickerSize.Jarret => 0.125f,
|
||||
StickerSize.Bean => 0.2f,
|
||||
StickerSize.Smol => 0.25f,
|
||||
StickerSize.ChonkLite => 0.5f,
|
||||
StickerSize.Chonk => 1f,
|
||||
StickerSize.HeckinChonk => 2f,
|
||||
StickerSize.DoubleHeckinChonk => 4f,
|
||||
StickerSize.TripleCursedUnit => 8f,
|
||||
StickerSize.RealityTearingAbomination => 16f,
|
||||
_ => 0.125f,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ public static partial class ModNetwork
|
|||
|
||||
internal const int MaxTextureSize = 1024 * 256; // 256KB
|
||||
|
||||
private const string NetworkVersion = "1.0.3"; // change each time network protocol changes
|
||||
internal const string NetworkVersion = "1.0.3"; // change each time network protocol changes
|
||||
private const string ModId = $"MelonMod.NAK.Stickers_v{NetworkVersion}";
|
||||
private const int ChunkSize = 1024; // roughly 1KB per ModNetworkMessage
|
||||
private const int MaxChunkCount = MaxTextureSize / ChunkSize;
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ public static partial class ModNetwork
|
|||
msg.Read(out Vector3 position);
|
||||
msg.Read(out Vector3 forward);
|
||||
msg.Read(out Vector3 up);
|
||||
msg.Read(out int size);
|
||||
msg.Read(out float opacity);
|
||||
|
||||
if (!StickerSystem.Instance.HasTextureHash(msg.Sender, textureHash))
|
||||
{
|
||||
|
|
@ -117,7 +119,7 @@ public static partial class ModNetwork
|
|||
StickerSystem.Instance.ClearStickersForPlayer(msg.Sender, stickerSlot); // Ensure no exploit
|
||||
}
|
||||
|
||||
StickerSystem.Instance.OnStickerPlaceReceived(msg.Sender, stickerSlot, position, forward, up);
|
||||
StickerSystem.Instance.OnStickerPlaceReceived(msg.Sender, stickerSlot, position, forward, up, (StickerSize)size, opacity);
|
||||
}
|
||||
|
||||
private static void HandleClearSticker(ModNetworkMessage msg)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public static partial class ModNetwork
|
|||
|
||||
#region Outbound Methods
|
||||
|
||||
public static void SendPlaceSticker(int stickerSlot, Vector3 position, Vector3 forward, Vector3 up)
|
||||
public static void SendPlaceSticker(int stickerSlot, Vector3 position, Vector3 forward, Vector3 up, StickerSize size, float opacity)
|
||||
{
|
||||
if (!_isSubscribedToModNetwork)
|
||||
return;
|
||||
|
|
@ -51,6 +51,8 @@ public static partial class ModNetwork
|
|||
modMsg.Write(position);
|
||||
modMsg.Write(forward);
|
||||
modMsg.Write(up);
|
||||
modMsg.Write((int)size);
|
||||
modMsg.Write(opacity);
|
||||
modMsg.Send();
|
||||
|
||||
LoggerOutbound($"PlaceSticker: Slot: {stickerSlot}, Hash: {_textureStorage[stickerSlot].textureHash}, Position: {position}, Forward: {forward}, Up: {up}");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ABI_RC.Core;
|
||||
using ABI_RC.Core.IO;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
|
|
@ -118,7 +117,7 @@ namespace NAK.Stickers
|
|||
_previewMaterial.mainTexture = texture;
|
||||
}
|
||||
|
||||
public void Place(RaycastHit hit, Vector3 forwardDirection, Vector3 upDirection, int spawnerIndex = 0)
|
||||
public void Place(RaycastHit hit, Vector3 forwardDirection, Vector3 upDirection, int spawnerIndex = 0, StickerSize size = StickerSize.Chonk, float opacity = 1f)
|
||||
{
|
||||
if (spawnerIndex < 0 || spawnerIndex >= _decalSpawners.Length)
|
||||
{
|
||||
|
|
@ -138,12 +137,14 @@ namespace NAK.Stickers
|
|||
|
||||
_lastPlacedPosition = hit.point;
|
||||
LastPlacedTime = Time.time;
|
||||
|
||||
|
||||
float sizeScale = size.GetSizeModifier();
|
||||
|
||||
// Add decal to the specified spawner
|
||||
_decalSpawners[spawnerIndex].AddDecal(
|
||||
_lastPlacedPosition, Quaternion.LookRotation(forwardDirection, upDirection),
|
||||
hitGO,
|
||||
DECAL_SIZE, DECAL_SIZE, 1f, 1f, 0f, rootObject);
|
||||
DECAL_SIZE * sizeScale, DECAL_SIZE * sizeScale, 1f, opacity, 0f, rootObject);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
|
|
@ -233,7 +234,7 @@ namespace NAK.Stickers
|
|||
private int _previewSpawnerIndex = -1;
|
||||
private float _flashTime;
|
||||
|
||||
public void PlacePreview(RaycastHit hit, Vector3 forwardDirection, Vector3 upDirection, int spawnerIndex = 0)
|
||||
public void PlacePreview(RaycastHit hit, Vector3 forwardDirection, Vector3 upDirection, int spawnerIndex = 0, StickerSize size = StickerSize.Chonk)
|
||||
{
|
||||
if (spawnerIndex < 0 || spawnerIndex >= _decalSpawners.Length)
|
||||
{
|
||||
|
|
@ -252,10 +253,12 @@ namespace NAK.Stickers
|
|||
|| hitGO.GetComponentInParent<Rigidbody>() != null) // movable
|
||||
rootObject = hitGO.transform;
|
||||
|
||||
float sizeScale = size.GetSizeModifier();
|
||||
|
||||
_previewDecalSpawner.AddDecal(
|
||||
hit.point, Quaternion.LookRotation(forwardDirection, upDirection),
|
||||
hitGO,
|
||||
DECAL_SIZE, DECAL_SIZE, 1f, 1f, 0f, rootObject);
|
||||
DECAL_SIZE * sizeScale, DECAL_SIZE * sizeScale, 1f, 1f, 0f, rootObject);
|
||||
}
|
||||
|
||||
public void UpdatePreview(int spawnerIndex)
|
||||
|
|
|
|||
|
|
@ -2,13 +2,9 @@
|
|||
using ABI_RC.Core.Networking.IO.Instancing;
|
||||
using ABI_RC.Core.UI;
|
||||
using ABI_RC.Systems.GameEventSystem;
|
||||
using JetBrains.Annotations;
|
||||
using NAK.Stickers.Networking;
|
||||
using NAK.Stickers.Utilities;
|
||||
using System.EnterpriseServices;
|
||||
using UnityEngine;
|
||||
using MelonLoader;
|
||||
using UnityEngine.ProBuilder.MeshOperations;
|
||||
using ABI.CCK.Components;
|
||||
using NAK.Stickers.Integrations;
|
||||
|
||||
namespace NAK.Stickers;
|
||||
|
|
@ -50,7 +46,7 @@ public partial class StickerSystem
|
|||
|
||||
CVRGameEventSystem.Player.OnJoinEntity.AddListener(Instance.OnPlayerJoined);
|
||||
CVRGameEventSystem.Player.OnLeaveEntity.AddListener(Instance.OnPlayerLeft);
|
||||
SchedulerSystem.AddJob(Instance.OnUpdate, 10f, -1);
|
||||
BetterScheduleSystem.AddJob(Instance.OnUpdate, 10f, -1);
|
||||
LoadAllImagesAtStartup();
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +62,8 @@ public partial class StickerSystem
|
|||
|
||||
private void OnWorldLoad()
|
||||
{
|
||||
IsRestrictedInstance = GameObject.Find("[DisableStickers]") != null;
|
||||
CVRDataStore worldDS = CVRWorld.Instance.DataStore;
|
||||
// IsRestrictedInstance = worldDS && worldDS.GetValue<bool>("StickersMod-ForceDisable");
|
||||
if (IsRestrictedInstance) StickerMod.Logger.Msg("Stickers are restricted by the world author.");
|
||||
BTKUIAddon.OnStickerRestrictionUpdated(IsRestrictedInstance);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ public partial class StickerSystem
|
|||
|
||||
#region Sticker Callbacks
|
||||
|
||||
public void OnStickerPlaceReceived(string playerId, int stickerSlot, Vector3 position, Vector3 forward, Vector3 up)
|
||||
=> AttemptPlaceSticker(playerId, position, forward, up, alignWithNormal: true, stickerSlot);
|
||||
public void OnStickerPlaceReceived(string playerId, int stickerSlot, Vector3 position, Vector3 forward, Vector3 up, StickerSize size, float opacity)
|
||||
=> AttemptPlaceSticker(playerId, size, opacity, position, forward, up, alignWithNormal: true, stickerSlot);
|
||||
|
||||
public void OnStickerClearReceived(string playerId, int stickerSlot)
|
||||
=> ClearStickersForPlayer(playerId, stickerSlot);
|
||||
|
|
|
|||
|
|
@ -51,15 +51,15 @@ public partial class StickerSystem
|
|||
|
||||
private bool PlaceStickerSelf(Vector3 position, Vector3 forward, Vector3 up, bool alignWithNormal = true)
|
||||
{
|
||||
if (!AttemptPlaceSticker(PlayerLocalId, position, forward, up, alignWithNormal, SelectedStickerSlot))
|
||||
if (!AttemptPlaceSticker(PlayerLocalId, ModSettings.Entry_StickerSize.Value, ModSettings.Entry_StickerOpacity.Value, position, forward, up, alignWithNormal, SelectedStickerSlot))
|
||||
return false; // failed
|
||||
|
||||
// placed, now network
|
||||
ModNetwork.SendPlaceSticker(SelectedStickerSlot, position, forward, up);
|
||||
ModNetwork.SendPlaceSticker(SelectedStickerSlot, position, forward, up, ModSettings.Entry_StickerSize.Value, ModSettings.Entry_StickerOpacity.Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool AttemptPlaceSticker(string playerId, Vector3 position, Vector3 forward, Vector3 up, bool alignWithNormal = true, int stickerSlot = 0, bool isPreview = false)
|
||||
private bool AttemptPlaceSticker(string playerId, StickerSize size, float opacity, Vector3 position, Vector3 forward, Vector3 up, bool alignWithNormal = true, int stickerSlot = 0, bool isPreview = false)
|
||||
{
|
||||
// if the world contained a gameobject with the [DisableStickers] name and restricted the instance disable stickers!
|
||||
if (IsRestrictedInstance)
|
||||
|
|
@ -81,11 +81,11 @@ public partial class StickerSystem
|
|||
|
||||
if (isPreview)
|
||||
{
|
||||
stickerData.PlacePreview(hit, alignWithNormal ? -hit.normal : forward, up, stickerSlot);
|
||||
stickerData.PlacePreview(hit, alignWithNormal ? -hit.normal : forward, up, stickerSlot, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
stickerData.Place(hit, alignWithNormal ? -hit.normal : forward, up, stickerSlot);
|
||||
stickerData.Place(hit, alignWithNormal ? -hit.normal : forward, up, stickerSlot, size, opacity);
|
||||
stickerData.PlayAudio();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ public partial class StickerSystem
|
|||
|
||||
public void PlaceStickerPreview(Vector3 position, Vector3 forward, Vector3 up)
|
||||
{
|
||||
AttemptPlaceSticker(PlayerLocalId, position, forward, up, true, SelectedStickerSlot, true);
|
||||
AttemptPlaceSticker(PlayerLocalId, ModSettings.Entry_StickerSize.Value, ModSettings.Entry_StickerOpacity.Value, position, forward, up, true, SelectedStickerSlot, true);
|
||||
}
|
||||
|
||||
public void UpdateStickerPreview()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using BTKUILib.UIObjects.Components;
|
||||
using MTJobSystem;
|
||||
using NAK.Stickers.Integrations;
|
||||
using System.Collections.Concurrent;
|
||||
using BTKUILib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.Stickers.Utilities;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"_id": 232,
|
||||
"name": "Stickers",
|
||||
"modversion": "1.0.9",
|
||||
"gameversion": "2025r179",
|
||||
"loaderversion": "0.6.1",
|
||||
"modversion": "1.1.1",
|
||||
"gameversion": "2025r181",
|
||||
"loaderversion": "0.7.2",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS, SketchFoxsky",
|
||||
"author": "NotAKidoS",
|
||||
"description": "Stickers! Allows you to place small images on any surface. Requires both users to have the mod installed. Synced over Mod Network.\n\nLimitations:\n- Image should be under 256KB in size.\n- Image dimensions should be a power of 2 (e.g. 512x512, 1024x1024).\n - If the image exceeds the size limit or is not a power of 2 the mod will automatically resize it.\n - The automatic resizing may result in loss of quality (or may just fail), so it is recommended to resize the image yourself before placing it in the `UserData/Stickers/` folder.\n\n-# More information can be found on the [README](https://github.com/NotAKidoS/NAK_CVR_Mods/blob/main/Stickers/README.md).",
|
||||
"searchtags": [
|
||||
"stickers",
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r46/Stickers.dll",
|
||||
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r48/Stickers.dll",
|
||||
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/Stickers/",
|
||||
"changelog": "- Fixes for 2025r179\n- Fixed placing stickers when Cohtml text input fields were focused\n- Fixed scrolling cycling selected sticker slot despite not being in placement mode",
|
||||
"changelog": "- Rebuilt for CVR 2025r181\n- Reworked disabling system",
|
||||
"embedcolor": "#f61963"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue