Unity draws Zone.FloatingItems and nothing else; the Unity loot roll, collision pickup, tractor pull and GridObject are gone

ZoneRenderer draws one ItemPickup per FloatingItem (load, ObserveAdd, ObserveRemove, ClearZone); ItemPickup.Bind places it
from the sim body and spins it for show. EntityInstance's drop loops, ShieldManager's pickup branch (the whole
OnCollisionEnter, which did nothing else), ZoneRenderer.DropItem/DestroyLoot/_loot, TractorBeam's pull, and
GameSettings' three loot fields are deleted; WireFloatingItems stripped GridObject from the five pickup prefabs and
reassigned ZoneRenderer's four pickup fields in ARPG.unity; FloatingItemsDrawnSmoke (play session, batchmode) pins the
lowering. GridObject and TimedDestroy were deleted in fa911f2d, so fa911f2d and 2565e2c5 do not build in Unity.
Assets/Resources/Settings.asset keeps three stale serialized GameSettings fields Unity ignores (LFS object, not rewritten).

Builds: Unity batchmode compile green at this commit; dotnet green at 2565e2c5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-13 02:36:47 +02:00
commit c7c7e58508
16 changed files with 576 additions and 252 deletions

View file

@ -23,6 +23,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4094535758000554889}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
@ -30,7 +31,6 @@ Transform:
m_Children:
- {fileID: 9133920759869389018}
m_Father: {fileID: 8489385781787202308}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5284461483464579928
GameObject:
@ -44,7 +44,6 @@ GameObject:
- component: {fileID: 2667259809042191123}
- component: {fileID: 2093307059618178533}
- component: {fileID: 8815906420840494942}
- component: {fileID: 8842807112802394818}
- component: {fileID: 8689774408369415534}
- component: {fileID: 5705448000916375656}
- component: {fileID: -5496574226213385675}
@ -62,6 +61,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5284461483464579928}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.76403, y: 0, z: 0}
m_LocalScale: {x: 3, y: 3, z: 3}
@ -69,7 +69,6 @@ Transform:
m_Children:
- {fileID: 6463386671854692106}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &2667259809042191123
MeshFilter:
@ -96,6 +95,11 @@ MeshRenderer:
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -118,9 +122,11 @@ MeshRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &8815906420840494942
SphereCollider:
@ -130,29 +136,19 @@ SphereCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5284461483464579928}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
serializedVersion: 3
m_Radius: 0.91187096
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &8842807112802394818
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5284461483464579928}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 737f47c158214f0995ba2835f040ed96, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
GridAttraction: 10
Gravity: 1
Drag: 0.05
LaunchDrag: 0.2
--- !u!54 &8689774408369415534
Rigidbody:
m_ObjectHideFlags: 0
@ -160,10 +156,21 @@ Rigidbody:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5284461483464579928}
serializedVersion: 2
serializedVersion: 5
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_LinearDamping: 0
m_AngularDamping: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
@ -181,6 +188,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0c18f67d85af44c2b5afc8ecd15ce960, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
LabelFadeDuration: 0.5
LabelPersistDuration: 3
LabelDisplayAngle: 15
@ -204,6 +213,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 6463386671854692106}
m_Modifications:
- target: {fileID: 2945231343692618236, guid: e7877477dc889804ea9d04f7ffd08e9b,
@ -327,6 +337,9 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e7877477dc889804ea9d04f7ffd08e9b, type: 3}
--- !u!114 &3355762817961458026 stripped
MonoBehaviour:

View file

@ -23,6 +23,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3193517496555256095}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
@ -30,7 +31,6 @@ Transform:
m_Children:
- {fileID: 7638477100053754924}
m_Father: {fileID: 3419130779256825702}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7643266616531142933
GameObject:
@ -44,7 +44,6 @@ GameObject:
- component: {fileID: 3269639735116279291}
- component: {fileID: 7427774873968414741}
- component: {fileID: 674324171579366365}
- component: {fileID: 7449398549621940518}
- component: {fileID: 4507103896627202189}
- component: {fileID: 648083621841515580}
- component: {fileID: -5443764149998352794}
@ -62,6 +61,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7643266616531142933}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3, y: 3, z: 3}
@ -69,7 +69,6 @@ Transform:
m_Children:
- {fileID: 3601651121922051457}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3269639735116279291
MeshFilter:
@ -96,6 +95,11 @@ MeshRenderer:
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -118,9 +122,11 @@ MeshRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &674324171579366365
SphereCollider:
@ -130,29 +136,19 @@ SphereCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7643266616531142933}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
serializedVersion: 3
m_Radius: 0.8
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &7449398549621940518
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7643266616531142933}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 737f47c158214f0995ba2835f040ed96, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
GridAttraction: 10
Gravity: 1
Drag: 0.05
LaunchDrag: 0.2
--- !u!114 &4507103896627202189
MonoBehaviour:
m_ObjectHideFlags: 0
@ -165,6 +161,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0c18f67d85af44c2b5afc8ecd15ce960, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
LabelFadeDuration: 0.5
LabelPersistDuration: 3
LabelDisplayAngle: 15
@ -178,10 +176,21 @@ Rigidbody:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7643266616531142933}
serializedVersion: 2
serializedVersion: 5
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_LinearDamping: 0
m_AngularDamping: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
@ -204,6 +213,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 3601651121922051457}
m_Modifications:
- target: {fileID: 2945231343692618236, guid: e7877477dc889804ea9d04f7ffd08e9b,
@ -327,6 +337,9 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e7877477dc889804ea9d04f7ffd08e9b, type: 3}
--- !u!114 &4202270197902620060 stripped
MonoBehaviour:

View file

@ -23,6 +23,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6430764275721745537}
serializedVersion: 2
m_LocalRotation: {x: 0.7069834, y: -0, z: -0, w: 0.7072302}
m_LocalPosition: {x: 0, y: -0.9858858, z: 0.000344038}
m_LocalScale: {x: 1, y: 1, z: 1}
@ -30,7 +31,6 @@ Transform:
m_Children:
- {fileID: 5373456011921669618}
m_Father: {fileID: 7548484292876150345}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7167547457198401877
GameObject:
@ -44,7 +44,6 @@ GameObject:
- component: {fileID: 7390838957595368880}
- component: {fileID: 6960669510133879758}
- component: {fileID: 3507902894264904200}
- component: {fileID: 8747099621875196907}
- component: {fileID: 1545255963217739444}
- component: {fileID: -5409019571952974707}
- component: {fileID: -2501508196100734606}
@ -62,6 +61,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7167547457198401877}
serializedVersion: 2
m_LocalRotation: {x: -0.7069834, y: 0, z: 0, w: 0.7072302}
m_LocalPosition: {x: -0, y: 0, z: -2.9576573}
m_LocalScale: {x: 3, y: 3, z: 3}
@ -69,7 +69,6 @@ Transform:
m_Children:
- {fileID: 4002800527770282731}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -89.98, y: 0, z: 0}
--- !u!33 &7390838957595368880
MeshFilter:
@ -96,6 +95,11 @@ MeshRenderer:
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -118,9 +122,11 @@ MeshRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &3507902894264904200
SphereCollider:
@ -130,29 +136,19 @@ SphereCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7167547457198401877}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
serializedVersion: 3
m_Radius: 0.8303433
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &8747099621875196907
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7167547457198401877}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 737f47c158214f0995ba2835f040ed96, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
GridAttraction: 10
Gravity: 1
Drag: 0.05
LaunchDrag: 0.2
--- !u!114 &1545255963217739444
MonoBehaviour:
m_ObjectHideFlags: 0
@ -165,6 +161,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0c18f67d85af44c2b5afc8ecd15ce960, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
LabelFadeDuration: 0.5
LabelPersistDuration: 3
LabelDisplayAngle: 15
@ -178,10 +176,21 @@ Rigidbody:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7167547457198401877}
serializedVersion: 2
serializedVersion: 5
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_LinearDamping: 0
m_AngularDamping: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
@ -204,6 +213,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 4002800527770282731}
m_Modifications:
- target: {fileID: 2945231343692618236, guid: e7877477dc889804ea9d04f7ffd08e9b,
@ -327,6 +337,9 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e7877477dc889804ea9d04f7ffd08e9b, type: 3}
--- !u!114 &1928241908402748482 stripped
MonoBehaviour:

View file

@ -23,6 +23,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3932408193141279893}
serializedVersion: 2
m_LocalRotation: {x: 0.7069834, y: -0, z: -0, w: 0.7072302}
m_LocalPosition: {x: 0, y: 0.9264834, z: -0.0003232956}
m_LocalScale: {x: 1, y: 1, z: 1}
@ -30,7 +31,6 @@ Transform:
m_Children:
- {fileID: 7372978312502119311}
m_Father: {fileID: 5807113421007930924}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8555821447211356933
GameObject:
@ -44,7 +44,6 @@ GameObject:
- component: {fileID: 4899765339662518078}
- component: {fileID: 1691511938472729356}
- component: {fileID: 3657818610818556929}
- component: {fileID: 946329779588188460}
- component: {fileID: 7390748043139687254}
- component: {fileID: -4611973708976329780}
- component: {fileID: -8908388773057984787}
@ -62,6 +61,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8555821447211356933}
serializedVersion: 2
m_LocalRotation: {x: -0.7069834, y: 0, z: 0, w: 0.7072302}
m_LocalPosition: {x: -0, y: 0, z: 2.7794502}
m_LocalScale: {x: 3, y: 3, z: 3}
@ -69,7 +69,6 @@ Transform:
m_Children:
- {fileID: 2388751103296260666}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -89.98, y: 0, z: 0}
--- !u!33 &4899765339662518078
MeshFilter:
@ -96,6 +95,11 @@ MeshRenderer:
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -118,9 +122,11 @@ MeshRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &3657818610818556929
SphereCollider:
@ -130,29 +136,19 @@ SphereCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8555821447211356933}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
serializedVersion: 3
m_Radius: 0.75
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &946329779588188460
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8555821447211356933}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 737f47c158214f0995ba2835f040ed96, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
GridAttraction: 10
Gravity: 1
Drag: 0.05
LaunchDrag: 0.2
--- !u!114 &7390748043139687254
MonoBehaviour:
m_ObjectHideFlags: 0
@ -165,6 +161,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0c18f67d85af44c2b5afc8ecd15ce960, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
LabelFadeDuration: 0.5
LabelPersistDuration: 3
LabelDisplayAngle: 15
@ -178,10 +176,21 @@ Rigidbody:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8555821447211356933}
serializedVersion: 2
serializedVersion: 5
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_LinearDamping: 0
m_AngularDamping: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
@ -204,6 +213,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 2388751103296260666}
m_Modifications:
- target: {fileID: 2945231343692618236, guid: e7877477dc889804ea9d04f7ffd08e9b,
@ -327,6 +337,9 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e7877477dc889804ea9d04f7ffd08e9b, type: 3}
--- !u!114 &3891726626588969535 stripped
MonoBehaviour:

View file

@ -23,6 +23,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2238948151922859802}
serializedVersion: 2
m_LocalRotation: {x: 0.7069834, y: -0, z: -0, w: 0.7072302}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
@ -30,7 +31,6 @@ Transform:
m_Children:
- {fileID: 3300919539099916088}
m_Father: {fileID: 8414659055235772867}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7767746557817481743
GameObject:
@ -44,7 +44,6 @@ GameObject:
- component: {fileID: 2868629223358676395}
- component: {fileID: 6959931328227918623}
- component: {fileID: 4540815661693075899}
- component: {fileID: 4008709970769624704}
- component: {fileID: 7436534270673427838}
- component: {fileID: -6589342969031261525}
- component: {fileID: 5724758014884646323}
@ -62,6 +61,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7767746557817481743}
serializedVersion: 2
m_LocalRotation: {x: -0.7069834, y: 0, z: 0, w: 0.7072302}
m_LocalPosition: {x: -0, y: 0, z: 0}
m_LocalScale: {x: 3, y: 3, z: 3}
@ -69,7 +69,6 @@ Transform:
m_Children:
- {fileID: 7682789761269032435}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -89.98, y: 0, z: 0}
--- !u!33 &2868629223358676395
MeshFilter:
@ -96,6 +95,11 @@ MeshRenderer:
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -118,9 +122,11 @@ MeshRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &4540815661693075899
SphereCollider:
@ -130,29 +136,19 @@ SphereCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7767746557817481743}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 2
serializedVersion: 3
m_Radius: 0.60371214
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &4008709970769624704
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7767746557817481743}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 737f47c158214f0995ba2835f040ed96, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
GridAttraction: 10
Gravity: 1
Drag: 0.05
LaunchDrag: 0.2
--- !u!114 &7436534270673427838
MonoBehaviour:
m_ObjectHideFlags: 0
@ -165,6 +161,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0c18f67d85af44c2b5afc8ecd15ce960, type: 3}
m_Name:
m_EditorClassIdentifier:
RotationSpeed: 1
GridOffset: 0
LabelFadeDuration: 0.5
LabelPersistDuration: 3
LabelDisplayAngle: 15
@ -178,10 +176,21 @@ Rigidbody:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7767746557817481743}
serializedVersion: 2
serializedVersion: 5
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_LinearDamping: 0
m_AngularDamping: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
@ -204,6 +213,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 7682789761269032435}
m_Modifications:
- target: {fileID: 2945231343692618236, guid: e7877477dc889804ea9d04f7ffd08e9b,
@ -327,6 +337,9 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e7877477dc889804ea9d04f7ffd08e9b, type: 3}
--- !u!224 &3300919539099916088 stripped
RectTransform:

View file

@ -16404,13 +16404,13 @@ MonoBehaviour:
LODHandler: {fileID: 1009503736}
SlimeRenderer: {fileID: 1254851254}
SlimeGravityCamera: {fileID: 1066823975}
SimpleCommodityPickup: {fileID: 4008709970769624704, guid: 521bfeece7dd5fd4e8f166d38493f18c,
SimpleCommodityPickup: {fileID: 7436534270673427838, guid: 521bfeece7dd5fd4e8f166d38493f18c,
type: 3}
CompoundCommodityPickup: {fileID: 7449398549621940518, guid: 366909b6a01d7254d8eef01c333f8e00,
CompoundCommodityPickup: {fileID: 4507103896627202189, guid: 366909b6a01d7254d8eef01c333f8e00,
type: 3}
GearPickup: {fileID: 946329779588188460, guid: d2b7e9a9cd7733041b0553682e4b61af,
GearPickup: {fileID: 7390748043139687254, guid: d2b7e9a9cd7733041b0553682e4b61af,
type: 3}
WeaponPickup: {fileID: 8842807112802394818, guid: d2cec1d8c3d94074e9d2e6088e1c02d7,
WeaponPickup: {fileID: 5705448000916375656, guid: d2cec1d8c3d94074e9d2e6088e1c02d7,
type: 3}
MinePrefab: {fileID: 7283754118921506074, guid: b04728b2b65e057429eb6e8529299c8a,
type: 3}

View file

@ -0,0 +1,227 @@
using System;
using System.Collections;
using System.IO;
using System.Linq;
using GameCult.Caching;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using float2 = CultMath.float2;
// Batch proof that ZoneRenderer draws Zone.FloatingItems and nothing else, in a play session with no scene of its own:
// the pickup prefabs are the ones ARPG.unity's ZoneRenderer names (so the wiring is read here too), a zone is loaded
// into a fresh ZoneRenderer, and the zone's own Release, step, expiry and TryPickUp are what move and remove the
// pickups. Zone.Release adds exactly one ItemPickup, placed at the body's position; stepping the zone moves it with the
// body; expiry and TryPickUp each destroy it; an item already in the zone when the renderer loads it is drawn too.
//
// Unity -batchmode -nographics -projectPath <project> -executeMethod FloatingItemsDrawnSmoke.Run -logFile <log>
//
// Do not pass -quit: Run enters play mode (a domain reload), the check runs there, and the Editor exits itself, 0 on
// success and 1 on any failure. Destroy only takes effect in a play session, which is why this is not an edit-mode check.
[InitializeOnLoad]
public static class FloatingItemsDrawnSmoke
{
private const string Flag = "FloatingItemsDrawnSmoke.running";
private const string Wiring = "FloatingItemsDrawnSmoke.wiring";
private static IEnumerator _check;
private static int _frames;
private static string _work;
static FloatingItemsDrawnSmoke()
{
if (SessionState.GetBool(Flag, false)) EditorApplication.playModeStateChanged += OnPlayMode;
}
public static void Run()
{
try
{
SessionState.SetString(Wiring, ReadWiring());
SessionState.SetBool(Flag, true);
EditorApplication.EnterPlaymode();
}
catch (Exception exception)
{
Debug.LogException(exception);
EditorApplication.Exit(1);
}
}
private static void OnPlayMode(PlayModeStateChange change)
{
if (change != PlayModeStateChange.EnteredPlayMode) return;
_work = Path.Combine(Path.GetTempPath(), $"floating-items-smoke-{Guid.NewGuid():N}");
Directory.CreateDirectory(_work);
_check = Check();
EditorApplication.update += Step;
}
private static void Step()
{
try
{
if (++_frames > 3000) throw new InvalidOperationException("The check did not finish in 3000 frames.");
if (_check.MoveNext()) return;
Finish(0);
}
catch (Exception exception)
{
Debug.LogException(exception);
Finish(1);
}
}
private static void Finish(int code)
{
EditorApplication.update -= Step;
SessionState.SetBool(Flag, false);
try { if (Directory.Exists(_work)) Directory.Delete(_work, true); } catch (Exception) { /* a temp directory */ }
EditorApplication.Exit(code);
}
private static void Require(bool condition, string what)
{
if (!condition) throw new InvalidOperationException(what);
}
private static IEnumerator Check()
{
var settings = AssetDatabase.LoadAssetAtPath<GameSettings>("Assets/Resources/Settings.asset")?.GameplaySettings
?? throw new InvalidOperationException("No Settings.asset.");
// The wiring: the scene's ZoneRenderer names an ItemPickup prefab in each of the four fields, and none of those
// prefabs keeps a script that no longer exists.
var wired = SessionState.GetString(Wiring, "").Split('|').Select(entry => entry.Split('=')).Select(pair =>
(Field: pair[0], Pickup: pair[1] == "" ? null : AssetDatabase.LoadAssetAtPath<GameObject>(pair[1])?.GetComponent<ItemPickup>())).ToArray();
Require(wired.Length == 4, "The wiring was not carried into the play session.");
foreach (var (name, pickup) in wired)
{
Require(pickup != null, $"ZoneRenderer.{name} is not an ItemPickup in ARPG.unity.");
Require(pickup.ScanLabel != null && pickup.ScanLabelContainer != null, $"{name}'s prefab has no scan label.");
Require(!pickup.GetComponentsInChildren<Component>(true).Any(c => c == null), $"{name}'s prefab has a missing script.");
}
var shape = new Shape(5, 5);
foreach (var cell in shape.AllCoordinates) shape[cell] = true;
var cargoShape = new Shape(4, 4);
foreach (var cell in cargoShape.AllCoordinates) cargoShape[cell] = true;
var oneCell = new Shape(1, 1);
oneCell[new CultMath.int2(0, 0)] = true;
var cache = AetheriaStores.Open(Path.Combine(_work, "smoke.cc"), catalogWritable: true);
cache.Upsert(new VerseGrammar { Revision = 1 });
cache.Upsert(new HullData { Name = "Smoke Hub", HullType = HullType.Station, Shape = shape, Durability = 1000, Mass = 1000 });
cache.Upsert(new CargoBayData { Name = "Smoke Crate", Shape = new Shape(), InteriorShape = cargoShape, Durability = 4 });
cache.Upsert(new GearData
{
Name = "Smoke Spare", Hardpoint = HardpointType.Tool, Shape = oneCell, Durability = 1,
MinimumTemperature = -1000, MaximumTemperature = 1000, OptimalTemperature = 0, PlateauWidth = 2000
});
cache.Upsert(new SimpleCommodityData { Name = "Smoke Ore", Shape = oneCell, MaxStack = 100 });
cache.FlushAsync().Wait();
var ledger = new ProvenanceLedger();
for (var i = 1; i <= 8; i++) ledger.Lots[i] = new Lot { Origin = new Attributed(), Quality = 1 };
var items = new ItemManager(cache, ledger, settings, _ => { });
var zone = new Zone(items, new PlanetSettings(), new ZonePack(), null, null);
EquippableItem Make(string name, int lot) => new EquippableItem
{
Data = items.ItemData.RefOf<ItemData>(items.ItemData.GetByName<EquippableItemData>(name)), Durability = 1, Lot = lot
};
// A station with a crate takes the picked-up stack. It is not admitted: the zone holds no entity for the renderer to draw.
var hubRef = items.ItemData.RefOf<ItemData>(items.ItemData.GetByName<HullData>("Smoke Hub"));
var taker = new OrbitalEntity(items, zone, new EquippableItem { Data = hubRef, Durability = 1000, Lot = 1 }, default, new EntitySettings());
Require(taker.TryEquip(Make("Smoke Crate", 2), new CultMath.int2(1, 1)), "The smoke station took no crate.");
// An item already in the zone when the renderer loads it: drawn from the load, not only from the add.
var early = zone.Release(Make("Smoke Spare", 3), new float2(5, 6), float2.zero);
// The renderer's side. Inactive while it is configured, so it runs no Awake or Start of the scene's own.
var rootObject = new GameObject("Smoke Zone Root");
var rendererObject = new GameObject("Smoke Zone Renderer");
rendererObject.SetActive(false);
var renderer = rendererObject.AddComponent<ZoneRenderer>();
renderer.ZoneRoot = rootObject.transform;
foreach (var (name, pickup) in wired)
typeof(ZoneRenderer).GetField(name).SetValue(renderer, pickup);
renderer.ItemManager = items;
renderer.SectorBrushes = new GameObject("Smoke Brushes").transform;
renderer.SlimeGravityCamera = new GameObject("Smoke Gravity Camera").AddComponent<Camera>();
var slimeObject = new GameObject("Smoke Slime");
slimeObject.SetActive(false); // the real Slime needs its compute shader; LoadZone only sets its radius
renderer.SlimeRenderer = slimeObject.AddComponent<Slime>();
renderer.LoadZone(zone);
yield return null;
ItemPickup[] Pickups() => rootObject.GetComponentsInChildren<ItemPickup>(true).Where(p => p != null).ToArray();
void At(ItemPickup pickup, FloatingItem floating, string what)
{
var at = floating.Body.Position;
var want = new Vector3(at.x, zone.GetHeight(at), at.y);
Require(Vector3.Distance(pickup.transform.position, want) < 1e-3f,
$"{what}: the pickup is at {pickup.transform.position}, the body at {want}.");
}
Require(Pickups().Length == 1, $"load: {Pickups().Length} pickups for one existing floating item.");
At(Pickups()[0], early, "load");
// Release adds exactly one pickup, at the body's position, bound to its item.
var ore = new SimpleCommodity { Data = items.ItemData.RefOf<ItemData>(items.ItemData.GetByName<SimpleCommodityData>("Smoke Ore")), Quantity = 7 };
var released = zone.Release(ore, new float2(3, 4), new float2(10, 0));
yield return null;
Require(Pickups().Length == 2, $"release: {Pickups().Length} pickups for two floating items.");
var drawn = Pickups().Single(p => p.Item == ore);
At(drawn, released, "release");
// Stepping the zone moves the sim body; the pickup follows it on its next update, with nothing of its own.
var before = drawn.transform.position;
zone.Update(.5f);
yield return null;
Require(released.Body.Position.x > 3.5f, "the sim body did not drift.");
At(drawn, released, "step");
Require(drawn.transform.position != before, "the pickup did not move with the body.");
// Pickup destroys exactly the picked-up item's pickup.
Require(zone.TryPickUp(taker, released.Id), "the station refused a one-cell stack.");
yield return null;
yield return null;
Require(drawn == null, "pickup: the pickup is still there.");
Require(Pickups().Length == 1 && Pickups()[0].Item == early.Item, "pickup: the wrong pickup went.");
// Expiry destroys the pickup of an item nobody took.
zone.Update(settings.FloatingItemLifetime + 1f);
yield return null;
yield return null;
Require(zone.FloatingItems.Count == 0, "expiry: the item did not expire.");
Require(Pickups().Length == 0, $"expiry: {Pickups().Length} pickups left.");
// A later release is drawn again, and clearing the renderer takes what is left.
zone.Release(Make("Smoke Spare", 4), new float2(1, 1), float2.zero);
yield return null;
Require(Pickups().Length == 1, "re-release: not drawn.");
renderer.ClearZone();
yield return null;
yield return null;
Require(Pickups().Length == 0, "clear: pickups left after ClearZone.");
Debug.Log("FLOATING_ITEMS_SMOKE ok");
}
// What ARPG.unity's ZoneRenderer names in each pickup field, read from the saved scene before the play session (a
// scene cannot be opened inside one) and carried across the domain reload as the prefabs' asset paths.
private static string ReadWiring()
{
var scene = EditorSceneManager.OpenScene("Assets/Scenes/ARPG.unity", OpenSceneMode.Additive);
try
{
var found = UnityEngine.Object.FindObjectsByType<ZoneRenderer>(FindObjectsInactive.Include, FindObjectsSortMode.None)
.Where(r => r.gameObject.scene == scene).ToArray();
Require(found.Length == 1, $"ARPG.unity has {found.Length} ZoneRenderers.");
var wired = found[0];
return string.Join("|", new[]
{
("SimpleCommodityPickup", wired.SimpleCommodityPickup), ("CompoundCommodityPickup", wired.CompoundCommodityPickup),
("GearPickup", wired.GearPickup), ("WeaponPickup", wired.WeaponPickup)
}.Select(f => f.Item1 + "=" + (f.Item2 == null ? "" : AssetDatabase.GetAssetPath(f.Item2))));
}
finally { EditorSceneManager.CloseScene(scene, true); }
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 67544a932f794a2458741c731ef04d11

View file

@ -0,0 +1,75 @@
using System;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
// Detaches the deleted GridObject from the pickup prefabs and points ZoneRenderer's four pickup fields in ARPG.unity at
// each prefab's ItemPickup, then saves the prefabs and the scene. Idempotent: a prefab with no missing script is left as
// it is, and the fields are set to the same values again.
//
// Unity -batchmode -projectPath <project> -executeMethod WireFloatingItems.Run -logFile <log>
//
// Do not pass -quit: Run exits the Editor itself, 0 on success and 1 on any failure. The menu item runs the same wiring.
public static class WireFloatingItems
{
private const string ScenePath = "Assets/Scenes/ARPG.unity";
private const string PickupFolder = "Assets/Prefabs/RPG/Pickups/";
// The field each prefab filled before this cut (read from ARPG.unity at the cut's base). Icosahedron fills none.
private static readonly (string Field, string Prefab)[] Fields =
{
("SimpleCommodityPickup", "Tetrahedron"),
("CompoundCommodityPickup", "Hexahedron"),
("GearPickup", "Octahedron"),
("WeaponPickup", "Dodecahedron"),
};
private static readonly string[] Prefabs = { "Tetrahedron", "Hexahedron", "Octahedron", "Dodecahedron", "Icosahedron" };
[MenuItem("Aetheria/Wire Floating Items")]
public static void Menu() => Wire();
public static void Run()
{
try
{
Wire();
EditorApplication.Exit(0);
}
catch (Exception exception)
{
Debug.LogException(exception);
EditorApplication.Exit(1);
}
}
private static void Wire()
{
foreach (var name in Prefabs)
{
var path = PickupFolder + name + ".prefab";
var contents = PrefabUtility.LoadPrefabContents(path);
try
{
var removed = GameObjectUtility.RemoveMonoBehavioursWithMissingScript(contents);
if (contents.GetComponent<ItemPickup>() == null) throw new InvalidOperationException($"{path} has no ItemPickup.");
if (removed > 0) PrefabUtility.SaveAsPrefabAsset(contents, path);
Debug.Log($"WIRE_FLOATING_ITEMS {name} removed={removed}");
}
finally { PrefabUtility.UnloadPrefabContents(contents); }
}
var scene = EditorSceneManager.OpenScene(ScenePath, OpenSceneMode.Single);
var renderer = UnityEngine.Object.FindFirstObjectByType<ZoneRenderer>();
if (renderer == null) throw new InvalidOperationException("ARPG.unity has no ZoneRenderer.");
var serialized = new SerializedObject(renderer);
foreach (var (field, prefab) in Fields)
{
var pickup = AssetDatabase.LoadAssetAtPath<GameObject>(PickupFolder + prefab + ".prefab").GetComponent<ItemPickup>();
var property = serialized.FindProperty(field) ?? throw new InvalidOperationException($"ZoneRenderer has no {field}.");
property.objectReferenceValue = pickup;
}
serialized.ApplyModifiedProperties();
EditorSceneManager.MarkSceneDirty(scene);
if (!EditorSceneManager.SaveScene(scene)) throw new InvalidOperationException("The scene did not save.");
Debug.Log("WIRE_FLOATING_ITEMS ok");
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9a56d7dc8471d224f9bed434b39f7c87

View file

@ -301,27 +301,6 @@ public class EntityInstance : MonoBehaviour
{
if (!this) return;
_destroyed = true;
foreach (var gear in Entity.Equipment)
{
if (gear != Entity.EquippedHull && Random.value < ZoneRenderer.Settings.LootDropProbability)
{
ZoneRenderer.DropItem(
Entity.Position.ToUnity(),
Random.onUnitSphere * ZoneRenderer.Settings.LootDropVelocity,
gear.EquippableItem);
}
}
foreach (var cargo in Entity.CargoBays)
{
foreach (var item in cargo.Cargo.Keys)
{
ZoneRenderer.DropItem(
Entity.Position.ToUnity(),
Random.onUnitSphere * ZoneRenderer.Settings.LootDropVelocity,
item);
}
}
if (DestroyEffect != null)
{
var t = Instantiate(DestroyEffect).transform;

View file

@ -11,9 +11,6 @@ using UnityEngine;
public class GameSettings : ScriptableObject
{
public string StartingHullName = "Longinus";
public float PickupLifetime = 30;
public float LootDropProbability = .25f;
public float LootDropVelocity = 25;
public float HeatstrokePhasingFloor = 0;
public float HeatstrokePhasingFrequency = 5;
public float WormholeDistanceRatio;

View file

@ -4,9 +4,15 @@ using CultMath;
using CultMath.UnityBridge;
using UnityEngine;
using static CultMath.math;
using Random = UnityEngine.Random;
// How one floating item looks. Zone owns the item's every fact (existence, position, expiry, pickup); once bound,
// this reads the latest sim body and draws, spun for show, and writes nothing back (rulings unity-presents-only-r3
// and sim-speed-presentation). An unbound pickup (FieldTester's test scene) leaves its transform alone.
public class ItemPickup : MonoBehaviour
{
public float RotationSpeed = 1f;
public float GridOffset;
public float LabelFadeDuration = .5f;
public float LabelPersistDuration = 3;
public float LabelDisplayAngle = 15;
@ -15,14 +21,38 @@ public class ItemPickup : MonoBehaviour
public TextMeshPro ScanLabel;
public ItemInstance Item { get; set; }
public ZoneRenderer ZoneRenderer { get; set; }
public float3 ViewOrigin { get; set; }
public float3 ViewDirection { get; set; }
private float _displayTime;
private float _timeOffset;
private Zone _zone;
private FloatingItem _floating;
public void Bind(Zone zone, FloatingItem floating)
{
_zone = zone;
_floating = floating;
Item = floating.Item;
_timeOffset = Random.value * 100;
Place();
}
private void Place()
{
var p = _floating.Body.Position;
transform.position = new Vector3(p.x, _zone.GetHeight(p) + GridOffset, p.y);
}
private void Update()
{
if (_floating != null)
{
Place();
transform.localRotation = Quaternion.Euler(
sin(Time.time - _timeOffset * RotationSpeed) * 90, 0, cos(Time.time - _timeOffset * RotationSpeed) * 90);
}
var diff = transform.position.ToCultMath() - ViewOrigin;
var toThis = normalize(diff);
var viewAngle = acos(dot(toThis, ViewDirection)) * Mathf.Rad2Deg;
@ -34,9 +64,4 @@ public class ItemPickup : MonoBehaviour
ScanLabel.color = c;
ScanLabelContainer.rotation = Quaternion.LookRotation((-toThis).ToUnity());
}
private void OnDestroy()
{
ZoneRenderer?.DestroyLoot(this);
}
}
}

View file

@ -52,40 +52,6 @@ public class ShieldManager : MonoBehaviour, IAbsorbPresenter
Debug.LogWarning("ShieldManager has no ShieldEnvelope; falling back to its own transform for the hit direction.", this);
}
private void OnCollisionEnter(Collision other)
{
var otherShield = other.collider.GetComponent<ShieldManager>();
if (!otherShield)
{
var gridObject = other.collider.GetComponent<GridObject>();
if (gridObject)
{
var itemPickup = other.collider.GetComponent<ItemPickup>();
if (itemPickup)
{
if (Entity.CargoBays.Any(c => c.TryStore(itemPickup.Item)))
{
// TODO: Pickup notification!
Destroy(itemPickup.gameObject);
}
else
{
// TODO: Pickup failed notification!
var cp = other.GetContact(0);
gridObject.Velocity += cp.normal * 25;
Debug.Log("Attempted item pickup, but no space in cargo bay!");
}
}
else
{
Debug.Log("Shield collision occurred with grid object, but other collider isn't an item pickup!");
}
}
else
Debug.Log("Shield collision occurred, but other collider isn't a shield or a grid object!");
}
}
// A shot the shield took ripples it where the shot landed, drawn on the hull as it is drawn. The hull layer is
// ImpactPresenter's.
public void Absorb(AbsorbEvent e)

View file

@ -14,20 +14,9 @@ public class TractorBeam : MonoBehaviour
public void Update()
{
transform.rotation = Quaternion.LookRotation(Direction);
// The beam draws nothing until it presents a sim grab (loot-3): no particles, and no pull; the simulation
// decides every floating item's motion.
var emission = ParticleSystem.emission;
if (Power > .01f)
{
var objectFound = false;
foreach (var o in Physics.SphereCastAll(transform.position, Radius, Direction, Distance, 1 << 21))
{
var gridObject = o.collider.GetComponent<GridObject>();
if (gridObject == null) continue;
objectFound = true;
gridObject.Velocity += Vector3.Normalize(transform.position - gridObject.transform.position) * (Traction * Time.deltaTime);
}
emission.rateOverTimeMultiplier = objectFound ? Power : 0;
}
else emission.rateOverTimeMultiplier = 0;
emission.rateOverTimeMultiplier = 0;
}
}

View file

@ -40,10 +40,10 @@ public class ZoneRenderer : MonoBehaviour
public LODHandler LODHandler;
public Slime SlimeRenderer;
public Camera SlimeGravityCamera;
public GridObject SimpleCommodityPickup;
public GridObject CompoundCommodityPickup;
public GridObject GearPickup;
public GridObject WeaponPickup;
public ItemPickup SimpleCommodityPickup;
public ItemPickup CompoundCommodityPickup;
public ItemPickup GearPickup;
public ItemPickup WeaponPickup;
public MineInstance MinePrefab;
public VapourCloudInstance CloudPrefab;
public Material[] MapGravityMaterials;
@ -94,7 +94,7 @@ public class ZoneRenderer : MonoBehaviour
private bool _showAsteroidUI;
public Dictionary<Wormhole, (GameObject gravity, CompassIcon icon)> WormholeInstances = new Dictionary<Wormhole, (GameObject, CompassIcon)>();
private List<ItemPickup> _loot = new List<ItemPickup>();
private Dictionary<FloatingItem, ItemPickup> _floatingItems = new Dictionary<FloatingItem, ItemPickup>();
private Dictionary<Mine, MineInstance> _mines = new Dictionary<Mine, MineInstance>();
private Dictionary<VapourCloud, VapourCloudInstance> _clouds = new Dictionary<VapourCloud, VapourCloudInstance>();
@ -236,6 +236,15 @@ public class ZoneRenderer : MonoBehaviour
instance.Blast();
}));
// Every floating item, whoever released it (a death drop, jettisoned cargo), is drawn through this one
// subscription. An item leaves Zone.FloatingItems by expiry or by pickup, and either way its pickup is gone.
foreach (var floating in zone.FloatingItems) LoadFloatingItem(zone, floating);
_zoneSubscriptions.Add(zone.FloatingItems.ObserveAdd().Subscribe(e => LoadFloatingItem(zone, e.Value)));
_zoneSubscriptions.Add(zone.FloatingItems.ObserveRemove().Subscribe(e =>
{
if (_floatingItems.Remove(e.Value, out var pickup) && pickup) Destroy(pickup.gameObject);
}));
// Every vapour cloud, whoever vented it, is drawn through this one subscription. A cloud leaves Zone.Clouds
// when its opacity has reached nothing, so a removal destroys its fog bank with nothing left to show.
foreach (var cloud in zone.Clouds) LoadCloud(zone, cloud);
@ -274,6 +283,29 @@ public class ZoneRenderer : MonoBehaviour
_mines.Add(mine, instance);
}
private void LoadFloatingItem(Zone zone, FloatingItem floating)
{
var prefab = floating.Item switch
{
SimpleCommodity _ => SimpleCommodityPickup,
CompoundCommodity _ => CompoundCommodityPickup,
EquippableItem equippableItem when ItemManager.GetData(equippableItem) is WeaponItemData => WeaponPickup,
EquippableItem _ => GearPickup,
_ => throw new NotImplementedException()
};
var pickup = Instantiate(prefab, ZoneRoot);
pickup.Bind(zone, floating);
pickup.ScanLabel.text = ItemManager.Title(floating.Item);
if (floating.Item is CraftedItemInstance craftedItemInstance)
{
var c = ItemManager.GetTier(craftedItemInstance).tier.Color.ToColor();
c.a = 0;
pickup.ScanLabel.color = c;
}
else pickup.ScanLabel.color = new Color(.75f, .75f, .75f, 0);
_floatingItems.Add(floating, pickup);
}
private void LoadCloud(Zone zone, VapourCloud cloud)
{
var instance = Instantiate(CloudPrefab);
@ -312,9 +344,9 @@ public class ZoneRenderer : MonoBehaviour
if (instance) Destroy(instance.gameObject);
_clouds.Clear();
foreach(var gridObject in _loot)
if(gridObject) Destroy(gridObject.gameObject);
_loot.Clear();
foreach (var pickup in _floatingItems.Values)
if (pickup) Destroy(pickup.gameObject);
_floatingItems.Clear();
foreach (var entity in Zone.Entities)
{
@ -487,7 +519,7 @@ public class ZoneRenderer : MonoBehaviour
void Update()
{
var maxDepth = 0f;
foreach (var loot in _loot)
foreach (var loot in _floatingItems.Values)
{
loot.ViewOrigin = PerspectiveEntity.Position;
loot.ViewDirection = PerspectiveEntity.Aim;
@ -603,41 +635,6 @@ public class ZoneRenderer : MonoBehaviour
// MinimapGravityQuad.transform.position = gravPos;
// MinimapTintQuad.transform.position = gravPos - Vector3.up*10;
}
public void DestroyLoot(ItemPickup loot)
{
_loot.Remove(loot);
}
public void DropItem(Vector3 position, Vector3 velocity, ItemInstance item)
{
var gridObject = item switch
{
SimpleCommodity _ => Instantiate(SimpleCommodityPickup),
CompoundCommodity _ => Instantiate(CompoundCommodityPickup),
EquippableItem equippableItem when ItemManager.GetData(equippableItem) is WeaponItemData => Instantiate(WeaponPickup),
EquippableItem _ => Instantiate(GearPickup),
_ => throw new NotImplementedException()
};
var t = gridObject.transform;
t.parent = ZoneRoot;
gridObject.Zone = Zone;
t.position = position;
gridObject.Velocity = velocity;
var itemPickup = gridObject.gameObject.GetComponent<ItemPickup>();
itemPickup.Item = item;
itemPickup.ZoneRenderer = this;
itemPickup.ScanLabel.text = ItemManager.Title(item);
if (item is CraftedItemInstance craftedItemInstance)
{
var c = ItemManager.GetTier(craftedItemInstance).tier.Color.ToColor();
c.a = 0;
itemPickup.ScanLabel.color = c;
}
else itemPickup.ScanLabel.color = new Color(.75f, .75f, .75f, 0);
gridObject.gameObject.AddComponent<TimedDestroy>().Duration = Settings.PickupLifetime;
_loot.Add(itemPickup);
}
}