Code cleanup on halloween gifts and beacons (#1072)

* Cleanup on Isle 3

* I think this is better

* Misnamed var

* Willard's Suggestion

that was honestly dumb to miss

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
A miscellaneous Fern
2023-11-22 12:39:43 +01:00
committed by GitHub
parent 0201a16bf4
commit d3f87f5cb9

View File

@@ -1,3 +1,13 @@
GLOBAL_LIST_EMPTY_TYPED(halloween_gifts, /obj/item/storage/box/halloween)
/proc/populate_halloween_gifts()
var/list/valid_gifts = subtypesof(/obj/item/storage/box/halloween)
for(var/obj/item/storage/box/halloween/halloween_box as anything in valid_gifts)
if(!initial(halloween_box.theme_name))
valid_gifts -= halloween_box
GLOB.halloween_gifts = valid_gifts
/** /**
* Choice beacon * Choice beacon
* Purchased at Cargo, allows you to order any Costume you want * Purchased at Cargo, allows you to order any Costume you want
@@ -9,12 +19,15 @@
icon_state = "gangtool-white" icon_state = "gangtool-white"
/obj/item/choice_beacon/halloween/generate_display_names() /obj/item/choice_beacon/halloween/generate_display_names()
var/list/halloween_costumes = list() var/static/list/halloween_costumes
for(var/generated_options in subtypesof(/obj/item/storage/box/halloween)) if(!halloween_costumes)
var/obj/item/storage/box/halloween/halloween_boxes = generated_options if(!GLOB.halloween_gifts.len)
if(!(initial(halloween_boxes.theme_name))) populate_halloween_gifts()
continue
halloween_costumes[initial(halloween_boxes.theme_name)] = halloween_boxes halloween_costumes = list()
for(var/obj/item/storage/box/halloween/halloween_boxes as anything in GLOB.halloween_gifts)
halloween_costumes[initial(halloween_boxes.theme_name)] = halloween_boxes
return halloween_costumes return halloween_costumes
/obj/item/choice_beacon/halloween/spawn_option(obj/choice, mob/living/gifted_person) /obj/item/choice_beacon/halloween/spawn_option(obj/choice, mob/living/gifted_person)
@@ -24,9 +37,12 @@
/// Debug delivery beacon with unlimited uses /// Debug delivery beacon with unlimited uses
/obj/item/choice_beacon/halloween/debug /obj/item/choice_beacon/halloween/debug
name = "debug halloween delivery beacon" name = "debug halloween delivery beacon"
desc = "Summon up to 100 boxes of halloween costumes to help you get spooky." desc = "A wonder of bluespace technology, capable of warping in an unlimited amount halloween costumes to help you get spooky."
uses = 100 uses = 100
/obj/item/choice_beacon/halloween/debug/consume_use(obj/choice_path, mob/living/user)
uses++
return ..()
/** /**
* Storage box code * Storage box code
@@ -96,14 +112,7 @@
item.add_fingerprint(user) item.add_fingerprint(user)
/obj/item/halloween_gift/proc/get_gift_type() /obj/item/halloween_gift/proc/get_gift_type()
if(!GLOB.possible_gifts.len) if(!GLOB.halloween_gifts.len)
var/list/gift_types_list = subtypesof(/obj/item/storage/box/halloween) populate_halloween_gifts()
for(var/generated_options in gift_types_list)
var/obj/item/item = generated_options
if((!initial(item.icon_state)) || (!initial(item.inhand_icon_state)) || (initial(item.item_flags) & ABSTRACT))
gift_types_list -= generated_options
GLOB.possible_gifts = gift_types_list
var/gift_type = pick(GLOB.possible_gifts) return pick(GLOB.halloween_gifts)
return gift_type