Skip to content

Commit

Permalink
Выбиваем дыхалку, добавляем сообщения, добавляем хлопки
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantornRU committed Jan 20, 2024
1 parent db5392a commit 245a1f8
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 23 deletions.
100 changes: 77 additions & 23 deletions modular_ss220/ranks/code/exercise/pushup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ Verbs related to getting fucking jacked, bro
mob_type_allowed_typecache = list(/mob/living, /mob/dead/observer)
mob_type_blacklist_typecache = list(/mob/living/brain, /mob/camera, /mob/living/silicon/ai)
mob_type_ignore_stat_typecache = list(/mob/dead/observer)
var/stamina_border_max = 100
var/oxy_border_max = 100
var/stamina_border_max = 95 // 100 - стаминакрит сбрасывающий анимацию
var/oxy_border_max = 175
var/staminaloss_per_pushup = 5
var/physical_job_mod = 5
var/pushap_div = 4 // деление чтобы игроки могли в общем счете сделать больше АЧЖУМАНИЙ


/datum/emote/pushup/run_emote(mob/user, params, type_override, intentional)
Expand Down Expand Up @@ -57,25 +58,32 @@ Verbs related to getting fucking jacked, bro
L.forced_look = WEST
user.visible_message(span_notice("[user] принял упор лежа."), span_notice("Вы приняли упор лежа."), span_notice("Вы слышите шорох."))

var/choice = tgui_input_list(user, "Отжимание с каким упором?", "Отжимания", list("На ноги и руки", "На колени", "На одной руке"), 60 SECONDS)
var/choice = tgui_input_list(user, "Отжимание с каким упором?", "Отжимания", list("На ноги и руки", "На колени", "На одной руке", "С хлопком", "На одной руке с хлопком"), 60 SECONDS)
switch(choice)
if("На ноги и руки")
user.visible_message(span_notice("[user] перенес свой вес на руки и ноги."), span_notice("Вы переносите свой вес на руки и ноги"), span_notice("Вы слышите шорох."))
execute_pushups(user, on_knees = FALSE)
execute_pushups(user, intentional)
if("На колени")
user.visible_message(span_notice("[user] переносит свой вес на колени. Жалкое зрелище."), span_notice("Вы сместили вес на колени. СЛАБАК!"), span_notice("Вы слышите шорох."))
execute_pushups(user, on_knees = TRUE)
execute_pushups(user, intentional, on_knees = TRUE)
if("На одной руке")
user.visible_message(span_boldnotice("[user] перенес свой вес на ОДНУ РУКУ! Мощно!"), span_boldnotice("Вы переносите свой вес на одну руку. Сильно!"), span_notice("Вы слышите шорох."))
execute_pushups(user, on_knees = FALSE, one_arm = TRUE)
execute_pushups(user, intentional, one_arm = TRUE)
if("С хлопком")
user.visible_message(span_boldnotice("[user] перенес свой вес на руки и ноги и приготовился для хлопков! Стильно!"), span_boldnotice("Вы переносите свой вес на руки и ноги и приготовились для хлопков. Стильно!"), span_notice("Вы слышите шорох."))
execute_pushups(user, intentional, clap = TRUE)
if("На одной руке с хлопком")
user.visible_message(span_boldnotice("[user] перенес свой вес на ОДНУ РУКУ и приготовил вторую для ХЛОПКА! НЕВЕРОЯТНО!"), span_boldnotice("Вы переносите свой вес на одну руку, а вторую приготовили для хлопка. Невероятно!"), span_notice("Вы слышите шорох."))
execute_pushups(user, intentional, clap = TRUE, one_arm = TRUE)

else
if(L)
L.clear_forced_look(quiet = TRUE)
return
if(L)
L.clear_forced_look(quiet = TRUE)

/datum/emote/pushup/proc/execute_pushups(mob/user, on_knees = FALSE, one_arm = FALSE)
/datum/emote/pushup/proc/execute_pushups(mob/user, intentional, on_knees = FALSE, one_arm = FALSE, clap = FALSE)
if(!can_do_pushup(user))
return

Expand All @@ -94,15 +102,24 @@ Verbs related to getting fucking jacked, bro
while(currentloss < borderloss)
if(!can_do_pushup(user))
return
pushup_value = calculate_valueloss_per_pushup(user, on_knees, one_arm)
if(!user.PushupAnimation())
currentloss = L.getStaminaLoss() + L.getOxyLoss()
pushup_value = calculate_valueloss_per_pushup(user, on_knees, one_arm, clap)
var/time_mod = 1 - round(L.getOxyLoss() / 300, 0.05)
if(!user.PushupAnimation(time_mod))
user.visible_message(span_notice("[user] прекратил отжиматься."), span_notice("Вы прекратили отжиматься."), span_notice("Вы слишите шорох."))
return
pushups_in_a_row++
var/message_oxy = L.getOxyLoss() >= 0 ? " с тяжелой отдышкой" : ""
user.visible_message(span_boldnotice("[user] отжимается[message_oxy] - [pushups_in_a_row] раз!"), span_boldnotice("Вы отжимаетесь[message_oxy] - [pushups_in_a_row] раз!"), span_notice("Вы слышите отдышку и шорох."))
L.adjustStaminaLoss(pushup_value)
if(L.getStaminaLoss() >= stamina_border_max)

var/pushup_text = get_pushup_message_addition(L, on_knees, one_arm, clap)
user.visible_message(span_boldnotice("[user] отжимается[pushup_text] - [pushups_in_a_row] раз!"), span_boldnotice("Вы отжимаетесь[pushup_text] - [pushups_in_a_row] раз!"), span_notice("Вы слышите отдышку и шорох."))

if(clap)
clap_pushup(L, intentional)

if((L.getStaminaLoss() + pushup_value) < stamina_border_max)
L.adjustStaminaLoss(pushup_value)
else
L.setStaminaLoss(stamina_border_max)
L.adjustOxyLoss(pushup_value)
if(currentloss >= borderloss)
to_chat(user, span_warning("Вы обессиленные падаете на пол..."))
Expand All @@ -123,11 +140,11 @@ Verbs related to getting fucking jacked, bro
dir = WEST
matrix.Turn(270)

/atom/proc/PushupAnimation()
/atom/proc/PushupAnimation(time_mod = 1)
var/target_y = -5
var/delay = 0.6 SECONDS
var/time_low = 0.2 SECONDS
var/time_hight = 0.8 SECONDS
var/delay = 0.6 SECONDS * time_mod
var/time_low = 0.2 SECONDS * time_mod
var/time_hight = 0.8 SECONDS * time_mod
animate(src, pixel_y = target_y, time = time_hight, easing = QUAD_EASING) //down to the floor
if(!do_after(src, delay, TRUE))
animate(src, pixel_y = 0, time = time_low, easing = QUAD_EASING)
Expand All @@ -151,10 +168,6 @@ Verbs related to getting fucking jacked, bro
to_chat(user, span_warning("Вы не в том положении для отжиманий! Лягте на пол!"))
return FALSE

if(L.getStaminaLoss() >= stamina_border_max)
to_chat(user, span_warning("Вы чувствуете слабость!"))
return FALSE

if(!isturf(user.loc))
to_chat(user, span_warning("Не на что опереться!"))
return FALSE
Expand All @@ -181,7 +194,7 @@ Verbs related to getting fucking jacked, bro
return TRUE


/datum/emote/pushup/proc/calculate_valueloss_per_pushup(mob/living/user, on_knees = FALSE, one_arm = FALSE)
/datum/emote/pushup/proc/calculate_valueloss_per_pushup(mob/living/user, on_knees = FALSE, one_arm = FALSE, clap = FALSE)
//humans have 120 stamina
//default loss per pushup = 5 stamina
if(ismachineperson(user) || isskeleton(user))
Expand All @@ -199,6 +212,8 @@ Verbs related to getting fucking jacked, bro
valueloss -= 2
if(one_arm)
valueloss += 4
if(clap)
valueloss += 4

if(!ishuman(user))
return max(1, valueloss)
Expand Down Expand Up @@ -277,4 +292,43 @@ Verbs related to getting fucking jacked, bro
if(isdiona(user))
valueloss /= 5

return max(0.5, valueloss)
return max(0.1, valueloss / pushap_div)

/datum/emote/pushup/proc/get_pushup_message_addition(mob/living/L, on_knees = FALSE, one_arm = FALSE, clap = FALSE)
var/message_part = ""
if(on_knees)
message_part = " на коленях"
if(one_arm)
message_part = " на одной руке"
if(clap)
message_part += " с хлопком"
var/message_oxy = ""
switch(L.getOxyLoss())
if(20 to 50)
message_oxy = " с одышкой"
if(51 to 100)
message_oxy = " с тяжелой одышкой"
if(101 to 130)
message_oxy = " весь покраснев и выпучив глаза"
if(131 to INFINITY)
message_oxy = ", еле держась на руках и прикрыв глаза"
return "[message_part][message_oxy]"

/datum/emote/pushup/proc/clap_pushup(mob/user, intentional)
var/clap_sound = pick(
'modular_ss220/ranks/sounds/claps/clap1.ogg',
'modular_ss220/ranks/sounds/claps/clap2.ogg',
'modular_ss220/ranks/sounds/claps/clap3.ogg',
'modular_ss220/ranks/sounds/claps/clap4.ogg',
'modular_ss220/ranks/sounds/claps/clap5.ogg',
'modular_ss220/ranks/sounds/claps/clap6.ogg',
'modular_ss220/ranks/sounds/claps/clap7.ogg',
'modular_ss220/ranks/sounds/claps/clap8.ogg',
'modular_ss220/ranks/sounds/claps/clap9.ogg',
'modular_ss220/ranks/sounds/claps/clap10.ogg',
'modular_ss220/ranks/sounds/claps/clap11.ogg',
'modular_ss220/ranks/sounds/claps/clap12.ogg',
'modular_ss220/ranks/sounds/claps/clap13.ogg',
'modular_ss220/ranks/sounds/claps/clap14.ogg',
)
play_sound_effect(user, intentional, clap_sound, get_volume(user))
Binary file added modular_ss220/ranks/sounds/claps/clap1.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap10.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap11.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap12.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap13.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap14.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap2.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap3.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap4.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap5.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap6.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap7.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap8.ogg
Binary file not shown.
Binary file added modular_ss220/ranks/sounds/claps/clap9.ogg
Binary file not shown.

0 comments on commit 245a1f8

Please sign in to comment.