diff --git a/baystation12.dme b/baystation12.dme index 4b09d73694e..ceb80e8e3b6 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -2179,6 +2179,7 @@ #include "code\modules\mob\living\carbon\human\human_defense.dm" #include "code\modules\mob\living\carbon\human\human_defines.dm" #include "code\modules\mob\living\carbon\human\human_helpers.dm" +#include "code\modules\mob\living\carbon\human\human_jump.dm" #include "code\modules\mob\living\carbon\human\human_movement.dm" #include "code\modules\mob\living\carbon\human\human_organs.dm" #include "code\modules\mob\living\carbon\human\human_powers.dm" diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index aa8b4ef91ed..ad0e0202bd6 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -77,6 +77,7 @@ // Movement flags. For fuck's sake, we were using "run"s and "walk"s till 2021 #define M_RUN "run" #define M_WALK "walk" +#define HUMAN_POWER_JUMP "jump" //These are used Bump() code for living mobs, in the mob_bump_flag, mob_swap_flags, and mob_push_flags vars to determine whom can bump/swap with whom. #define HUMAN 1 diff --git a/code/__defines/sound.dm b/code/__defines/sound.dm index 1ef8579e80b..09268baa122 100644 --- a/code/__defines/sound.dm +++ b/code/__defines/sound.dm @@ -92,6 +92,7 @@ #define SFX_FEMALE_LAUGH "female_laugh" #define SFX_FEMALE_YAWN "female_yawn" #define SFX_FEMALE_SIGH "female_sigh" +#define SFX_FEMALE_JUMP "female_jump" // MALE EMOTES #define SFX_MALE_INTERNAL_BREATH "male_internal_breath" @@ -106,6 +107,7 @@ #define SFX_MALE_LAUGH "male_laugh" #define SFX_MALE_YAWN "male_yawn" #define SFX_MALE_SIGH "male_sigh" +#define SFX_MALE_JUMP "male_jump" // AMBIENT #define SFX_AMBIENT_POWERED_GLOBAL "ambient_powered_global" diff --git a/code/_global_vars/sfx.dm b/code/_global_vars/sfx.dm index edb2d12c59a..30a950fa9e8 100644 --- a/code/_global_vars/sfx.dm +++ b/code/_global_vars/sfx.dm @@ -1856,5 +1856,11 @@ GLOBAL_LIST_INIT(sfx_list, list( ), SFX_MINESWEEPER_WIN = list( 'sound/machines/arcade/minesweeper_win.ogg' - ) + ), + SFX_FEMALE_JUMP = list( + 'sound/effects/emotes/f_jump.ogg' + ), + SFX_MALE_JUMP = list( + 'sound/effects/emotes/m_jump.ogg' + ), )) diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index 3e463abefc8..07e4d6e8754 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -142,9 +142,10 @@ #define ui_spell_master "EAST-1:16,NORTH-1:16" #define ui_genetic_master "EAST-1:16,NORTH-3:16" -//Blocking and dashing +//Blocking, dashing and jumping #define ui_block "EAST-4:24,SOUTH:5" #define ui_blockswitch "EAST-4:24,SOUTH:5" +#define ui_jump "EAST-4:24,SOUTH+1:5" // AI #define ui_ai_core "SOUTH:6,WEST" diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 830ca0a55bd..764d1177f5d 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -188,6 +188,16 @@ mymob.block_icon.alpha = ui_alpha static_inventory += mymob.block_icon + if(hud_data.has_jump) + mymob.jump_icon = new /atom/movable/screen() + mymob.jump_icon.icon = ui_style + mymob.jump_icon.icon_state = "act_jump0" + mymob.jump_icon.SetName("jump") + mymob.jump_icon.screen_loc = ui_jump + mymob.jump_icon.color = ui_color + mymob.jump_icon.alpha = ui_alpha + static_inventory += mymob.jump_icon + if(hud_data.has_blockswitch) mymob.blockswitch_icon = new /atom/movable/screen() mymob.blockswitch_icon.icon = ui_style diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index a9c60e87468..5346ed1849d 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -383,6 +383,12 @@ var/mob/living/carbon/human/H = usr H.blockswitch() + if("jump") + if(ishuman(usr)) + var/mob/living/carbon/human/H = usr + H.toggle_jump(HUMAN_POWER_JUMP) + + if("module") if(isrobot(usr)) var/mob/living/silicon/robot/R = usr diff --git a/code/modules/emotes/generic/audible.dm b/code/modules/emotes/generic/audible.dm index 061b89fc67b..5979236e069 100644 --- a/code/modules/emotes/generic/audible.dm +++ b/code/modules/emotes/generic/audible.dm @@ -715,3 +715,23 @@ set name = "Whistle" set category = "Emotes" emote("whistle") + +/datum/emote/jump + key = "jump" + + message_1p = "You jump." + message_3p = "jumps." + + message_type = AUDIBLE_MESSAGE + + sound_human_female = SFX_FEMALE_JUMP + sound_human_male = SFX_MALE_JUMP + + state_checks = EMOTE_CHECK_CONSCIOUS + + statpanel_proc = /mob/proc/jump_emote + +/mob/proc/jump_emote() + set name = "Jump" + set category = "Emotes" + emote("jump", intentional = TRUE) diff --git a/code/modules/emotes/generic/visual.dm b/code/modules/emotes/generic/visual.dm index a4855b3e963..7a43f245aac 100644 --- a/code/modules/emotes/generic/visual.dm +++ b/code/modules/emotes/generic/visual.dm @@ -337,25 +337,6 @@ set category = "Emotes" emote("roll", intentional = TRUE) - -/datum/emote/jump - key = "jump" - - message_1p = "You jump." - message_3p = "jumps!" - - message_type = VISIBLE_MESSAGE - - state_checks = EMOTE_CHECK_CONSCIOUS - - statpanel_proc = /mob/proc/jump_emote - -/mob/proc/jump_emote() - set name = "Jump" - set category = "Emotes" - emote("jump", intentional = TRUE) - - /datum/emote/bow key = "bow" diff --git a/code/modules/mob/living/carbon/human/human_jump.dm b/code/modules/mob/living/carbon/human/human_jump.dm new file mode 100644 index 00000000000..1e567b8744f --- /dev/null +++ b/code/modules/mob/living/carbon/human/human_jump.dm @@ -0,0 +1,134 @@ +#define NO_HURT_JUMP_PROB 15 +#define LITE_HURT_PROB 60 +#define KNOCK_DOWN_PROB 40 +#define HURT_LEGS_PROB 1 + +#define LONG_JUMP_PROB 25 +#define MAX_JUMP_LENGTH 3 +#define DEFAULT_JUMP_LENGTH 2 + +#define SALTO_PROB 10 + + +/mob/living/carbon/human/throw_impact(atom/hit_atom, speed, target_zone) + . = ..() + var/jump_in_spaceman = FALSE + + if (hit_atom.density) + if (ishuman(hit_atom)) + jump_in_spaceman = TRUE + var/mob/living/carbon/human/jump_target_human = hit_atom + + playsound(src, SFX_FIGHTING_PUNCH, 25, 0, 1) + do_attack_animation(jump_target_human) + + if (prob(KNOCK_DOWN_PROB)) + jump_target_human.apply_damage(10, BRUTE) + jump_target_human.Weaken(2) + visible_message(SPAN_NOTICE("[src] was knokout [hit_atom.name] in jump!.")) + + else + jump_target_human.apply_damage(5, BRUTE) + jump_target_human.Stun(1) + + if (prob(NO_HURT_JUMP_PROB) && jump_in_spaceman == FALSE) + to_chat(src, SPAN_WARNING("You jumped into [hit_atom.name]. It's lucky you weren't hurt.")) + return + + if (prob(LITE_HURT_PROB)) + Stun(3) + adjustBruteLoss(10) + to_chat(src, SPAN_WARNING("You jumped into [hit_atom.name]. It must have hurt.")) + + else + Weaken(5) + adjustBruteLoss(20) + to_chat(src, SPAN_WARNING("Jumping into the [hit_atom.name] knocked the wind out of you")) + +/mob/living/carbon/human/proc/toggle_jump() + if (!src || src.stat) + return + + if (jump_icon?.icon_state == "act_jump0") + jump_icon?.icon_state = "act_jump1" + src.active_ability = HUMAN_POWER_JUMP + else + jump_icon?.icon_state = "act_jump0" + src.active_ability = HUMAN_POWER_NONE + +/mob/living/carbon/human/proc/process_jump(atom/A) + if (QDELETED(A) || QDELETED(src) || A.z != z) + return + + if (A == src || A == loc || lying || pulledby || LAZYLEN(grabbed_by)) + to_chat(src, SPAN_WARNING("You can't jump right now")) + toggle_jump(HUMAN_POWER_JUMP) + return + + if (buckled) + to_chat(src, SPAN_WARNING("You need to unbuckle first")) + toggle_jump(HUMAN_POWER_JUMP) + return + + if (poise < (poise_pool / 2)) + to_chat(src, SPAN_WARNING("Not enough balance!")) + toggle_jump(HUMAN_POWER_JUMP) + return + + setClickCooldown(DEFAULT_ATTACK_COOLDOWN) + face_atom(A) + var/jump_distance = MAX_JUMP_LENGTH + var/jump_turf = src.loc + + for (var/i = 0, i < jump_distance, i++) + jump_turf = get_step(jump_turf, dir) + + if (!jump_turf || jump_turf == loc) + return + + playsound(src, src.gender == MALE ? SFX_MALE_JUMP : SFX_FEMALE_JUMP, 25, 0, 1) + visible_message(SPAN_NOTICE("[src] jumps to [A].")) + damage_poise(body_build.poise_pool / 2) + throw_spin = FALSE + + if (prob(SALTO_PROB)) + throw_spin = TRUE + visible_message(SPAN_NOTICE("[src] did a somersault!.")) + else + throw_spin = FALSE + + var/orig_flags = src.pass_flags + src.pass_flags |= PASS_FLAG_TABLE + + src.pixel_y = 5 + + if (prob(LONG_JUMP_PROB)) + throw_at(jump_turf, MAX_JUMP_LENGTH, 1.25, src) + Stun(1) + else + throw_at(jump_turf, DEFAULT_JUMP_LENGTH, 1.25, src) + Stun(1) + + if (QDELETED(src)) + return + + if (prob(HURT_LEGS_PROB)) + var/legs_to_hurt = pick(BP_L_FOOT, BP_R_FOOT) + src.apply_damage(45, PAIN, legs_to_hurt, 0) + src.apply_damage(10, BRUTE, legs_to_hurt, 0) + visible_message(SPAN_NOTICE("[src] jumped unsuccessfully and hurt foot!")) + + spawn(2) + src.pass_flags = orig_flags + src.pixel_y = 0 + throw_spin = TRUE + toggle_jump(HUMAN_POWER_JUMP) + +#undef NO_HURT_JUMP_PROB +#undef LITE_HURT_PROB +#undef KNOCK_DOWN_PROB +#undef HURT_LEGS_PROB +#undef LONG_JUMP_PROB +#undef MAX_JUMP_LENGTH +#undef DEFAULT_JUMP_LENGTH +#undef SALTO_PROB diff --git a/code/modules/mob/living/carbon/human/human_powers.dm b/code/modules/mob/living/carbon/human/human_powers.dm index 1d36125ded3..f6983e91973 100644 --- a/code/modules/mob/living/carbon/human/human_powers.dm +++ b/code/modules/mob/living/carbon/human/human_powers.dm @@ -2,20 +2,23 @@ // species.dm's inherent_verbs ~ Z /mob/living/carbon/human/proc/use_human_ability(atom/A) - if(!isliving(A)) + if (!isliving(A) && active_ability != HUMAN_POWER_JUMP) return FALSE - switch(active_ability) - if(HUMAN_POWER_NONE) + + switch (active_ability) + if (HUMAN_POWER_NONE) return FALSE - if(HUMAN_POWER_SPIT) + if (HUMAN_POWER_SPIT) var/mob/living/M = A process_spit(M) - if(HUMAN_POWER_LEAP) + if (HUMAN_POWER_LEAP) var/mob/living/M = A process_leap(M) - if(HUMAN_POWER_TACKLE) + if (HUMAN_POWER_TACKLE) var/mob/living/M = A process_tackle(M) + if (HUMAN_POWER_JUMP) + process_jump(A) return TRUE /mob/living/carbon/human/MiddleClickOn(atom/A) diff --git a/code/modules/mob/living/carbon/human/species/species_hud.dm b/code/modules/mob/living/carbon/human/species/species_hud.dm index 886999c6696..697cd5762ba 100644 --- a/code/modules/mob/living/carbon/human/species/species_hud.dm +++ b/code/modules/mob/living/carbon/human/species/species_hud.dm @@ -20,6 +20,7 @@ var/has_internals = TRUE // Set to draw the internals toggle button. var/has_rest = TRUE // Set to draw the rest button. var/has_poise = TRUE // Set to draw the poise meter. + var/has_jump = TRUE var/list/equip_slots = list() // Checked by mob_can_equip(). // Contains information on the position and tag for all inventory slots diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 3aaad3c0a4d..f645f8cfed4 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -53,6 +53,7 @@ var/atom/movable/screen/block_icon = null var/atom/movable/screen/blockswitch_icon = null var/atom/movable/screen/nutrition_icon = null + var/atom/movable/screen/jump_icon = null var/atom/movable/screen/hydration_icon = null var/atom/movable/screen/bladder_icon = null var/atom/movable/screen/bowels_icon = null diff --git a/icons/hud/style/goon.dmi b/icons/hud/style/goon.dmi index f2d5580a3f8..d2743169dae 100644 Binary files a/icons/hud/style/goon.dmi and b/icons/hud/style/goon.dmi differ diff --git a/icons/hud/style/midnight.dmi b/icons/hud/style/midnight.dmi index 1f660a7e56e..fff7b36e080 100644 Binary files a/icons/hud/style/midnight.dmi and b/icons/hud/style/midnight.dmi differ diff --git a/icons/hud/style/minimalist.dmi b/icons/hud/style/minimalist.dmi index f36093a07e2..9149c5344ff 100644 Binary files a/icons/hud/style/minimalist.dmi and b/icons/hud/style/minimalist.dmi differ diff --git a/icons/hud/style/old-noborder.dmi b/icons/hud/style/old-noborder.dmi index de431bfd3f2..114bbabf553 100644 Binary files a/icons/hud/style/old-noborder.dmi and b/icons/hud/style/old-noborder.dmi differ diff --git a/icons/hud/style/old.dmi b/icons/hud/style/old.dmi index 69f8bee5ae7..c128df8bcf8 100644 Binary files a/icons/hud/style/old.dmi and b/icons/hud/style/old.dmi differ diff --git a/icons/hud/style/orange.dmi b/icons/hud/style/orange.dmi index a0adcc29a94..60774a7ae79 100644 Binary files a/icons/hud/style/orange.dmi and b/icons/hud/style/orange.dmi differ diff --git a/icons/hud/style/white.dmi b/icons/hud/style/white.dmi index 398e88faa98..aa668ddca04 100644 Binary files a/icons/hud/style/white.dmi and b/icons/hud/style/white.dmi differ diff --git a/sound/effects/emotes/f_jump.ogg b/sound/effects/emotes/f_jump.ogg new file mode 100644 index 00000000000..1034f0d720e Binary files /dev/null and b/sound/effects/emotes/f_jump.ogg differ diff --git a/sound/effects/emotes/m_jump.ogg b/sound/effects/emotes/m_jump.ogg new file mode 100644 index 00000000000..c218745bd99 Binary files /dev/null and b/sound/effects/emotes/m_jump.ogg differ diff --git a/sound/effects/f_jump.ogg b/sound/effects/f_jump.ogg new file mode 100644 index 00000000000..1034f0d720e Binary files /dev/null and b/sound/effects/f_jump.ogg differ diff --git a/sound/effects/m_jump.ogg b/sound/effects/m_jump.ogg new file mode 100644 index 00000000000..c218745bd99 Binary files /dev/null and b/sound/effects/m_jump.ogg differ