Merge pull request #4546 from Citadel-Station-13/upstream-merge-33834

[MIRROR] Drones now spawn with seasonal hats depending on active holidays [VERY Important PR]
This commit is contained in:
LetterJay
2017-12-27 03:03:16 -06:00
committed by GitHub
3 changed files with 38 additions and 0 deletions
@@ -14,6 +14,8 @@
icon = 'icons/mob/drone.dmi'
icon_state = "drone_maint_hat"//yes reuse the _hat state.
var/drone_type = /mob/living/simple_animal/drone //Type of drone that will be spawned
var/seasonal_hats = TRUE //If TRUE, and there are no default hats, different holidays will grant different hats
var/static/list/possible_seasonal_hats //This is built automatically in build_seasonal_hats() but can also be edited by admins!
/obj/item/drone_shell/New()
..()
@@ -21,6 +23,17 @@
if(A)
notify_ghosts("A drone shell has been created in \the [A.name].", source = src, action=NOTIFY_ATTACK, flashwindow = FALSE)
GLOB.poi_list |= src
if(isnull(possible_seasonal_hats))
build_seasonal_hats()
/obj/item/drone_shell/proc/build_seasonal_hats()
possible_seasonal_hats = list()
if(!SSevents.holidays.len)
return //no holidays, no hats; we'll keep the empty list so we never call this proc again
for(var/V in SSevents.holidays)
var/datum/holiday/holiday = SSevents.holidays[V]
if(holiday.drone_hat)
possible_seasonal_hats += holiday.drone_hat
/obj/item/drone_shell/Destroy()
GLOB.poi_list -= src
@@ -42,6 +55,10 @@
if(be_drone == "No" || QDELETED(src) || !isobserver(user))
return
var/mob/living/simple_animal/drone/D = new drone_type(get_turf(loc))
if(!D.default_hatmask && seasonal_hats && possible_seasonal_hats.len)
var/hat_type = pick(possible_seasonal_hats)
var/obj/item/new_hat = new hat_type(D)
D.equip_to_slot_or_del(new_hat, slot_head)
D.admin_spawned = admin_spawned
D.key = user.key
qdel(src)