Skip to content

Commit 63b4b10

Browse files
Merge pull request #1547 from wiremod/fix/1407-garrydupe-dupefinished
Run AdvDupe_FinishPasting for normal Duplicator
2 parents 0e02343 + f24cf3d commit 63b4b10

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lua/wire/client/e2descriptions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ E2Helper.Descriptions["toString(q:)"] = "Formats Q as a string"
795795
-- Selfaware
796796
E2Helper.Descriptions["first()"] = "Returns 1 if the expression was spawned or reset"
797797
E2Helper.Descriptions["duped()"] = "Returns 1 if the expression was duplicated"
798-
E2Helper.Descriptions["dupefinished()"] = "Returns 1 when the contraption has finished duping. (Only triggers on Adv Duplicator, not the normal duplicator)"
798+
E2Helper.Descriptions["dupefinished()"] = "Returns 1 when the contraption has finished duping."
799799
E2Helper.Descriptions["inputClk()"] = "Returns 1 if the expression was triggered by an input"
800800
E2Helper.Descriptions["last()"] = "Returns 1 if it is being called on the last execution of the expression gate before it is removed or reset. This execution must be requested with the runOnLast(1) command"
801801
E2Helper.Descriptions["removing()"] = "Returns 1 if this is the last() execution and caused by the entity being removed"

lua/wire/server/wirelib.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,3 +1200,27 @@ function WireLib.IsValidMaterial(material)
12001200
return material
12011201
end
12021202

1203+
if not WireLib.PatchedDuplicator then
1204+
WireLib.PatchedDuplicator = true
1205+
1206+
local localPos
1207+
1208+
local oldSetLocalPos = duplicator.SetLocalPos
1209+
function duplicator.SetLocalPos(pos, ...)
1210+
localPos = pos
1211+
return oldSetLocalPos(pos, ...)
1212+
end
1213+
1214+
local oldPaste = duplicator.Paste
1215+
function duplicator.Paste(player, entityList, constraintList, ...)
1216+
local result = { oldPaste(player, entityList, constraintList, ...) }
1217+
local createdEntities, createdConstraints = result[1], result[2]
1218+
local data = {
1219+
EntityList = entityList, ConstraintList = constraintList,
1220+
CreatedEntities = createdEntities, CreatedConstraints = createdConstraints,
1221+
Player = player, HitPos = localPos,
1222+
}
1223+
hook.Run("AdvDupe_FinishPasting", {data}, 1)
1224+
return unpack(result)
1225+
end
1226+
end

0 commit comments

Comments
 (0)