Fixes duct tape exploit (#13985)

* Fixes duct tape exploit
This commit is contained in:
AffectedArc07
2020-09-16 16:34:18 +01:00
committed by GitHub
parent 5d2363949f
commit cafe92f93b

View File

@@ -47,23 +47,30 @@
return
if(!isturf(target))
return
if(!user.unEquip(I))
return
var/turf/source_turf = get_turf(I)
var/turf/target_turf = target
var/list/clickparams = params2list(params)
var/x_offset = text2num(clickparams["icon-x"]) - 16
var/y_offset = text2num(clickparams["icon-y"]) - 16
var/x_offset
var/y_offset
if(target_turf != get_turf(I)) //Trying to stick it on a wall, don't move it to the actual wall or you can move the item through it. Instead set the pixels as appropriate
var/target_direction = get_dir(source_turf, target_turf)//The direction we clicked
// Snowflake diagonal handling
if(target_direction in GLOB.diagonals)
to_chat(user, "<span class='warning'>You cant reach [target_turf].</span>")
return
if(target_direction & EAST)
x_offset += 32
x_offset = 16
y_offset = rand(-12, 12)
else if(target_direction & WEST)
x_offset -= 32
if(target_direction & NORTH)
y_offset += 32
x_offset = -16
y_offset = rand(-12, 12)
else if(target_direction & NORTH)
x_offset = rand(-12, 12)
y_offset = 16
else if(target_direction & SOUTH)
y_offset -= 32
x_offset = rand(-12, 12)
y_offset = -16
if(!user.unEquip(I))
return
to_chat(user, "<span class='notice'>You stick [I] to [target_turf].</span>")
I.pixel_x = x_offset
I.pixel_y = y_offset