diff --git a/code/modules/decorators/halloween.dm b/code/modules/decorators/halloween.dm index af19d80bbb23..420edc999f3c 100644 --- a/code/modules/decorators/halloween.dm +++ b/code/modules/decorators/halloween.dm @@ -13,6 +13,40 @@ if(cur_mon == 11 && cur_day < 4) return 0 +/// Pumpkins decorator: adds patches of carvable/wearable pumpkins around the ground level +/datum/decorator/halloween/pumpkins + var/list/obj/structure/pumpkin_patch/placed_pumpkins = list() //! List of pumpkins to avoid placing in proximity + var/pumpkin_prob = 4 //! Chance to place a pumpkin + var/pumpkin_prob_corruption = 20 + var/pumpkin_prob_decrease = 0.6 //! Chance reduction per day before halloween + var/exclusion_range = 8 + +/datum/decorator/halloween/pumpkins/get_decor_types() + return typesof(/turf/open/gm) + typesof(/turf/open/auto_turf) + typesof(/turf/open/jungle) + typesof(/turf/open/desert) + typesof(/turf/open/mars) + typesof(/turf/open/mars_cave) + +/datum/decorator/halloween/pumpkins/decorate(turf/open/turf) + if(!is_ground_level(turf.z)) + return + + var/event_progress = get_event_progress() + var/placement_chance = pumpkin_prob + if(!prob(placement_chance)) + return + + var/corruption_chance = pumpkin_prob_corruption - (event_progress * pumpkin_prob_decrease) + + for(var/pumpkin in placed_pumpkins) + if(get_dist(turf, pumpkin) <= exclusion_range) + return + + var/obj/structure/pumpkin_patch/patch + if(prob(corruption_chance)) + patch = new /obj/structure/pumpkin_patch/corrupted(turf) + else + patch = new /obj/structure/pumpkin_patch(turf) + placed_pumpkins += patch + + /// Cobweb decorator: adds more and more cobwebs as you go through the month /datum/decorator/halloween/cobwebs /// How much prob() chance to put a cobweb during halloween proper diff --git a/code/modules/holidays/halloween/pumpkins/patches.dm b/code/modules/holidays/halloween/pumpkins/patches.dm new file mode 100644 index 000000000000..97ceaf9e108b --- /dev/null +++ b/code/modules/holidays/halloween/pumpkins/patches.dm @@ -0,0 +1,58 @@ +/// Patches of pumpkins spawned at roundstart from where marines can get their carvable pumpkins +/obj/structure/pumpkin_patch + icon = 'icons/misc/events/pumpkins.dmi' + name = "patch of pumpkins" + + can_block_movement = FALSE + unslashable = TRUE + health = 400 // To avoid explosions and stray gunfire destroying them too easily + layer = LOWER_ITEM_LAYER + + var/has_vines = TRUE //! Whether there's still vines to display or not + var/pumpkin_count = 3 //! Amount of pumpkins currently in the patch + var/icon_prefix //! Prefix to prepend to icon states, for corrupted pumpkins + var/pumpkin_type = /obj/item/clothing/head/pumpkin + +/obj/structure/pumpkin_patch/Initialize(mapload, ...) + . = ..() + update_icon() + +/obj/structure/pumpkin_patch/update_icon() + overlays?.Cut() + . = ..() + switch(pumpkin_count) + if(3) icon_state = "[icon_prefix]pumpkins_full" + if(2) icon_state = "[icon_prefix]pumpkins_half" + if(1) icon_state = "[icon_prefix]pumpkin" + else icon_state = "" + if(has_vines) + overlays += image(icon, loc, "[icon_prefix]vines") + +/obj/structure/pumpkin_patch/attack_hand(mob/user) + if(pumpkin_count < 1) + to_chat(user, SPAN_WARNING("No more pumpkins here...")) + return + if(!user.get_active_hand()) //if active hand is empty + pumpkin_count-- + var/obj/item/clothing/head/pumpkin/pumpkin = new pumpkin_type(loc) + user.put_in_hands(pumpkin) + update_icon() + if(pumpkin_count < 1 && !has_vines) + qdel(src) + return + return ..() + +/obj/structure/pumpkin_patch/attackby(obj/item/tool, mob/user) + if(has_vines && (tool.sharp == IS_SHARP_ITEM_ACCURATE || tool.sharp == IS_SHARP_ITEM_BIG)) + to_chat(user, SPAN_NOTICE("You cut down the vines.")) + has_vines = FALSE + update_icon() + if(pumpkin_count < 1 && !has_vines) + qdel(src) + return + return ..() + +/obj/structure/pumpkin_patch/corrupted + icon_prefix = "cor_" + name = "patch of corrupted pumpkins" + pumpkin_type = /obj/item/clothing/head/pumpkin/corrupted diff --git a/code/modules/holidays/halloween/pumpkins/wearable.dm b/code/modules/holidays/halloween/pumpkins/wearable.dm new file mode 100644 index 000000000000..57692c3dfcb5 --- /dev/null +++ b/code/modules/holidays/halloween/pumpkins/wearable.dm @@ -0,0 +1,55 @@ +/// Carved Pumpkin from the Halloween event +/obj/item/clothing/head/pumpkin + name = "pumpkin" + icon = 'icons/misc/events/pumpkins.dmi' + item_icons = list( + WEAR_HEAD = 'icons/misc/events/pumpkins.dmi', + ) + w_class = SIZE_MEDIUM + flags_inventory = COVEREYES|COVERMOUTH + flags_inv_hide = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEALLHAIR + flags_armor_protection = BODY_FLAG_HEAD|BODY_FLAG_EYES + var/prefix = "" //! Icon state prefix for corrupted pumpkin variants + var/carved_icon = "" //! Currently carved pumpkin overlay + var/carvable_icons = list("smile", "cheeky", "bugeyes", "upside_down_smile", "skelly", "ff") + +/obj/item/clothing/head/pumpkin/Initialize(mapload, ...) + . = ..() + update_icon() + +/obj/item/clothing/head/pumpkin/update_icon() + . = ..() + if(carved_icon) + icon_state = "[prefix]pumpkin_carved" + else + icon_state = "[prefix]pumpkin" + item_state_slots = list( + WEAR_HEAD = "[prefix]pumpkin_onmob", + ) + +/obj/item/clothing/head/pumpkin/mob_can_equip(mob/user, slot, disable_warning) + if(slot == WEAR_HEAD && !carved_icon) + to_chat(user, SPAN_WARNING("You can't put on a full pumpkin! Empty and carve it with a sharp object first.")) + return FALSE + . = ..() + +/obj/item/clothing/head/pumpkin/attackby(obj/item/tool, mob/user) + if(!carved_icon && (tool.sharp == IS_SHARP_ITEM_ACCURATE || tool.sharp == IS_SHARP_ITEM_BIG)) + var/choice = tgui_input_list(user, "Select the pattern to carve on your pumpkin!", "Pumpkin Carving", carvable_icons) + if(choice) + carved_icon = choice + name = "carved pumpkin" + update_icon() + else + return ..() + +/obj/item/clothing/head/pumpkin/get_mob_overlay(mob/user_mob, slot) + var/image/pumpkin = ..() + if(carved_icon && slot == WEAR_HEAD) + var/image/overlay = overlay_image(icon, "[prefix]pumpkin_[carved_icon]") + pumpkin.overlays += overlay + return pumpkin + +/obj/item/clothing/head/pumpkin/corrupted + prefix = "cor_" + carvable_icons = list("cry", "sob", "sad", "why", "spooky", "ff") diff --git a/colonialmarines.dme b/colonialmarines.dme index 63140be5e458..7db9fd61375e 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -1694,6 +1694,8 @@ s// DM Environment file for colonialmarines.dme. #include "code\modules\gear_presets\survivors\sorokyne_strata\preset_sorokyne_strata.dm" #include "code\modules\gear_presets\survivors\trijent\crashlanding_upp_bar_insert_trijent.dm" #include "code\modules\gear_presets\survivors\trijent\preset_trijent.dm" +#include "code\modules\holidays\halloween\pumpkins\patches.dm" +#include "code\modules\holidays\halloween\pumpkins\wearable.dm" #include "code\modules\hydroponics\botany_disks.dm" #include "code\modules\hydroponics\grown_inedible.dm" #include "code\modules\hydroponics\hydro_tools.dm" diff --git a/icons/misc/events/pumpkins.dmi b/icons/misc/events/pumpkins.dmi new file mode 100644 index 000000000000..aa78c74c1a36 Binary files /dev/null and b/icons/misc/events/pumpkins.dmi differ