diff --git a/code/datums/keybindings/emote_keybinds.dm b/code/datums/keybindings/emote_keybinds.dm index 793786d269a..3a588ba30ab 100644 --- a/code/datums/keybindings/emote_keybinds.dm +++ b/code/datums/keybindings/emote_keybinds.dm @@ -477,6 +477,10 @@ linked_emote = /datum/emote/living/carbon/human/flap/angry name = "Angry Flap" +/datum/keybinding/emote/carbon/human/wings + linked_emote = /datum/emote/living/carbon/human/wings + name = "Wings" + /datum/keybinding/emote/carbon/human/flutter linked_emote = /datum/emote/living/carbon/human/flutter name = "Flutter" diff --git a/code/modules/mob/living/carbon/human/body_accessories.dm b/code/modules/mob/living/carbon/human/body_accessories.dm index a4b7e5fe7ac..1449fb9cb79 100644 --- a/code/modules/mob/living/carbon/human/body_accessories.dm +++ b/code/modules/mob/living/carbon/human/body_accessories.dm @@ -164,7 +164,7 @@ GLOBAL_LIST_EMPTY(body_accessory_by_species) icon_state = "skrell_fringetail_xlong" allowed_species = list("Skrell") -//Moth wings +// Moth wings /datum/body_accessory/wing icon = 'icons/mob/sprite_accessories/moth/moth_wings.dmi' animated_icon = null @@ -172,6 +172,8 @@ GLOBAL_LIST_EMPTY(body_accessory_by_species) icon_state = "plain" allowed_species = list("Nian") has_behind = TRUE + var/is_open = FALSE + var/open_icon = 'icons/mob/sprite_accessories/moth/moth_wingsopen.dmi' /datum/body_accessory/wing/plain diff --git a/code/modules/mob/living/carbon/human/human_emote.dm b/code/modules/mob/living/carbon/human/human_emote.dm index e799fab21f2..86c3848994e 100644 --- a/code/modules/mob/living/carbon/human/human_emote.dm +++ b/code/modules/mob/living/carbon/human/human_emote.dm @@ -653,12 +653,60 @@ message = "flaps their wings." sound = 'sound/effects/mob_effects/flap.ogg' species_type_whitelist_typecache = list(/datum/species/moth) + var/wing_time = 1 SECONDS + +/datum/emote/living/carbon/human/flap/run_emote(mob/user, params, type_override, intentional) + . = ..() + if(. && ishuman(user)) + var/mob/living/carbon/human/H = user + H.Togglewings() + addtimer(CALLBACK(src, PROC_REF(finish_flap), H), wing_time) + +/datum/emote/living/carbon/human/flap/proc/finish_flap(mob/living/carbon/human/H) + H.Togglewings() /datum/emote/living/carbon/human/flap/angry key = "aflap" key_third_person = "aflaps" sound = 'sound/effects/mob_effects/angryflap.ogg' message = "flaps their wings ANGRILY!" + wing_time = 0.5 SECONDS + +/datum/emote/living/carbon/human/wings + key = "wings" + key_third_person = "wings" + message = "their wings." + +/datum/emote/living/carbon/human/wings/can_run_emote(mob/user, status_check = TRUE, intentional) + . = ..() + if(!..()) + return FALSE + if(!ishuman(user)) + return FALSE + var/mob/living/carbon/human/H = user + if(H.has_status_effect(STATUS_EFFECT_BURNT_WINGS)) + to_chat(H, "Your wings are burnt off!") + return FALSE + if(!H.body_accessory || !istype(H.body_accessory, /datum/body_accessory/wing)) + to_chat(H, "You don't have wings!") + return FALSE + return TRUE + +/datum/emote/living/carbon/human/wings/run_emote(mob/user, params, type_override, intentional) + . = ..() + if(.) + var/mob/living/carbon/human/H = user + H.Togglewings() + +/datum/emote/living/carbon/human/wings/select_message_type(mob/user, intentional) + . = ..() + var/mob/living/carbon/human/H = user + if(H.body_accessory && istype(H.body_accessory, /datum/body_accessory/wing)) + var/datum/body_accessory/wing/wings = H.body_accessory + if(!wings.is_open) + . = "opens " + message + else + . = "closes " + message /datum/emote/living/carbon/human/flutter key = "flutter" diff --git a/code/modules/mob/living/carbon/human/human_mob.dm b/code/modules/mob/living/carbon/human/human_mob.dm index f9447d2212a..3d71a4230f5 100644 --- a/code/modules/mob/living/carbon/human/human_mob.dm +++ b/code/modules/mob/living/carbon/human/human_mob.dm @@ -2303,3 +2303,22 @@ Eyes need to have significantly high darksight to shine unless the mob has the X /mob/living/carbon/human/get_strippable_items(datum/source, list/items) items |= GLOB.strippable_human_items + +/// Used to toggle whether wings are open or not +/mob/living/carbon/human/proc/Togglewings() + if(has_status_effect(STATUS_EFFECT_BURNT_WINGS)) + to_chat(src, "Your wings are burnt off!") + return + + if(body_accessory && istype(body_accessory, /datum/body_accessory/wing)) + var/datum/body_accessory/wing/wings = body_accessory + if(wings.is_open) + wings.is_open = FALSE + wings.icon = initial(wings.icon) + wings.pixel_x_offset = initial(wings.pixel_x_offset) + update_wing_layer() + return + wings.is_open = TRUE + wings.icon = wings.open_icon + wings.pixel_x_offset = -22 // Center these bad boys + update_wing_layer() diff --git a/code/modules/mob/living/carbon/human/species/moth.dm b/code/modules/mob/living/carbon/human/species/moth.dm index 237e1b26e53..1db51ffffd0 100644 --- a/code/modules/mob/living/carbon/human/species/moth.dm +++ b/code/modules/mob/living/carbon/human/species/moth.dm @@ -118,14 +118,26 @@ if(isobj(H.loc)) // Can't fly if you're in a box/mech/whatever. return FALSE + // Open your wings to fly + if(H.body_accessory && istype(H.body_accessory, /datum/body_accessory/wing)) + var/datum/body_accessory/wing/wings = H.body_accessory + if(!wings.is_open) + return FALSE var/turf/T = get_turf(H) var/datum/gas_mixture/current = T.get_readonly_air() if(current && (current.return_pressure() >= ONE_ATMOSPHERE * 0.85)) //as long as there's reasonable pressure and no gravity, flight is possible return TRUE /datum/species/moth/spec_thunk(mob/living/carbon/human/H) - if(!H.has_status_effect(STATUS_EFFECT_BURNT_WINGS)) - return TRUE + if(H.has_status_effect(STATUS_EFFECT_BURNT_WINGS)) + return FALSE + + if(H.body_accessory && istype(H.body_accessory, /datum/body_accessory/wing)) + var/datum/body_accessory/wing/wings = H.body_accessory + if(!wings.is_open) + return FALSE + + return TRUE /datum/species/moth/spec_movement_delay() return FALSE diff --git a/icons/mob/sprite_accessories/moth/moth_wingsopen.dmi b/icons/mob/sprite_accessories/moth/moth_wingsopen.dmi new file mode 100644 index 00000000000..5dbb0f1db2b Binary files /dev/null and b/icons/mob/sprite_accessories/moth/moth_wingsopen.dmi differ