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

View File

@@ -83,6 +83,7 @@
construct_type = /mob/living/simple_animal/drone/cogscarab
w_class = WEIGHT_CLASS_SMALL
var/infinite_resources = TRUE
var/static/obj/item/seasonal_hat //Share it with all other scarabs, since we're from the same cult!
/obj/item/clockwork/construct_chassis/cogscarab/Initialize()
. = ..()
@@ -93,6 +94,12 @@
if(infinite_resources)
//During rounds where they can't interact with the station, let them experiment with builds
construct_type = /mob/living/simple_animal/drone/cogscarab/ratvar
if(!seasonal_hat)
var/obj/item/drone_shell/D = locate() in GLOB.poi_list
if(D && D.possible_seasonal_hats.len)
seasonal_hat = pick(D.possible_seasonal_hats)
else
seasonal_hat = "none"
/obj/item/clockwork/construct_chassis/cogscarab/post_spawn(mob/living/construct)
if(infinite_resources) //Allow them to build stuff and recite scripture
@@ -101,3 +108,6 @@
F.uses_power = FALSE
for(var/obj/item/clockwork/slab/S in cached_stuff)
S.no_cost = TRUE
if(seasonal_hat && seasonal_hat != "none")
var/obj/item/hat = new seasonal_hat(construct)
construct.equip_to_slot_or_del(hat, slot_head)

View File

@@ -9,6 +9,8 @@
var/begin_weekday = FALSE //If set to a weekday, then this will trigger the holiday on the above week
var/always_celebrate = FALSE // for christmas neverending, or testing.
var/obj/item/drone_hat //If this is defined, drones without a default hat will spawn with this one during the holiday; check drones_as_items.dm to see this used
// This proc gets run before the game starts when the holiday is activated. Do festive shit here.
/datum/holiday/proc/celebrate()
return
@@ -172,11 +174,13 @@
name = "Labor Day"
begin_day = 1
begin_month = MAY
drone_hat = /obj/item/clothing/head/hardhat
/datum/holiday/firefighter
name = "Firefighter's Day"
begin_day = 4
begin_month = MAY
drone_hat = /obj/item/clothing/head/hardhat/red
/datum/holiday/firefighter/getStationPrefix()
return pick("Burning","Blazing","Plasma","Fire")
@@ -190,6 +194,7 @@
name = "Doctor's Day"
begin_day = 1
begin_month = JULY
drone_hat = /obj/item/clothing/head/nursehat
/datum/holiday/UFO
name = "UFO Day"
@@ -221,6 +226,7 @@
name = "Talk-Like-a-Pirate Day"
begin_day = 19
begin_month = SEPTEMBER
drone_hat = /obj/item/clothing/head/pirate
/datum/holiday/pirate/greet()
return "Ye be talkin' like a pirate today or else ye'r walkin' tha plank, matey!"
@@ -321,6 +327,7 @@
begin_week = 4
begin_month = NOVEMBER
begin_weekday = THURSDAY
drone_hat = /obj/item/clothing/head/that //This is the closest we can get to a pilgrim's hat
/datum/holiday/thanksgiving/canada
name = "Thanksgiving in Canada"
@@ -384,12 +391,14 @@ Since Ramadan is an entire month that lasts 29.5 days on average, the start and
name = "Mayan Doomsday Anniversary"
begin_day = 21
begin_month = DECEMBER
drone_hat = /obj/item/clothing/mask/rat/tribal
/datum/holiday/xmas
name = CHRISTMAS
begin_day = 22
begin_month = DECEMBER
end_day = 27
drone_hat = /obj/item/clothing/head/santa
/datum/holiday/xmas/greet()
return "Have a merry Christmas!"
@@ -399,6 +408,7 @@ Since Ramadan is an entire month that lasts 29.5 days on average, the start and
begin_day = 1
begin_month = DECEMBER
end_day = 31
drone_hat = /obj/item/clothing/head/santa
/datum/holiday/festive_season/greet()
return "Have a nice festive season!"
@@ -421,6 +431,7 @@ Since Ramadan is an entire month that lasts 29.5 days on average, the start and
/datum/holiday/easter
name = EASTER
drone_hat = /obj/item/clothing/head/rabbitears
var/const/days_early = 1 //to make editing the holiday easier
var/const/days_extra = 1

View File

@@ -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)