This commit is contained in:
Lachlan Leone
2024-10-09 16:41:33 +11:00
parent 9f4ef51d41
commit 4259b35697
10 changed files with 177 additions and 4 deletions
+36
View File
@@ -0,0 +1,36 @@
using Kitchen;
using KitchenLib.References;
using KitchenMods;
namespace MMOKitchen.Systems
{
public class GlobalCosmeticEditors : InteractionSystem, IModSystem
{
protected override bool AllowActOrGrab => true;
protected override bool ShouldAct(ref InteractionData data)
{
if (!Require(data.Target, out Editor))
{
return false;
}
bool flag = data.Attempt.Type == InteractionType.Grab;
bool flag2 = base.ShouldAct(ref data);
return Editor.UseGrab == flag && flag2;
}
protected override bool IsPossible(ref InteractionData data)
{
return Require(data.Target, out Editor) && Require(data.Target, out CAppliance cAppliance) && cAppliance.ID == ApplianceReferences.BedroomOutfitSelector;
}
protected override void Perform(ref InteractionData data)
{
Editor.IsTriggered = true;
Editor.TriggerEntity = data.Interactor;
SetComponent(data.Target, Editor);
}
private CTriggerPlayerSpecificUI Editor;
}
}
+39
View File
@@ -0,0 +1,39 @@
using Kitchen;
using KitchenMods;
using Unity.Entities;
using UnityEngine;
namespace MMOKitchen.Systems
{
public class GlobalProfileEditors : InteractionSystem, IModSystem
{
protected override bool IsPossible(ref InteractionData data)
{
return Has<CPlayer>(data.Interactor) && Has<ManageProfileEditors.COpensProfileEditor>(data.Target) && Has<CPosition>(data.Target) && Require(data.Target, out COwnedByPlayer cOwnedByPlayer) && cOwnedByPlayer.Player != data.Interactor;
}
protected override void Perform(ref InteractionData data)
{
if (!Require(data.Target, out CPosition cPosition)) return;
if (!Require(data.Interactor, out CPlayer cPlayer)) return;
Entity entity = EntityManager.CreateEntity();
EntityManager.AddComponentData(entity, new CPosition(cPosition + new Vector3(-2f, 1f, 0f)));
EntityManager.AddComponentData(entity, new CRequiresView
{
Type = ViewType.ProfileEditor,
ViewMode = ViewMode.WorldToScreen
});
EntityManager.AddComponentData(entity, new ManageProfileEditors.CProfileEditor
{
Trigger = data.Target,
PlayerID = cPlayer.ID,
Player = data.Interactor
});
EntityManager.AddComponentData(data.Target, new ManageProfileEditors.CHasProfileEditor
{
Editor = entity
});
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using Kitchen;
using KitchenMods;
using Unity.Entities;
namespace MMOKitchen.Systems
{
public class PatchHelpers : GameSystemBase, IModSystem
{
public static PatchHelpers instance;
public T _GetComponent<T>(Entity entity) where T : struct, IComponentData
{
return GetComponent<T>(entity);
}
public void _SetComponentData<T>(Entity entity, T componentData) where T : struct, IComponentData
{
EntityManager.SetComponentData<T>(entity, componentData);
}
protected override void Initialise()
{
instance = this;
}
protected override void OnUpdate()
{
}
}
}
+1 -2
View File
@@ -1,9 +1,8 @@
using Kitchen;
using KitchenMods;
namespace MMOKitchen.Systems
{
public class ProfileEditorOverride : InteractionSystem, IModSystem
public class ProfileEditorOverride : InteractionSystem
{
protected override bool IsPossible(ref InteractionData data)
{