@@ -219,8 +219,7 @@ if SERVER then
219219 error ( " Invalid entity specified" )
220220 end
221221
222- if target .AwaitingUpload or target .Uploading then return end
223- target .AwaitingUpload = ply
222+ if target .Uploading then return end
224223
225224 net .Start (" wire_expression2_tool_upload" )
226225 net .WriteUInt (target :EntIndex (), 16 )
@@ -353,11 +352,15 @@ if SERVER then
353352 return
354353 end
355354
356- if toent .AwaitingUpload ~= ply then
357- WireLib .AddNotify (ply , " This Expression chip is not awaiting an upload. Upload aborted." , NOTIFY_ERROR , 7 , NOTIFYSOUND_DRIP3 )
355+ if not WireLib .CanTool (ply , toent , " wire_expression2" ) then
356+ WireLib .AddNotify (ply , " You are not allowed to upload to the target Expression chip. Upload aborted." , NOTIFY_ERROR , 7 , NOTIFYSOUND_DRIP3 )
357+ return
358+ end
359+
360+ if toent .Uploading then
361+ WireLib .AddNotify (ply , " This Expression chip is already uploading. Upload aborted." , NOTIFY_ERROR , 7 , NOTIFYSOUND_DRIP3 )
358362 return
359363 end
360- toent .AwaitingUpload = nil
361364 toent .Uploading = true
362365
363366 net .ReadStream (ply , function (data )
@@ -590,6 +593,10 @@ if CLIENT then
590593 end
591594
592595 function WireLib .Expression2Upload (targetEntID , code , filepath )
596+ if isentity ( targetEntID ) then
597+ targetEntID = targetEntID :EntIndex ()
598+ end
599+
593600 if not targetEntID then
594601 local aimEnt = LocalPlayer ():GetEyeTrace ().Entity
595602 if IsValid ( aimEnt ) then
0 commit comments