diff --git a/Source/Animations/UserSettings/Layouts/default-2022.dwlt b/Source/Animations/UserSettings/Layouts/default-2022.dwlt index c39cdb2c..31efd903 100644 --- a/Source/Animations/UserSettings/Layouts/default-2022.dwlt +++ b/Source/Animations/UserSettings/Layouts/default-2022.dwlt @@ -48,7 +48,7 @@ MonoBehaviour: m_MinSize: {x: 300, y: 100} m_MaxSize: {x: 24288, y: 16192} vertical: 0 - controlID: 93 + controlID: 17 --- !u!114 &3 MonoBehaviour: m_ObjectHideFlags: 52 @@ -128,7 +128,7 @@ MonoBehaviour: - {fileID: 14} - {fileID: 13} m_Selected: 2 - m_LastSelected: 0 + m_LastSelected: 1 --- !u!114 &6 MonoBehaviour: m_ObjectHideFlags: 52 @@ -224,7 +224,7 @@ MonoBehaviour: m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 16192} vertical: 1 - controlID: 184 + controlID: 18 --- !u!114 &10 MonoBehaviour: m_ObjectHideFlags: 52 @@ -249,7 +249,7 @@ MonoBehaviour: m_MinSize: {x: 200, y: 50} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 49 + controlID: 19 --- !u!114 &11 MonoBehaviour: m_ObjectHideFlags: 52 @@ -469,7 +469,7 @@ MonoBehaviour: m_OverlaysVisible: 1 m_LockTracker: m_IsLocked: 0 - m_LastSelectedObjectID: 20046 + m_LastSelectedObjectID: 20044 --- !u!114 &14 MonoBehaviour: m_ObjectHideFlags: 52 @@ -530,9 +530,9 @@ MonoBehaviour: m_IsLocked: 0 m_FolderTreeState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: 60580000 - m_LastClickedID: 22624 - m_ExpandedIDs: 0000000006500000 + m_SelectedIDs: 4a5a0000 + m_LastClickedID: 23114 + m_ExpandedIDs: 0000000004500000365a000000ca9a3bffffff7f m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -560,7 +560,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 0000000006500000 + m_ExpandedIDs: 0000000004500000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -585,9 +585,9 @@ MonoBehaviour: m_Icon: {fileID: 0} m_ResourceFile: m_ListAreaState: - m_SelectedInstanceIDs: - m_LastClickedInstanceID: 0 - m_HadKeyboardFocusLastEvent: 1 + m_SelectedInstanceIDs: 784e0000 + m_LastClickedInstanceID: 20088 + m_HadKeyboardFocusLastEvent: 0 m_ExpandedInstanceIDs: c6230000 m_RenameOverlay: m_UserAcceptedRename: 0 @@ -700,9 +700,9 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: 4e4e0000 - m_LastClickedID: 20046 - m_ExpandedIDs: 24fbffff + m_SelectedIDs: 4c4e0000 + m_LastClickedID: 20044 + m_ExpandedIDs: 30fbffff044c0000c04c0000844d00004c4e0000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -1043,9 +1043,9 @@ MonoBehaviour: m_PlayAudio: 0 m_AudioPlay: 0 m_Position: - m_Target: {x: 1.0091436, y: -0.012789965, z: 0.16064566} + m_Target: {x: 0.68495107, y: -0.14878297, z: 0.14938828} speed: 2 - m_Value: {x: 1.0091436, y: -0.012789965, z: 0.16064566} + m_Value: {x: 0.68495107, y: -0.14878297, z: 0.14938828} m_RenderMode: 0 m_CameraMode: drawMode: 0 @@ -1095,9 +1095,9 @@ MonoBehaviour: speed: 2 m_Value: {x: -0.7071068, y: 0, z: -0, w: -0.7071068} m_Size: - m_Target: 1.3983847 + m_Target: 1.0008484 speed: 2 - m_Value: 1.3983847 + m_Value: 1.0008484 m_Ortho: m_Target: 1 speed: 2 @@ -1189,7 +1189,7 @@ MonoBehaviour: m_HSlider: 0 m_VSlider: 0 m_IgnoreScrollWheelUntilClicked: 0 - m_EnableMouseInput: 0 + m_EnableMouseInput: 1 m_EnableSliderZoomHorizontal: 0 m_EnableSliderZoomVertical: 0 m_UniformScale: 1 diff --git a/Source/ThingGenerator/AnimDef.cs b/Source/ThingGenerator/AnimDef.cs index 29e574c9..b3e28013 100644 --- a/Source/ThingGenerator/AnimDef.cs +++ b/Source/ThingGenerator/AnimDef.cs @@ -367,11 +367,8 @@ where chance > 0 // Chance to promote at all: // Needs to be thought out... A future task. float promotionChanceForAny = Mathf.Min(possibleCount * 0.5f, 0.65f); - if (!Rand.Chance(promotionChanceForAny)) - { - Core.Log($"Did not promote from {input.OriginalAnim} ({input.Outcome}), {promotionChanceForAny:P1} chance failed."); - return null; - } + if (!Rand.Chance(promotionChanceForAny)) + return null; var selected = allPossibles.RandomElementByWeightWithFallback(pair => pair.chance); diff --git a/Source/ThingGenerator/AnimationManager.cs b/Source/ThingGenerator/AnimationManager.cs index 2d4b231f..7739a25a 100644 --- a/Source/ThingGenerator/AnimationManager.cs +++ b/Source/ThingGenerator/AnimationManager.cs @@ -128,7 +128,8 @@ public void AddDroppedHeadFor(Pawn pawn, AnimRenderer animRenderer) Direction = bodySS.GetWorldDirection(), Position = headSS.GetWorldPosition(), Rotation = headSS.GetWorldRotation(), - TimeToLive = 120 + TimeToLive = 120, + Map = pawn.Map ?? pawn.Corpse?.Map }; heads.Add(instance); @@ -140,20 +141,21 @@ private void RenderHeads() { for (int i = 0; i < heads.Count; i++) { + var head = heads[i]; bool stayAlive; try { - stayAlive = heads[i].Render(); + stayAlive = head.Render(); } catch (Exception e) { - Core.Error($"Exception rendering dropped head of {heads[i].Pawn}. Head will be deleted.", e); + Core.Error($"Exception rendering dropped head of {head.Pawn}. Head will be deleted.", e); stayAlive = false; } if (!stayAlive) { - PawnToHeadInstance.Remove(heads[i].Pawn); + PawnToHeadInstance.Remove(head.Pawn); // Remove at swap back, for speed reasons: heads[i] = heads[^1]; heads.RemoveAt(heads.Count - 1); @@ -203,7 +205,6 @@ private static void DoEvent(AnimRenderer r, EventBase ev) try { EventHelper.Handle(ev, r); - Core.Log($"Did event {ev} for {r}"); } catch (Exception e) { diff --git a/Source/ThingGenerator/Heads/HeadInstance.cs b/Source/ThingGenerator/Heads/HeadInstance.cs index 5442da70..9bf2415b 100644 --- a/Source/ThingGenerator/Heads/HeadInstance.cs +++ b/Source/ThingGenerator/Heads/HeadInstance.cs @@ -11,6 +11,7 @@ namespace AM.Heads; public sealed class HeadInstance { public Pawn Pawn { get; set; } + public Map Map { get; set; } public Vector3 Position { get; set; } public float Rotation { get; set; } public float TimeToLive { get; set; } @@ -27,6 +28,10 @@ public bool Render() if (TimeToLive <= 0f) return false; + // Do not actually render if the map is not currently visible. + if (Map != Find.CurrentMap) + return true; + //Render pawn in custom position using patches. Patch_PawnRenderer_RenderPawnInternal.NextDrawMode = Patch_PawnRenderer_RenderPawnInternal.DrawMode.HeadStandalone; Patch_PawnRenderer_RenderPawnInternal.HeadRotation = Direction; diff --git a/Source/ThingGenerator/Patches/Patch_GlobalTextureAtlasManager_TryGetPawnFrameSet.cs b/Source/ThingGenerator/Patches/Patch_GlobalTextureAtlasManager_TryGetPawnFrameSet.cs index 8a19f2c4..8d0a2b97 100644 --- a/Source/ThingGenerator/Patches/Patch_GlobalTextureAtlasManager_TryGetPawnFrameSet.cs +++ b/Source/ThingGenerator/Patches/Patch_GlobalTextureAtlasManager_TryGetPawnFrameSet.cs @@ -19,7 +19,7 @@ public static bool Prefix(Pawn pawn, ref bool createdNew, ref bool __result) var isBeheaded = AnimationManager.PawnToHeadInstance.TryGetValue(pawn, out _); if (!isBeheaded) return true; - } + } createdNew = false; __result = false; diff --git a/Source/ThingGenerator/Processing/MapPawnProcessor.cs b/Source/ThingGenerator/Processing/MapPawnProcessor.cs index bf288fa5..ec7f8428 100644 --- a/Source/ThingGenerator/Processing/MapPawnProcessor.cs +++ b/Source/ThingGenerator/Processing/MapPawnProcessor.cs @@ -493,6 +493,10 @@ bool FormalGrappleCheck(Pawn pawn) if (pawn.IsInAnimation() || GrabUtility.IsBeingTargetedForGrapple(pawn)) continue; + // If fire at will is disabled, don't process them. They should not be attacking or lassoing. + if (pawn.drafter?.FireAtWill == false) + continue; + // Should this pawn even be scanned? GetSecondsMTB(pawn, out float execMTB, out float lassoMTB); bool execRandom = Rand.MTBEventOccurs(execMTB, 60f, Core.Settings.ScanTickInterval);