Skip to content
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

Second Wind #2614

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@
#define COMSIG_LIVING_MINOR_SHOCK "living_minor_shock" //sent by stuff like stunbatons and tasers: ()
#define COMSIG_LIVING_REVIVE "living_revive" //from base of mob/living/revive() (full_heal, admin_revive)

/// Attempts to revive the mob via the second wind mechanic.
#define COMSIG_LIVING_SECOND_WIND "living_second_wind" // (datum/source, /mob/dead/observer/reviver)

#define COMSIG_MOB_RESET_PERSPECTIVE "mob_reset_perspective" //from base of /mob/reset_perspective(): (atom/target)
#define COMSIG_LIVING_GUN_PROCESS_FIRE "living_gun_process_fire" //from base of /obj/item/gun/proc/process_fire(): (atom/target, params, zone_override)
// This returns flags as defined for block in __DEFINES/combat.dm!
Expand Down
17 changes: 17 additions & 0 deletions code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,20 @@
unit = "QQQ"
var/roundie = 1 * (0.1**decimals)
return "[round(number, roundie)][unit]"

/proc/pad_number(number, decimals = 0) // this proc doesnt work, lol
if(decimals <= 0)
return "[number]"
var/digits_in_number = 0
var/number_copy = number
while(number_copy > 10)
number_copy /= 10
digits_in_number++
if(digits_in_number >= decimals)
return "[number]"
var/return_string = ""
for(var/i in 1 to decimals - digits_in_number)
return_string += "0"
return_string += "[number]"
return return_string

1 change: 1 addition & 0 deletions code/__DEFINES/span.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define span_big_brass(str) ("<span class='big_brass'>" + str + "</span>")
#define span_bigicon(str) ("<span class='bigicon'>" + str + "</span>")
#define span_binarysay(str) ("<span class='binarysay'>" + str + "</span>")
#define span_blinker(str) ("<span class='blinker'>" + str + "</span>")
#define span_blue(str) ("<span class='blue'>" + str + "</span>")
#define span_blueteamradio(str) ("<span class='blueteamradio'>" + str + "</span>")
#define span_bold(str) ("<span class='bold'>" + str + "</span>")
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
//#define TRAIT_BANDAGE_TONGUE "coagulating tongue"
/// You're hooked on punga!
#define TRAIT_PUNGAPOWER "pungaful"
#define TRAIT_NO_SECOND_WIND "no_second_wind"

#define TRAIT_SURGERY_LOW "lowsurgery"
#define TRAIT_SURGERY_MID "midsurgery"
Expand Down
5 changes: 5 additions & 0 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ GLOBAL_LIST_EMPTY(species_list)
if(H.dna && istype(H.dna.species, species_datum))
. = TRUE

/proc/is_toxin_lover(mob/living/carbon/human/H)
if(!ishuman(H))
return FALSE
return (HAS_TRAIT(H, TRAIT_TOXINLOVER))

/proc/spawn_atom_to_turf(spawn_type, target, amount, admin_spawn=FALSE, list/extra_args)
var/turf/T = get_turf(target)
if(!T)
Expand Down
47 changes: 36 additions & 11 deletions code/__HELPERS/time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,57 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)

//Takes a value of time in deciseconds.
//Returns a text value of that number in hours, minutes, or seconds.
/proc/DisplayTimeText(time_value, round_seconds_to = 0.1)
/proc/DisplayTimeText(time_value, round_seconds_to = 0.1, show_zeroes, abbreviated, fixed_digits = 0)
var/second = FLOOR(time_value * 0.1, round_seconds_to)
var/second_fixed = pad_number(FLOOR(MODULUS(second, 60), round_seconds_to), fixed_digits)
if(!second)
return "right now"
if(second < 60)
return "[second] second[(second != 1)? "s":""]"
if(abbreviated)
return "[second_fixed]s"
else
return "[second_fixed] second[(second != 1)? "s":""]"
var/minute = FLOOR(second / 60, 1)
var/minute_fixed = pad_number(MODULUS(round(minute), 60), fixed_digits)
second = FLOOR(MODULUS(second, 60), round_seconds_to)
var/secondT
if(second)
secondT = " and [second] second[(second != 1)? "s":""]"
if(second || show_zeroes)
if(abbreviated)
secondT = ":[second_fixed]s"
else
secondT = " and [second_fixed] second[(second != 1)? "s":""]"
if(minute < 60)
return "[minute] minute[(minute != 1)? "s":""][secondT]"
if(abbreviated)
return "[minute_fixed]m[secondT]"
else
return "[minute_fixed] minute[(minute != 1)? "s":""][secondT]"
var/hour = FLOOR(minute / 60, 1)
var/hour_fixed = pad_number(MODULUS(round(hour), 24), fixed_digits)
minute = MODULUS(minute, 60)
var/minuteT
if(minute)
minuteT = " and [minute] minute[(minute != 1)? "s":""]"
if(minute || show_zeroes)
if(abbreviated)
minuteT = ":[minute_fixed]m"
else
minuteT = " and [minute_fixed] minute[(minute != 1)? "s":""]"
if(hour < 24)
return "[hour] hour[(hour != 1)? "s":""][minuteT][secondT]"
if(abbreviated)
return "[hour_fixed]h[minuteT][secondT]"
else
return "[hour_fixed] hour[(hour != 1)? "s":""][minuteT][secondT]"
var/day = FLOOR(hour / 24, 1)
var/day_fixed = pad_number(round(minute), fixed_digits)
hour = MODULUS(hour, 24)
var/hourT
if(hour)
hourT = " and [hour] hour[(hour != 1)? "s":""]"
return "[day] day[(day != 1)? "s":""][hourT][minuteT][secondT]"
if(hour || show_zeroes)
if(abbreviated)
hourT = ":[hour_fixed]h"
else
hourT = " and [hour_fixed] hour[(hour != 1)? "s":""]"
if(abbreviated)
return "[day_fixed]d[hourT][minuteT][secondT]"
else
return "[day_fixed] day[(day != 1)? "s":""][hourT][minuteT][secondT]"

/proc/daysSince(realtimev)
return round((world.realtime - realtimev) / (24 HOURS))
Expand Down
36 changes: 31 additions & 5 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1652,13 +1652,33 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
return atoms_found

/// Goes through the common places a client can be held, and returns the first one it finds
/proc/get_client(thing_w_client)
if(isclient(thing_w_client))
return thing_w_client
if(ismob(thing_w_client))
var/mob/mobby = thing_w_client
/proc/get_client(clientthing)
if(isclient(clientthing))
return clientthing
if(ismob(clientthing))
var/mob/mobby = clientthing
if(mobby.client)
return mobby.client
if(istext(clientthing))
var/client/clint = LAZYACCESS(GLOB.directory, clientthing)
if(clint)
return clint

/// Takes in a client, mob, or ckey, and returns the ckey
/proc/get_ckey(clientthing)
var/client/clint
if(isclient(clientthing))
clint = clientthing
return clint.ckey
if(ismob(clientthing))
var/mob/mobby = clientthing
if(mobby.client)
return mobby.client.ckey
if(mobby.ckey)
return mobby.ckey
if(istext(clientthing))
if(clientthing in GLOB.directory)
return clientthing

/proc/get_random_player_name(only_first)
var/list/client_mob_names = list()
Expand All @@ -1672,6 +1692,12 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
return LAZYACCESS(first_last, 1)
return rname

/proc/ckey2mob(ckey)
var/client/clint = LAZYACCESS(GLOB.directory, ckey)
if(!clint)
return null
return clint.mob

/// Makes a gaussian distribution, returning a positive integer
/proc/GaussianReacharound(mean, stddev, min, max)
var/cool_input = gaussian(mean, stddev)
Expand Down
Loading