Skip to content

Commit

Permalink
TGS Test Merge (#7282)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Oct 12, 2024
2 parents 4cdb793 + 5d6f909 commit 886fdce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/cooldowns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#define COOLDOWN_ITEM_HOOD_SOUND "item_hood_sound"
#define COOLDOWN_LIGHT "cooldown_light"

#define COOLDOWN_PRINTER_ERROR "cooldown_printer_error"

//Define for ship alt
#define COOLDOWN_ALTITUDE_CHANGE "altitude_change"

Expand Down
31 changes: 23 additions & 8 deletions code/modules/cm_marines/vehicle_part_fabricator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
if(SSticker.current_state < GAME_STATE_PLAYING)
return

process_build_queue()

if(generate_points)
add_to_point_store()

process_build_queue()

update_icon()

/obj/structure/machinery/part_fabricator/proc/process_build_queue()
Expand All @@ -86,11 +86,23 @@
busy = TRUE
var/datum/build_queue_entry/entry = build_queue[1]

if(ispath(entry.item, /obj/structure/ship_ammo/sentry))
var/is_omnisentry = ispath(entry.item, /obj/structure/ship_ammo/sentry)

if((is_omnisentry && get_point_store() < omnisentry_price) || get_point_store() < entry.cost)
if(!TIMER_COOLDOWN_CHECK(src, COOLDOWN_PRINTER_ERROR))
balloon_alert_to_viewers("out of points - printing paused!")
visible_message(SPAN_WARNING("[src] flashes a warning light."))
TIMER_COOLDOWN_START(src, COOLDOWN_PRINTER_ERROR, 20 SECONDS)
busy = FALSE
return

if(is_omnisentry)
spend_point_store(omnisentry_price)
omnisentry_price += omnisentry_price_scale
else
spend_point_store(entry.cost)

visible_message(SPAN_NOTICE("[src] starts printing something."))
spend_point_store(entry.cost)
addtimer(CALLBACK(src, PROC_REF(produce_part), entry), 3 SECONDS)

/obj/structure/machinery/part_fabricator/proc/build_part(part_type, cost, mob/user)
Expand Down Expand Up @@ -134,7 +146,7 @@
return
cost = initial(produce.point_cost)
build_part(produce, cost, user)
return
return TRUE

else
var/obj/structure/ship_ammo/produce = (typesof(/obj/structure/ship_ammo))[index]
Expand All @@ -143,21 +155,24 @@
return
cost = initial(produce.point_cost)
build_part(produce, cost, user)
return
return TRUE

if(action == "cancel")
var/index = params["index"]

if(length(build_queue))
if(index == 1)
if(index == null || index > length(build_queue))
return

if(busy && index == 1)
to_chat(user, SPAN_WARNING("Cannot cancel currently produced item."))
return

var/datum/build_queue_entry/entry = build_queue[index]

build_queue.Remove(entry)
add_to_point_store(entry.cost)
return
return TRUE

else
log_admin("Bad topic: [user] may be trying to HREF exploit [src]")
Expand Down

0 comments on commit 886fdce

Please sign in to comment.