mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
[MIRROR] Fixes table stacking exploit (#1534)
* Fixes table stacking exploit (#54650) Tables could be placed on top of each other, leading to stacking of glass tables, and infinite sin. This doesn't cover anything close to all of it, but it's a good patch for now. * Fixes table stacking exploit Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
@@ -158,6 +158,8 @@ GLOBAL_LIST_INIT(turfs_without_ground, typecacheof(list(
|
|||||||
|
|
||||||
#define isitem(A) (istype(A, /obj/item))
|
#define isitem(A) (istype(A, /obj/item))
|
||||||
|
|
||||||
|
#define isstack(A) (istype(A, /obj/item/stack))
|
||||||
|
|
||||||
#define isgrenade(A) (istype(A, /obj/item/grenade))
|
#define isgrenade(A) (istype(A, /obj/item/grenade))
|
||||||
|
|
||||||
#define islandmine(A) (istype(A, /obj/effect/mine))
|
#define islandmine(A) (istype(A, /obj/effect/mine))
|
||||||
|
|||||||
@@ -21,36 +21,48 @@
|
|||||||
var/framestack = /obj/item/stack/rods
|
var/framestack = /obj/item/stack/rods
|
||||||
var/framestackamount = 2
|
var/framestackamount = 2
|
||||||
|
|
||||||
/obj/structure/table_frame/attackby(obj/item/I, mob/user, params)
|
|
||||||
if(I.tool_behaviour == TOOL_WRENCH)
|
|
||||||
to_chat(user, "<span class='notice'>You start disassembling [src]...</span>")
|
|
||||||
I.play_tool_sound(src)
|
|
||||||
if(I.use_tool(src, user, 30))
|
|
||||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
|
|
||||||
deconstruct(TRUE)
|
|
||||||
return
|
|
||||||
|
|
||||||
var/obj/item/stack/material = I
|
/obj/structure/table_frame/wrench_act(mob/living/user, obj/item/I)
|
||||||
if (istype(material))
|
to_chat(user, "<span class='notice'>You start disassembling [src]...</span>")
|
||||||
if(material?.tableVariant)
|
I.play_tool_sound(src)
|
||||||
|
if(!I.use_tool(src, user, 3 SECONDS))
|
||||||
|
return TRUE
|
||||||
|
playsound(loc, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||||
|
deconstruct(TRUE)
|
||||||
|
return TRUE
|
||||||
|
|
||||||
|
|
||||||
|
/obj/structure/table_frame/attackby(obj/item/I, mob/user, params)
|
||||||
|
if(isstack(I))
|
||||||
|
var/obj/item/stack/material = I
|
||||||
|
if(material.tableVariant)
|
||||||
if(material.get_amount() < 1)
|
if(material.get_amount() < 1)
|
||||||
to_chat(user, "<span class='warning'>You need one [material.name] sheet to do this!</span>")
|
to_chat(user, "<span class='warning'>You need one [material.name] sheet to do this!</span>")
|
||||||
return
|
return
|
||||||
|
if(locate(/obj/structure/table) in loc)
|
||||||
|
to_chat(user, "<span class='warning'>There's already a table built here!</span>")
|
||||||
|
return
|
||||||
to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
|
to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
|
||||||
if(do_after(user, 20, target = src) && material.use(1))
|
if(!do_after(user, 2 SECONDS, target = src) || !material.use(1) || (locate(/obj/structure/table) in loc))
|
||||||
make_new_table(material.tableVariant)
|
return
|
||||||
|
make_new_table(material.tableVariant)
|
||||||
else if(istype(material, /obj/item/stack/sheet))
|
else if(istype(material, /obj/item/stack/sheet))
|
||||||
if(material.get_amount() < 1)
|
if(material.get_amount() < 1)
|
||||||
to_chat(user, "<span class='warning'>You need one sheet to do this!</span>")
|
to_chat(user, "<span class='warning'>You need one sheet to do this!</span>")
|
||||||
return
|
return
|
||||||
|
if(locate(/obj/structure/table) in loc)
|
||||||
|
to_chat(user, "<span class='warning'>There's already a table built here!</span>")
|
||||||
|
return
|
||||||
to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
|
to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
|
||||||
if(do_after(user, 20, target = src) && material.use(1))
|
if(!do_after(user, 2 SECONDS, target = src) || !material.use(1) || (locate(/obj/structure/table) in loc))
|
||||||
var/list/material_list = list()
|
return
|
||||||
if(material.material_type)
|
var/list/material_list = list()
|
||||||
material_list[material.material_type] = MINERAL_MATERIAL_AMOUNT
|
if(material.material_type)
|
||||||
make_new_table(/obj/structure/table/greyscale, material_list)
|
material_list[material.material_type] = MINERAL_MATERIAL_AMOUNT
|
||||||
else
|
make_new_table(/obj/structure/table/greyscale, material_list)
|
||||||
return ..()
|
return
|
||||||
|
return ..()
|
||||||
|
|
||||||
|
|
||||||
/obj/structure/table_frame/proc/make_new_table(table_type, custom_materials) //makes sure the new table made retains what we had as a frame
|
/obj/structure/table_frame/proc/make_new_table(table_type, custom_materials) //makes sure the new table made retains what we had as a frame
|
||||||
var/obj/structure/table/T = new table_type(loc)
|
var/obj/structure/table/T = new table_type(loc)
|
||||||
|
|||||||
Reference in New Issue
Block a user