mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
DropItemMessage: sector can be null
This commit is contained in:
parent
f92f779c86
commit
75249523a4
@ -35,7 +35,7 @@ internal class DropItemMessage : QSBWorldObjectMessage<IQSBItem,
|
||||
tuple.dropTargetId = ((MonoBehaviour)customDropTarget).GetWorldObject<IQSBDropTarget>().ObjectId;
|
||||
}
|
||||
|
||||
tuple.sectorId = sector.GetWorldObject<QSBSector>().ObjectId;
|
||||
tuple.sectorId = sector ? sector.GetWorldObject<QSBSector>().ObjectId : -1;
|
||||
tuple.localPosition = parent.InverseTransformPoint(worldPosition);
|
||||
tuple.localNormal = parent.InverseTransformDirection(worldNormal);
|
||||
|
||||
@ -55,7 +55,7 @@ internal class DropItemMessage : QSBWorldObjectMessage<IQSBItem,
|
||||
var worldPos = parent.TransformPoint(Data.localPosition);
|
||||
var worldNormal = parent.TransformDirection(Data.localNormal);
|
||||
|
||||
var sector = Data.sectorId.GetWorldObject<QSBSector>().AttachedObject;
|
||||
var sector = Data.sectorId != -1 ? Data.sectorId.GetWorldObject<QSBSector>().AttachedObject : null;
|
||||
|
||||
WorldObject.DropItem(worldPos, worldNormal, parent, sector, customDropTarget);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user