mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-20 15:41:01 +00:00
reformat
This commit is contained in:
parent
583fcec7bb
commit
cf3ac1abb9
@ -1,10 +1,8 @@
|
||||
using QSB.ItemSync.WorldObjects;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.Messaging;
|
||||
using QSB.Player;
|
||||
using QSB.SectorSync.WorldObjects;
|
||||
using QSB.WorldSync;
|
||||
using QSB.WorldSync.WorldObjects;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.ItemSync.Messages;
|
||||
@ -44,18 +42,18 @@ internal class DropItemMessage : QSBWorldObjectMessage<IQSBItem, (Vector3 localP
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
var customDropTarget = (Data.dropTargetId == -1)
|
||||
var customDropTarget = Data.dropTargetId == -1
|
||||
? null
|
||||
: QSBWorldSync.GetWorldObject<MonoBehaviourWorldObject>(Data.dropTargetId).AttachedObject as IItemDropTarget;
|
||||
: Data.dropTargetId.GetWorldObject<MonoBehaviourWorldObject>().AttachedObject as IItemDropTarget;
|
||||
|
||||
var parent = (Data.dropTargetId == -1)
|
||||
? QSBWorldSync.GetWorldObject<QSBOWRigidbody>(Data.rigidBodyId).AttachedObject.transform
|
||||
var parent = Data.dropTargetId == -1
|
||||
? Data.rigidBodyId.GetWorldObject<QSBOWRigidbody>().AttachedObject.transform
|
||||
: customDropTarget.GetItemDropTargetTransform(null);
|
||||
|
||||
var worldPos = parent.TransformPoint(Data.localPosition);
|
||||
var worldNormal = parent.TransformDirection(Data.localNormal);
|
||||
|
||||
var sector = QSBWorldSync.GetWorldObject<QSBSector>(Data.sectorId).AttachedObject;
|
||||
var sector = Data.sectorId.GetWorldObject<QSBSector>().AttachedObject;
|
||||
|
||||
WorldObject.DropItem(worldPos, worldNormal, parent, sector, customDropTarget);
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using QSB.ItemSync.Messages;
|
||||
using QSB.ItemSync.WorldObjects.Items;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
@ -58,8 +56,8 @@ internal class ItemToolPatches : QSBPatch
|
||||
public static bool DropItem(ItemTool __instance, RaycastHit hit, OWRigidbody targetRigidbody, IItemDropTarget customDropTarget)
|
||||
{
|
||||
Locator.GetPlayerAudioController().PlayDropItem(__instance._heldItem.GetItemType());
|
||||
GameObject gameObject = hit.collider.gameObject;
|
||||
ISectorGroup component = gameObject.GetComponent<ISectorGroup>();
|
||||
var gameObject = hit.collider.gameObject;
|
||||
var component = gameObject.GetComponent<ISectorGroup>();
|
||||
Sector sector = null;
|
||||
|
||||
while (component == null && gameObject.transform.parent != null)
|
||||
@ -71,9 +69,9 @@ internal class ItemToolPatches : QSBPatch
|
||||
if (component != null)
|
||||
{
|
||||
sector = component.GetSector();
|
||||
if (sector == null && component is SectorCullGroup)
|
||||
if (sector == null && component is SectorCullGroup sectorCullGroup)
|
||||
{
|
||||
SectorProxy controllingProxy = (component as SectorCullGroup).GetControllingProxy();
|
||||
var controllingProxy = sectorCullGroup.GetControllingProxy();
|
||||
if (controllingProxy != null)
|
||||
{
|
||||
sector = controllingProxy.GetSector();
|
||||
@ -81,15 +79,13 @@ internal class ItemToolPatches : QSBPatch
|
||||
}
|
||||
}
|
||||
|
||||
Transform parent = (customDropTarget == null)
|
||||
var parent = customDropTarget == null
|
||||
? targetRigidbody.transform
|
||||
: customDropTarget.GetItemDropTargetTransform(hit.collider.gameObject);
|
||||
var qsbItem = __instance._heldItem.GetWorldObject<IQSBItem>();
|
||||
__instance._heldItem.DropItem(hit.point, hit.normal, parent, sector, customDropTarget);
|
||||
if (customDropTarget != null)
|
||||
{
|
||||
customDropTarget.AddDroppedItem(hit.collider.gameObject, __instance._heldItem);
|
||||
}
|
||||
customDropTarget?.AddDroppedItem(hit.collider.gameObject, __instance._heldItem);
|
||||
|
||||
__instance._heldItem = null;
|
||||
QSBPlayerManager.LocalPlayer.HeldItem = null;
|
||||
|
||||
|
@ -1,11 +1,5 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using QSB.WorldSync.WorldObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QSB.WorldSync;
|
||||
|
||||
|
@ -1,16 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.WorldSync;
|
||||
|
||||
internal class MonoBehaviourWorldObject : WorldObject<MonoBehaviour>
|
||||
{
|
||||
public override void SendInitialState(uint to)
|
||||
{
|
||||
|
||||
}
|
||||
public override void SendInitialState(uint to) { }
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace QSB.WorldSync.WorldObjects;
|
||||
namespace QSB.WorldSync;
|
||||
|
||||
internal class QSBOWRigidbody : WorldObject<OWRigidbody>
|
||||
{
|
Loading…
x
Reference in New Issue
Block a user