Skip to content

Conversation

@lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Jun 16, 2025

Description of the proposed changes

Fixes #6425.

  • Adds the dummy unit OnCreate to zxa0003's script. This fixes EntityId being missing from the unit.
  • Disable doing adjacency for dummy units since it can allocate many tables considering that it occurs for all UEF construction drones which may be flying around building many structures.

Testing done on the proposed changes

The t2 mass fab is placed here so that it triggers the adjacency for the dummy unit of the fatboy. Using debug logging it shows that the dummy unit is ignored correctly.
You can also trigger the adjacency by having the UEF engineer SACU build any structures.

   CreateUnitAtMouse('uel0301_engineer', 0,    1.93,   -0.48, -0.00000)
   CreateUnitAtMouse('uel0301_engineer', 0,   -2.00,   -0.48, -0.00000)
   CreateUnitAtMouse('uel0301_engineer', 0,   -3.32,   -0.48, -0.00000)
   CreateUnitAtMouse('uel0301_engineer', 0,   -4.84,   -0.48, -0.00000)
   CreateUnitAtMouse('uel0301_engineer', 0,   -0.72,   -0.48, -0.00000)
   CreateUnitAtMouse('uel0301_engineer', 0,    5.19,   -0.48, -0.00000)
   CreateUnitAtMouse('uel0301_engineer', 0,    3.34,   -0.48, -0.00000)
   CreateUnitAtMouse('uel0301_engineer', 0,    0.40,   -0.48, -0.00000)
   CreateUnitAtMouse('ueb1104', 0,   -2.32,    3.52,  0.00000)
   CreateUnitAtMouse('uel0401ef', 0,   -1.49,    2.89,  1.35140)
   CreateUnitAtMouse('uel0401', 0,    3.15,    3.92,  1.35140)
   CreateUnitAtMouse('xab1401', 0,    0.68,   -6.48, -0.00000)

Checklist

@lL1l1 lL1l1 requested review from Garanas, clyfordv and speed2CZ June 16, 2025 20:27
@lL1l1 lL1l1 added type: bug area: sim Area that is affected by the Simulation of the Game labels Jun 16, 2025
@lL1l1 lL1l1 marked this pull request as ready for review June 16, 2025 20:28
@Garanas
Copy link
Member

Garanas commented Jun 17, 2025

Great catch on the missing call to OnCreate.

I do not fully understand the context about UEF construction drones (from kennels), these generate calls to OnAdjacentTo? That would be unexpected, I thought that was a structure-only engine event.

@lL1l1
Copy link
Contributor Author

lL1l1 commented Jun 17, 2025

It is, but we have a "guard dummy" unit (zxa0003) which uses the RULEUMT_None motion type and is attached to the drone itself. When the drone finishes construction, the attached dummy unit can be in an ogrid where it is considered adjacent.

The dummy is used to save assist orders onto the drone after a drone docks.

-- make sure we're both finished building
if self:IsBeingBuilt() or adjacentUnit:IsBeingBuilt() then
if self:IsBeingBuilt() or adjacentUnit:IsBeingBuilt()
or adjacentUnit.Blueprint.CategoriesHash["DUMMYUNIT"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the suggested logic the dummy unit should not have adjacency.

Whats the reason to put this check into Structure?

Why not to add OnAdjacentTo OnNotAdjacentTo to the Dummy class that would return?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^Second this suggestion. Keeping things modular means that any future changes/removals don't leave lingering logic in the base class. Additionally, as the original implementer of zxa0003 I'll say that I knew enough to get it working, but not enough to know all the details exhaustively. Somebody with more experience in the unit blueprints could remove the structure-ness of it and address the problem at the source (add a movement type, maybe?).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not to add OnAdjacentTo OnNotAdjacentTo to the Dummy class that would return?

The error pops up in the script of the structure that is adjacent. Returning in the dummy class does nothing to prevent the adjacent structure unit script from running.

don't leave lingering logic in the base class

I agree, I'll try to find a different solution.

remove the structure-ness of it and address the problem at the source (add a movement type, maybe?).

I tried other motion types but the engine removes the assist order once the drone is attached to the SACU (and the dummy unit is finally attached indirectly to the SACU).
Fortunately, upon some investigation, it seems related to the "Attached" state of the unit, so we can do self:SetUnitState("Attached", false) in OnAttachedToTransport and then remove all the guard re-assignment behavior, since assist orders no longer get removed.

I haven't yet figured out how to deal with fatboy detaching its external factory when you give the dummy unit a motion type.

@Garanas
Copy link
Member

Garanas commented Jun 26, 2025

Now I understand the context more, the guard unit is introduced with: #6176

And it only applies to the construction pods of the (S)ACUs. The drones from Kennels do not use this class. They are 'regular' construction units.

@BlackYps BlackYps removed this from the Development Iteration III of 2025 milestone Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sim Area that is affected by the Simulation of the Game type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Frequent OnAdjacentTo error

5 participants