-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Marine Body Spray AKA: Reworks Marine Orders #3782
Changes from all commits
b278af6
0d3188e
154e122
747eab3
d513d44
2c1d5e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,11 +93,13 @@ | |
var/chem_effect_flags = 0 | ||
var/chem_effect_reset_time = 8 | ||
|
||
var/command_aura_available = TRUE // Whether or not you can issue an order | ||
//var/command_aura_available = TRUE // Whether or not you can issue an order | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't comment out variables, remove them |
||
var/current_aura = null //The aura we're currently emitting | ||
var/aura_strength = 0 //Strenght of the aura we're emitting | ||
|
||
var/mobility_aura_count = 0 //Used to track how many auras are affecting the human | ||
var/protection_aura_count = 0 | ||
var/marksman_aura_count = 0 | ||
var/mobility_aura_new = 0 //Used to track how many auras are affecting the human | ||
var/protection_aura_new = 0 | ||
var/marksman_aura_new = 0 | ||
Comment on lines
+97
to
+102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. code doc these 5 (or more, if you want) |
||
var/mobility_aura = 0 | ||
var/protection_aura = 0 | ||
var/marksman_aura = 0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/mob/living/carbon/human/proc/handle_orders() | ||
|
||
var/aura_center = null | ||
if(current_aura) | ||
aura_center = src | ||
|
||
if((src.job == JOB_SQUAD_LEADER || HAS_TRAIT(src, TRAIT_SOURCE_SQUAD_LEADER)) && src.assigned_squad && src.assigned_squad.num_tl) //If the guy giving orders is leading a squad with FTLs we need them to act as beacons | ||
for(var/mob/living/carbon/human/marine in src.assigned_squad.ftl_list) | ||
marine.handle_ftl_orders(marine) | ||
|
||
if(aura_strength > 0) | ||
for(var/mob/living/carbon/human/H as anything in GLOB.alive_human_list) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is really expensive to call on every human every life() tick it's more acceptable for xenoes bc they're rarely dealing with 30+ xenoes, but humans regularly breach 100, along with a not-exactly-free get_dist check |
||
if(H.faction != faction || H.z != z || get_dist(aura_center, H) > COMMAND_ORDER_RANGE) | ||
continue | ||
H.affected_by_orders(current_aura, aura_strength) | ||
|
||
if(mobility_aura != mobility_aura_new || protection_aura != protection_aura_new || marksman_aura != marksman_aura_new) | ||
mobility_aura = mobility_aura_new | ||
protection_aura = protection_aura_new | ||
marksman_aura = marksman_aura_new | ||
hud_set_order() | ||
|
||
mobility_aura_new = 0 | ||
protection_aura_new = 0 | ||
marksman_aura_new = 0 | ||
|
||
/mob/living/carbon/human/proc/affected_by_orders(order, strength) | ||
switch(order) | ||
if(COMMAND_ORDER_MOVE) | ||
if(strength > mobility_aura_new) | ||
mobility_aura_new = Clamp(mobility_aura, strength, ORDER_MOVE_MAX_LEVEL) | ||
if(COMMAND_ORDER_HOLD) | ||
if(strength > protection_aura_new) | ||
protection_aura_new = Clamp(protection_aura, strength, ORDER_HOLD_MAX_LEVEL) | ||
pain.apply_pain_reduction(protection_aura * PAIN_REDUCTION_AURA) | ||
if(COMMAND_ORDER_FOCUS) | ||
if(strength > marksman_aura_new) | ||
marksman_aura_new = Clamp(marksman_aura, strength, ORDER_FOCUS_MAX_LEVEL) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,55 +7,58 @@ | |
to_chat(src, SPAN_WARNING("You cannot give an order in your current state.")) | ||
return | ||
|
||
if(!command_aura_available) | ||
to_chat(src, SPAN_WARNING("You have recently given an order. Calm down.")) | ||
return | ||
|
||
if(!skills) | ||
return FALSE | ||
var/order_level = skills.get_skill_level(SKILL_LEADERSHIP) | ||
if(!order_level) | ||
order_level = SKILL_LEAD_TRAINED | ||
|
||
if(!order) | ||
order = tgui_input_list(src, "Choose an order", "Order to send", list(COMMAND_ORDER_MOVE, COMMAND_ORDER_HOLD, COMMAND_ORDER_FOCUS, "help", "cancel")) | ||
if(order == "help") | ||
to_chat(src, SPAN_NOTICE("<br>Orders give a buff to nearby soldiers for a short period of time, followed by a cooldown, as follows:<br><B>Move</B> - Increased mobility and chance to dodge projectiles.<br><B>Hold</B> - Increased resistance to pain and combat wounds.<br><B>Focus</B> - Increased gun accuracy and effective range.<br>")) | ||
if(current_aura) | ||
deactivate_order_buff(current_aura) | ||
current_aura = null | ||
visible_message(SPAN_WARNING("\The [src] stops issueing orders."), \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issuing |
||
SPAN_WARNING("You stop issueing orders."), null, 5) | ||
return | ||
if(order == "cancel") | ||
return | ||
|
||
if(!command_aura_available) | ||
to_chat(src, SPAN_WARNING("You have recently given an order. Calm down.")) | ||
return | ||
|
||
command_aura_available = FALSE | ||
var/command_aura_strength = order_level | ||
var/command_aura_duration = (order_level + 1) * 10 SECONDS | ||
|
||
var/turf/T = get_turf(src) | ||
for(var/mob/living/carbon/human/H in range(COMMAND_ORDER_RANGE, T)) | ||
if(H.stat == DEAD) | ||
continue | ||
H.activate_order_buff(order, command_aura_strength, command_aura_duration) | ||
|
||
if(loc != T) //if we were inside something, the range() missed us. | ||
activate_order_buff(order, command_aura_strength, command_aura_duration) | ||
|
||
for(var/datum/action/A in actions) | ||
A.update_button_icon() | ||
|
||
// 1min cooldown on orders | ||
addtimer(CALLBACK(src, PROC_REF(make_aura_available)), COMMAND_ORDER_COOLDOWN) | ||
|
||
visible_message(SPAN_BOLDNOTICE("[src] gives an order to [order]!"), SPAN_BOLDNOTICE("You give an order to [order]!")) | ||
|
||
/mob/living/carbon/human/proc/make_aura_available() | ||
to_chat(src, SPAN_NOTICE("You can issue an order again.")) | ||
command_aura_available = TRUE | ||
for(var/datum/action/A in actions) | ||
A.update_button_icon() | ||
else | ||
order = tgui_input_list(src, "Choose an order", "Order to send", list(COMMAND_ORDER_MOVE, COMMAND_ORDER_HOLD, COMMAND_ORDER_FOCUS, "help", "cancel")) | ||
if(order == "help") | ||
to_chat(src, SPAN_NOTICE("<br>Orders give a buff to nearby soldiers for a short period of time, followed by a cooldown, as follows:<br><B>Move</B> - Increased mobility and chance to dodge projectiles.<br><B>Hold</B> - Increased resistance to pain and combat wounds.<br><B>Focus</B> - Increased gun accuracy and effective range.<br>")) | ||
return | ||
if(order == "cancel") | ||
return | ||
|
||
if(order) | ||
if(current_aura == order) | ||
visible_message(SPAN_BOLDNOTICE("[src] whitdraws their order to [order]!"), SPAN_BOLDNOTICE("You withdraw your order to [order]!")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. withdraws |
||
deactivate_order_buff(current_aura) | ||
current_aura = null | ||
order = null | ||
else | ||
deactivate_order_buff(current_aura) | ||
visible_message(SPAN_BOLDNOTICE("[src] gives an order to [order]!"), SPAN_BOLDNOTICE("You give an order to [order]!")) | ||
aura_strength = order_level | ||
current_aura = order | ||
|
||
handle_orders(current_aura, aura_strength) | ||
|
||
/mob/living/carbon/human/proc/handle_ftl_orders() | ||
if(!assigned_squad) | ||
return | ||
|
||
var/mob/living/carbon/human/squad_lead = assigned_squad.squad_leader | ||
if(!squad_lead || !squad_lead.current_aura || squad_lead.loc.z != loc.z) | ||
if(current_aura && !squad_lead.current_aura) | ||
to_chat(src, SPAN_BOLDNOTICE("Your radio goes quiet. The Squad Leader is no longer giving orders.")) | ||
aura_strength = 0 | ||
current_aura = null | ||
else | ||
if(current_aura != squad_lead.current_aura) | ||
to_chat(src, SPAN_BOLDNOTICE("Your orders have changed. The Squad Leader has other plans.")) | ||
aura_strength = squad_lead.aura_strength | ||
current_aura = squad_lead.current_aura | ||
handle_orders(current_aura, aura_strength) | ||
hud_set_order() | ||
|
||
/mob/living/carbon/human/verb/issue_order_verb() | ||
set name = "Issue Order" | ||
|
@@ -64,49 +67,14 @@ | |
|
||
issue_order() | ||
|
||
|
||
/mob/living/carbon/human/proc/activate_order_buff(order, strength, duration) | ||
if(!order || !strength) | ||
return | ||
|
||
switch(order) | ||
if(COMMAND_ORDER_MOVE) | ||
mobility_aura_count++ | ||
mobility_aura = Clamp(mobility_aura, strength, ORDER_MOVE_MAX_LEVEL) | ||
if(COMMAND_ORDER_HOLD) | ||
protection_aura_count++ | ||
protection_aura = Clamp(protection_aura, strength, ORDER_HOLD_MAX_LEVEL) | ||
pain.apply_pain_reduction(protection_aura * PAIN_REDUCTION_AURA) | ||
if(COMMAND_ORDER_FOCUS) | ||
marksman_aura_count++ | ||
marksman_aura = Clamp(marksman_aura, strength, ORDER_FOCUS_MAX_LEVEL) | ||
|
||
hud_set_order() | ||
|
||
if(duration) | ||
addtimer(CALLBACK(src, PROC_REF(deactivate_order_buff), order), duration) | ||
|
||
|
||
/mob/living/carbon/human/proc/deactivate_order_buff(order) | ||
switch(order) | ||
if(COMMAND_ORDER_MOVE) | ||
if(mobility_aura_count > 1) | ||
mobility_aura_count-- | ||
else | ||
mobility_aura_count = 0 | ||
mobility_aura = 0 | ||
mobility_aura_new = 0 | ||
if(COMMAND_ORDER_HOLD) | ||
if(protection_aura_count > 1) | ||
protection_aura_count-- | ||
else | ||
pain.reset_pain_reduction() | ||
protection_aura_count = 0 | ||
protection_aura = 0 | ||
pain.reset_pain_reduction() | ||
protection_aura_new = 0 | ||
if(COMMAND_ORDER_FOCUS) | ||
if(marksman_aura_count > 1) | ||
marksman_aura_count-- | ||
else | ||
marksman_aura_count = 0 | ||
marksman_aura = 0 | ||
marksman_aura_new = 0 | ||
|
||
hud_set_order() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you certain this is doing what you want with PEMDAS?