From 0efe89a6fbb2ea7fa5f610704bdfa40a2759ea9a Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 30 Apr 2021 14:09:48 +0200 Subject: [PATCH] [MIRROR] Converts space carps to GAGS (#5356) * Converts space carps to GAGS (#58710) * Converts space carps to GAGS Co-authored-by: Arkatos1 <43862960+Arkatos1@users.noreply.github.com> --- code/datums/greyscale/greyscale_configs.dm | 7 ++ code/datums/greyscale/json_configs/carp.json | 28 +++++ .../json_configs/carp_disk_mouth.json | 10 ++ .../mob/living/simple_animal/hostile/carp.dm | 110 ++++++++---------- 4 files changed, 96 insertions(+), 59 deletions(-) create mode 100644 code/datums/greyscale/json_configs/carp.json create mode 100644 code/datums/greyscale/json_configs/carp_disk_mouth.json diff --git a/code/datums/greyscale/greyscale_configs.dm b/code/datums/greyscale/greyscale_configs.dm index e013d179ff0..c47b918157b 100644 --- a/code/datums/greyscale/greyscale_configs.dm +++ b/code/datums/greyscale/greyscale_configs.dm @@ -21,6 +21,13 @@ icon_file = 'icons/obj/atmospherics/prototype_canister.dmi' json_config = 'code/datums/greyscale/json_configs/canister_proto.json' +/datum/greyscale_config/carp + icon_file = 'icons/mob/carp.dmi' + json_config = 'code/datums/greyscale/json_configs/carp.json' + +/datum/greyscale_config/carp/disk_mouth + json_config = 'code/datums/greyscale/json_configs/carp_disk_mouth.json' + /datum/greyscale_config/wirecutters icon_file = 'icons/obj/tools.dmi' json_config = 'code/datums/greyscale/json_configs/wirecutters.json' diff --git a/code/datums/greyscale/json_configs/carp.json b/code/datums/greyscale/json_configs/carp.json new file mode 100644 index 00000000000..d01fda5a9ee --- /dev/null +++ b/code/datums/greyscale/json_configs/carp.json @@ -0,0 +1,28 @@ +{ + "base": [ + { + "type": "icon_state", + "icon_state": "base", + "blend_mode": "overlay", + "color_ids": [ 1 ] + }, + { + "type": "icon_state", + "icon_state": "base_mouth", + "blend_mode": "overlay" + } + ], + "base_dead": [ + { + "type": "icon_state", + "icon_state": "base_dead", + "blend_mode": "overlay", + "color_ids": [ 1 ] + }, + { + "type": "icon_state", + "icon_state": "base_dead_mouth", + "blend_mode": "overlay" + } + ] +} diff --git a/code/datums/greyscale/json_configs/carp_disk_mouth.json b/code/datums/greyscale/json_configs/carp_disk_mouth.json new file mode 100644 index 00000000000..1068e83cd41 --- /dev/null +++ b/code/datums/greyscale/json_configs/carp_disk_mouth.json @@ -0,0 +1,10 @@ +{ + "": [ + { + "type": "icon_state", + "icon_state": "disk_mouth", + "blend_mode": "overlay", + "color_ids": [ 1 ] + } + ] +} diff --git a/code/modules/mob/living/simple_animal/hostile/carp.dm b/code/modules/mob/living/simple_animal/hostile/carp.dm index 56e8a186aa9..988aabe3712 100644 --- a/code/modules/mob/living/simple_animal/hostile/carp.dm +++ b/code/modules/mob/living/simple_animal/hostile/carp.dm @@ -26,7 +26,6 @@ bonus_tame_chance = 5 search_objects = 1 wanted_objects = list(/obj/item/storage/cans) - harm_intent_damage = 8 obj_damage = 50 melee_damage_lower = 20 @@ -36,7 +35,6 @@ attack_sound = 'sound/weapons/bite.ogg' attack_vis_effect = ATTACK_EFFECT_BITE speak_emote = list("gnashes") - //Space carp aren't affected by cold. atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 @@ -45,70 +43,62 @@ is_flying_animal = TRUE pressure_resistance = 200 gold_core_spawnable = HOSTILE_SPAWN - var/random_color = TRUE //if the carp uses random coloring - var/rarechance = 1 //chance for rare color variant - var/snack_distance = 0 - - var/static/list/carp_colors = list(\ - "lightpurple" = "#c3b9f1", \ - "lightpink" = "#da77a8", \ - "green" = "#70ff25", \ - "grape" = "#df0afb", \ - "swamp" = "#e5e75a", \ - "turquoise" = "#04e1ed", \ - "brown" = "#ca805a", \ - "teal" = "#20e28e", \ - "lightblue" = "#4d88cc", \ - "rusty" = "#dd5f34", \ - "beige" = "#bbaeaf", \ - "yellow" = "#f3ca4a", \ - "blue" = "#09bae1", \ - "palegreen" = "#7ef099", \ + /// If the carp uses random coloring + var/random_color = TRUE + /// The chance for a rare color variant + var/rarechance = 1 + /// List of usual carp colors + var/static/list/carp_colors = list( + "lightpurple" = "#aba2ff", + "lightpink" = "#da77a8", + "green" = "#70ff25", + "grape" = "#df0afb", + "swamp" = "#e5e75a", + "turquoise" = "#04e1ed", + "brown" = "#ca805a", + "teal" = "#20e28e", + "lightblue" = "#4d88cc", + "rusty" = "#dd5f34", + "lightred" = "#fd6767", + "yellow" = "#f3ca4a", + "blue" = "#09bae1", + "palegreen" = "#7ef099" ) - var/static/list/carp_colors_rare = list(\ - "silver" = "#fdfbf3", \ + /// List of rare carp colors + var/static/list/carp_colors_rare = list( + "silver" = "#fdfbf3" ) /mob/living/simple_animal/hostile/carp/Initialize(mapload) + if(random_color) + set_greyscale_config(/datum/greyscale_config/carp) + carp_randomify(rarechance) . = ..() ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT) add_cell_sample() - carp_randomify(rarechance) /mob/living/simple_animal/hostile/carp/add_cell_sample() AddElement(/datum/element/swabable, CELL_LINE_TABLE_CARP, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5) +/** + * Randomly assigns a color to a carp from either a common or rare color variant lists + * + * Arguments: + * * rare The chance of the carp receiving color from the rare color variant list + */ /mob/living/simple_animal/hostile/carp/proc/carp_randomify(rarechance) - if(random_color) - var/our_color - if(prob(rarechance)) - our_color = pick(carp_colors_rare) - add_atom_colour(carp_colors_rare[our_color], FIXED_COLOUR_PRIORITY) - else - our_color = pick(carp_colors) - add_atom_colour(carp_colors[our_color], FIXED_COLOUR_PRIORITY) - regenerate_icons() - -/mob/living/simple_animal/hostile/carp/death(gibbed) - . = ..() - cut_overlays() - if(!random_color || gibbed) - return - regenerate_icons() + var/our_color + if(prob(rarechance)) + our_color = pick(carp_colors_rare) + set_greyscale_colors(list(carp_colors_rare[our_color])) + else + our_color = pick(carp_colors) + set_greyscale_colors(list(carp_colors[our_color])) /mob/living/simple_animal/hostile/carp/revive(full_heal = FALSE, admin_revive = FALSE) . = ..() if(.) - regenerate_icons() - -/mob/living/simple_animal/hostile/carp/regenerate_icons() - cut_overlays() - if(!random_color) - return - var/mutable_appearance/base_overlay = mutable_appearance(icon, stat == DEAD ? "base_dead_mouth" : "base_mouth") - base_overlay.appearance_flags = RESET_COLOR - add_overlay(base_overlay) - ..() + update_icon() /mob/living/simple_animal/hostile/carp/proc/chomp_plastic() var/obj/item/storage/cans/tasty_plastic = locate(/obj/item/storage/cans) in view(1, src) @@ -238,9 +228,14 @@ pet_bonus_emote = "bloops happily!" /// Keeping track of the nuke disk for the functionality of storing it. var/obj/item/disk/nuclear/disky + /// Location of the file storing disk overlays + var/icon/disk_overlay_file = 'icons/mob/carp.dmi' + /// Colored disk mouth appearance for adding it as a mouth overlay + var/mutable_appearance/colored_disk_mouth /mob/living/simple_animal/hostile/carp/cayenne/Initialize() . = ..() + colored_disk_mouth = mutable_appearance(SSgreyscale.GetColoredIconByType(/datum/greyscale_config/carp/disk_mouth, greyscale_colors)) ADD_TRAIT(src, TRAIT_DISK_VERIFIER, INNATE_TRAIT) //carp can verify disky ADD_TRAIT(src, TRAIT_ADVANCEDTOOLUSER, INNATE_TRAIT) //carp SMART @@ -267,7 +262,7 @@ potential_disky.forceMove(src) disky = potential_disky to_chat(src, "YES!! You manage to pick up [disky]. (Click anywhere to place it back down.)") - regenerate_icons() + update_icon() if(!disky.fake) client.give_award(/datum/award/achievement/misc/cayenne_disk, src) return @@ -276,7 +271,7 @@ to_chat(src, "You place [disky] on [attacked_target]") disky.forceMove(attacked_target.drop_location()) disky = null - regenerate_icons() + update_icon() else disky.melee_attack_chain(src, attacked_target) return @@ -286,16 +281,13 @@ . = ..() if(AM == disky) disky = null - regenerate_icons() + update_icon() -/mob/living/simple_animal/hostile/carp/cayenne/regenerate_icons() +/mob/living/simple_animal/hostile/carp/cayenne/update_overlays() . = ..() if(!disky || stat == DEAD) return - cut_overlays() - add_overlay("disk_mouth") - var/mutable_appearance/disk_overlay = mutable_appearance(icon, "disk_overlay") - disk_overlay.appearance_flags = RESET_COLOR - add_overlay(disk_overlay) + . += colored_disk_mouth + . += mutable_appearance(disk_overlay_file, "disk_overlay") #undef REGENERATION_DELAY