Fix construction DoAfter results not setting current edge index.
Fixes #5061
This commit is contained in:
@@ -54,7 +54,13 @@ namespace Content.Server.Construction
|
|||||||
// If we're currently in an edge, we'll let the edge handle or validate the interaction.
|
// If we're currently in an edge, we'll let the edge handle or validate the interaction.
|
||||||
if (GetCurrentEdge(uid, construction) is {} edge)
|
if (GetCurrentEdge(uid, construction) is {} edge)
|
||||||
{
|
{
|
||||||
return HandleEdge(uid, ev, edge, validation, construction);
|
var result = HandleEdge(uid, ev, edge, validation, construction);
|
||||||
|
|
||||||
|
// Reset edge index to none if this failed...
|
||||||
|
if (!validation && result is HandleResult.False && construction.StepIndex == 0)
|
||||||
|
construction.EdgeIndex = null;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're not on an edge, let the node handle or validate the interaction.
|
// If we're not on an edge, let the node handle or validate the interaction.
|
||||||
@@ -85,10 +91,17 @@ namespace Content.Server.Construction
|
|||||||
if (HandleEdge(uid, ev, edge, validation, construction) is var result and not HandleResult.False)
|
if (HandleEdge(uid, ev, edge, validation, construction) is var result and not HandleResult.False)
|
||||||
{
|
{
|
||||||
// Only a True result may modify the state.
|
// Only a True result may modify the state.
|
||||||
// In the case of DoAfter, we don't want it modifying the state yet, other than the waiting flag.
|
// In the case of DoAfter, it's only allowed to modify the waiting flag and the current edge index.
|
||||||
// In the case of validated, it should NEVER modify the state at all.
|
// In the case of validated, it should NEVER modify the state at all.
|
||||||
if (result is not HandleResult.True)
|
if (result is not HandleResult.True)
|
||||||
|
{
|
||||||
|
if (result is HandleResult.DoAfter)
|
||||||
|
{
|
||||||
|
construction.EdgeIndex = i;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// If we're not on the same edge as we were before, that means handling that edge changed the node.
|
// If we're not on the same edge as we were before, that means handling that edge changed the node.
|
||||||
if (construction.Node != node.Name)
|
if (construction.Node != node.Name)
|
||||||
|
|||||||
4
Resources/Changelog/Parts/doafter.yml
Normal file
4
Resources/Changelog/Parts/doafter.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
author: Zumorica
|
||||||
|
changes:
|
||||||
|
- type: Fix # One of the following: Add, Remove, Tweak, Fix
|
||||||
|
message: Fix rare construction bug where some interactions would be incorrect.
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
actions:
|
actions:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SheetSteel1
|
prototype: SheetSteel1
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity
|
||||||
edges:
|
edges:
|
||||||
- to: missingWires
|
- to: missingWires
|
||||||
completed:
|
completed:
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
actions:
|
actions:
|
||||||
- !type:SpriteStateChange
|
- !type:SpriteStateChange
|
||||||
state: "box_0"
|
state: "box_0"
|
||||||
- !type:EmptyAllContainers {}
|
- !type:EmptyAllContainers
|
||||||
edges:
|
edges:
|
||||||
- to: machineFrame
|
- to: machineFrame
|
||||||
conditions:
|
conditions:
|
||||||
- !type:EntityAnchored {}
|
- !type:EntityAnchored
|
||||||
steps:
|
steps:
|
||||||
- material: Cable
|
- material: Cable
|
||||||
- to: start
|
- to: start
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: SheetSteel1
|
prototype: SheetSteel1
|
||||||
amount: 5
|
amount: 5
|
||||||
- !type:DeleteEntity {}
|
- !type:DeleteEntity
|
||||||
steps:
|
steps:
|
||||||
- tool: Screwing
|
- tool: Screwing
|
||||||
doAfter: 2
|
doAfter: 2
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
- to: missingWires
|
- to: missingWires
|
||||||
conditions:
|
conditions:
|
||||||
- !type:EntityAnchored {}
|
- !type:EntityAnchored
|
||||||
completed:
|
completed:
|
||||||
- !type:SpawnPrototype
|
- !type:SpawnPrototype
|
||||||
prototype: CableApcStack1
|
prototype: CableApcStack1
|
||||||
@@ -68,8 +68,8 @@
|
|||||||
- tool: Prying
|
- tool: Prying
|
||||||
doAfter: 2
|
doAfter: 2
|
||||||
completed:
|
completed:
|
||||||
- !type:EmptyAllContainers {}
|
- !type:EmptyAllContainers
|
||||||
- !type:MachineFrameRegenerateProgress {}
|
- !type:MachineFrameRegenerateProgress
|
||||||
- tool: Cutting
|
- tool: Cutting
|
||||||
doAfter: 0.25
|
doAfter: 0.25
|
||||||
|
|
||||||
@@ -82,8 +82,8 @@
|
|||||||
edges:
|
edges:
|
||||||
- to: machineFrame
|
- to: machineFrame
|
||||||
conditions:
|
conditions:
|
||||||
- !type:EntityAnchored {}
|
- !type:EntityAnchored
|
||||||
- !type:WirePanel {}
|
- !type:WirePanel
|
||||||
steps:
|
steps:
|
||||||
- tool: Prying
|
- tool: Prying
|
||||||
doAfter: 0.25
|
doAfter: 0.25
|
||||||
|
|||||||
Reference in New Issue
Block a user