Skip to content

Commit

Permalink
Minor changes to table frames (ParadiseSS13#26313)
Browse files Browse the repository at this point in the history
* Update table_frames.dm

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>

* Update abduction_gear.dm

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>

* Update table_frames.dm

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>

* Update abduction_gear.dm

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>

* Update abduction_gear.dm

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>

* Update table_frames.dm

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>

* Update table_frames.dm

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>

* Update table_frames.dm

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>

---------

Signed-off-by: Faron  <171642577+FaronCD@users.noreply.github.com>
  • Loading branch information
FaronCD authored Aug 1, 2024
1 parent bea2e92 commit 42c50a5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 60 deletions.
22 changes: 1 addition & 21 deletions code/game/gamemodes/miniantags/abduction/abduction_gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -869,27 +869,7 @@ Congratulations! You are now trained for invasive xenobiology research!"}
density = TRUE
anchored = TRUE
resistance_flags = FIRE_PROOF | ACID_PROOF

/obj/structure/table_frame/abductor/try_make_table(obj/item/stack/stack, mob/user)
if(!istype(stack, /obj/item/stack/sheet/mineral/abductor) && !istype(stack, /obj/item/stack/sheet/mineral/silver))
return FALSE

if(stack.get_amount() < 1) //no need for safeties as we did an istype earlier
to_chat(user, "<span class='warning'>You need at least one sheet of [stack] to do this!</span>")
return TRUE

to_chat(user, "<span class='notice'>You start adding [stack] to [src]...</span>")

if(!(do_after(user, 50, target = src) && stack.use(1)))
return TRUE

if(istype(stack, /obj/item/stack/sheet/mineral/abductor)) //if it's not this then it's silver, so no need for an else afterwards
make_new_table(stack.table_type)
return TRUE

new /obj/machinery/optable/abductor(loc)
qdel(src)
return TRUE
restrict_table_types = list(/obj/item/stack/sheet/mineral/silver = /obj/machinery/optable/abductor, /obj/item/stack/sheet/mineral/abductor = /obj/item/stack/sheet/mineral/abductor::table_type)

/obj/structure/table/abductor
name = "alien table"
Expand Down
74 changes: 35 additions & 39 deletions code/game/objects/structures/table_frames.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
anchored = FALSE
layer = PROJECTILE_HIT_THRESHHOLD_LAYER
max_integrity = 100
///The resource dropped when the table frame is destroyed or deconstructed
var/framestack = /obj/item/stack/rods
///How many of framestack resource are dropped
var/framestackamount = 2
///How long the table takes to make
var/construction_time = 5 SECONDS
///What stacks can be used to make the table, and if it will result in a unique table
var/list/restrict_table_types = list() //ex: list(/obj/item/stack/tile/carpet = /obj/structure/table/wood/poker, /obj/item/stack/sheet/wood = /obj/item/stack/sheet/wood::table_type), carpet will make poker table, wood will result in standard table_type. If the list is empty, any material can be used for its default table_type.

/obj/structure/table_frame/attackby(obj/item/I, mob/user, params)
if(!try_make_table(I, user))
Expand All @@ -30,21 +36,43 @@
if(!istype(stack))
return FALSE

if(!stack.table_type)
var/obj/structure/table/new_table_type = stack.table_type
if(length(restrict_table_types))
var/valid_stack_type = FALSE
for(var/obj/item/stack/current_stack as anything in restrict_table_types)
if(istype(stack, current_stack))
new_table_type = restrict_table_types[current_stack]
valid_stack_type = TRUE
break
if(!valid_stack_type)
return FALSE

if(!new_table_type)
return FALSE

if(stack.get_amount() < 1)
to_chat(user, "<span class='warning'>You need at least one sheet of [stack] to do this!</span>")
return TRUE

to_chat(user, "<span class='notice'>You start adding [stack] to [src]...</span>")
if(!do_after(user, construction_time, target = src))
return TRUE

if(!stack.use(1))
to_chat(user, "<span class='warning'>You need at least one sheet of [stack] to do this!</span>")
return TRUE

if(!(do_after(user, 50, target = src) && stack.use(1)))
var/obj/structure/table/table_already_there = locate(/obj/structure/table) in get_turf(src)
if(table_already_there) //check again after to make sure one wasnt added since
to_chat(user, "<span class='warning'>There is already [table_already_there] here.</span>")
return TRUE

if(stack.table_type)
make_new_table(stack.table_type)
if(!istype(new_table_type, /obj/structure/table)) //if its something unique, skip the table parts
new new_table_type(loc)
qdel(src)
return TRUE
make_new_table(new_table_type)
return TRUE

/obj/structure/table_frame/wrench_act(mob/user, obj/item/I)
. = TRUE
Expand Down Expand Up @@ -83,26 +111,7 @@
framestack = /obj/item/stack/sheet/wood
framestackamount = 2
resistance_flags = FLAMMABLE

/obj/structure/table_frame/wood/try_make_table(obj/item/stack/stack, mob/user)
if(!istype(stack, /obj/item/stack/tile/carpet) && !istype(stack, /obj/item/stack/sheet/wood))
return FALSE

if(stack.get_amount() < 1) //no need for safeties as we did an istype earlier
to_chat(user, "<span class='warning'>You need at least one sheet of [stack] to do this!</span>")
return TRUE

to_chat(user, "<span class='notice'>You start adding [stack] to [src]...</span>")

if(!(do_after(user, 50, target = src) && stack.use(1)))
return TRUE

if(istype(stack, /obj/item/stack/tile/carpet))
make_new_table(/obj/structure/table/wood/poker)
return TRUE

make_new_table(stack.table_type)
return TRUE
restrict_table_types = list(/obj/item/stack/tile/carpet = /obj/structure/table/wood/poker, /obj/item/stack/sheet/wood = /obj/item/stack/sheet/wood::table_type)

/obj/structure/table_frame/brass
name = "brass table frame"
Expand All @@ -113,21 +122,8 @@
anchored = TRUE
framestack = /obj/item/stack/tile/brass
framestackamount = 1

/obj/structure/table_frame/brass/try_make_table(obj/item/stack/stack, mob/user)
if(!istype(stack, /obj/item/stack/tile/brass))
return FALSE

if(stack.get_amount() < 1) //no need for safeties as we did an istype earlier
to_chat(user, "<span class='warning'>You need at least one sheet of [stack] to do this!</span>")
return TRUE

to_chat(user, "<span class='notice'>You start adding [stack] to [src]...</span>")

if(do_after(user, 20, target = src) && stack.use(1))
make_new_table(stack.table_type)

return TRUE
construction_time = 2 SECONDS
restrict_table_types = list(/obj/item/stack/tile/brass = /obj/item/stack/tile/brass::table_type)

/obj/structure/table_frame/brass/narsie_act()
..()
Expand Down

0 comments on commit 42c50a5

Please sign in to comment.