diff --git a/code/__HELPERS/bygex/bygex.dm b/code/__HELPERS/bygex/bygex.dm index c5c4999ccca..69ebbd8dbb4 100644 --- a/code/__HELPERS/bygex/bygex.dm +++ b/code/__HELPERS/bygex/bygex.dm @@ -29,42 +29,41 @@ #define LIBREGEX_LIBRARY "bin/bygex" #endif -/proc - regEx_compare(str, exp) - return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_compare")(str, exp)) +/proc/regEx_compare(str, exp) + return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_compare")(str, exp)) - regex_compare(str, exp) - return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_compare")(str, exp)) +/proc/regex_compare(str, exp) + return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_compare")(str, exp)) - regEx_find(str, exp) - return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_find")(str, exp)) +/proc/regEx_find(str, exp) + return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_find")(str, exp)) - regex_find(str, exp) - return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_find")(str, exp)) +/proc/regex_find(str, exp) + return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_find")(str, exp)) - regEx_replaceall(str, exp, fmt) - return call(LIBREGEX_LIBRARY, "regEx_replaceall")(str, exp, fmt) +/proc/regEx_replaceall(str, exp, fmt) + return call(LIBREGEX_LIBRARY, "regEx_replaceall")(str, exp, fmt) - regex_replaceall(str, exp, fmt) - return call(LIBREGEX_LIBRARY, "regex_replaceall")(str, exp, fmt) +/proc/regex_replaceall(str, exp, fmt) + return call(LIBREGEX_LIBRARY, "regex_replaceall")(str, exp, fmt) - replacetextEx(str, exp, fmt) - return call(LIBREGEX_LIBRARY, "regEx_replaceallliteral")(str, exp, fmt) +/proc/replacetextEx(str, exp, fmt) + return call(LIBREGEX_LIBRARY, "regEx_replaceallliteral")(str, exp, fmt) - replacetext(str, exp, fmt) - return call(LIBREGEX_LIBRARY, "regex_replaceallliteral")(str, exp, fmt) +/proc/replacetext(str, exp, fmt) + return call(LIBREGEX_LIBRARY, "regex_replaceallliteral")(str, exp, fmt) - regEx_replace(str, exp, fmt) - return call(LIBREGEX_LIBRARY, "regEx_replace")(str, exp, fmt) +/proc/regEx_replace(str, exp, fmt) + return call(LIBREGEX_LIBRARY, "regEx_replace")(str, exp, fmt) - regex_replace(str, exp, fmt) - return call(LIBREGEX_LIBRARY, "regex_replace")(str, exp, fmt) +/proc/regex_replace(str, exp, fmt) + return call(LIBREGEX_LIBRARY, "regex_replace")(str, exp, fmt) - regEx_findall(str, exp) - return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_findall")(str, exp)) +/proc/regEx_findall(str, exp) + return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_findall")(str, exp)) - regex_findall(str, exp) - return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_findall")(str, exp)) +/proc/regex_findall(str, exp) + return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_findall")(str, exp)) //upon calling a regex match or search, a /datum/regex object is created with str(haystack) and exp(needle) variables set @@ -79,66 +78,69 @@ var/anchors = 0 var/list/matches = list() - New(str, exp, results) - src.str = str - src.exp = exp +/datum/regex/New(str, exp, results) + src.str = str + src.exp = exp - if(findtext(results, "$Err$", 1, 6)) //error message - src.error = results - else - var/list/L = params2list(results) - var/list/M - var{i;j} - for(i in L) - M = L[i] - for(j=2, j<=M.len, j+=2) - matches += new /datum/match(text2num(M[j-1]),text2num(M[j])) - anchors = (j-2)/2 - return matches + if(findtext(results, "$Err$", 1, 6)) //error message + src.error = results + else + var/list/L = params2list(results) + var/list/M + var{i;j} + for(i in L) + M = L[i] + for(j=2, j<=M.len, j+=2) + matches += new /datum/match(text2num(M[j-1]),text2num(M[j])) + anchors = (j-2)/2 + return matches - proc - str(i) - if(!i) return str - var/datum/match/M = matches[i] - if(i < 1 || i > matches.len) - throw EXCEPTION("str(): out of bounds") - return copytext(str, M.pos, M.pos+M.len) +/datum/regex/proc/str(i) + if(!i) + return str + var/datum/match/M = matches[i] + if(i < 1 || i > matches.len) + throw EXCEPTION("str(): out of bounds") + return copytext(str, M.pos, M.pos+M.len) - pos(i) - if(!i) return 1 - if(i < 1 || i > matches.len) - throw EXCEPTION("pos(): out of bounds") - var/datum/match/M = matches[i] - return M.pos +/datum/regex/proc/pos(i) + if(!i) + return 1 + if(i < 1 || i > matches.len) + throw EXCEPTION("pos(): out of bounds") + var/datum/match/M = matches[i] + return M.pos - len(i) - if(!i) return length(str) - if(i < 1 || i > matches.len) - throw EXCEPTION("len(): out of bounds") - var/datum/match/M = matches[i] - return M.len +/datum/regex/proc/len(i) + if(!i) + return length(str) + if(i < 1 || i > matches.len) + throw EXCEPTION("len(): out of bounds") + var/datum/match/M = matches[i] + return M.len - end(i) - if(!i) return length(str) - if(i < 1 || i > matches.len) - throw EXCEPTION("end() out of bounds") - var/datum/match/M = matches[i] - return M.pos + M.len +/datum/regex/proc/end(i) + if(!i) + return length(str) + if(i < 1 || i > matches.len) + throw EXCEPTION("end() out of bounds") + var/datum/match/M = matches[i] + return M.pos + M.len - report() //debug tool - . = ":: RESULTS ::\n:: str :: [html_encode(str)]\n:: exp :: [html_encode(exp)]\n:: anchors :: [anchors]" - if(error) - . += "\n[error]" - return - for(var/i=1, i<=matches.len, ++i) - . += "\nMatch[i]\n\t[html_encode(str(i))]\n\tpos=[pos(i)] len=[len(i)]" +/datum/regex/proc/report() //debug tool + . = ":: RESULTS ::\n:: str :: [html_encode(str)]\n:: exp :: [html_encode(exp)]\n:: anchors :: [anchors]" + if(error) + . += "\n[error]" + return + for(var/i=1, i<=matches.len, ++i) + . += "\nMatch[i]\n\t[html_encode(str(i))]\n\tpos=[pos(i)] len=[len(i)]" /datum/match var/pos var/len - New(pos, len) - src.pos = pos - src.len = len +/datum/match/New(pos, len) + src.pos = pos + src.len = len #endif \ No newline at end of file diff --git a/code/__HELPERS/bygex/demo.dm b/code/__HELPERS/bygex/demo.dm index f89be30ded2..fe481f93020 100644 --- a/code/__HELPERS/bygex/demo.dm +++ b/code/__HELPERS/bygex/demo.dm @@ -4,51 +4,50 @@ var/datum/regex/results - verb - set_expression() - var/t = input(usr,"Input Expression","title",expression) as text|null - if(t != null) - expression = t - usr << "Expression set to:\t[html_encode(t)]" +/mob/verb/set_expression() + var/t = input(usr,"Input Expression","title",expression) as text|null + if(t != null) + expression = t + usr << "Expression set to:\t[html_encode(t)]" - set_format() - var/t = input(usr,"Input Formatter","title",format) as text|null - if(t != null) - format = t - usr << "Format set to:\t[html_encode(t)]" +/mob/verb/set_format() + var/t = input(usr,"Input Formatter","title",format) as text|null + if(t != null) + format = t + usr << "Format set to:\t[html_encode(t)]" - compare_casesensitive(t as text) - results = regEx_compare(t, expression) - world << results.report() +/mob/verb/compare_casesensitive(t as text) + results = regEx_compare(t, expression) + world << results.report() - compare(t as text) - results = regex_compare(t, expression) - world << results.report() +/mob/verb/compare(t as text) + results = regex_compare(t, expression) + world << results.report() - find_casesensitive(t as text) - results = regEx_find(t, expression) - world << results.report() +/mob/verb/find_casesensitive(t as text) + results = regEx_find(t, expression) + world << results.report() - find(t as text) - results = regex_find(t, expression) - world << results.report() +/mob/verb/find(t as text) + results = regex_find(t, expression) + world << results.report() - replaceall_casesensitive(t as text) - usr << regEx_replaceall(t, expression, format) +/mob/verb/replaceall_casesensitive(t as text) + usr << regEx_replaceall(t, expression, format) - replaceall(t as text) - usr << regex_replaceall(t, expression, format) +/mob/verb/replaceall(t as text) + usr << regex_replaceall(t, expression, format) - replace_casesensitive(t as text) - usr << html_encode(regEx_replace(t, expression, format)) +/mob/verb/replace_casesensitive(t as text) + usr << html_encode(regEx_replace(t, expression, format)) - replace(t as text) - usr << regex_replace(t, expression, format) +/mob/verb/replace(t as text) + usr << regex_replace(t, expression, format) - findall(t as text) - results = regex_findall(t, expression) - world << results.report() +/mob/verb/findall(t as text) + results = regex_findall(t, expression) + world << results.report() - findall_casesensitive(t as text) - results = regEx_findall(t, expression) - world << results.report() \ No newline at end of file +/mob/verb/findall_casesensitive(t as text) + results = regEx_findall(t, expression) + world << results.report() \ No newline at end of file diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index b098af53541..4f0e9158101 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -292,7 +292,8 @@ return candidates /proc/ScreenText(obj/O, maptext="", screen_loc="CENTER-7,CENTER-7", maptext_height=480, maptext_width=480) - if(!isobj(O)) O = new /obj/screen/text() + if(!isobj(O)) + O = new /obj/screen/text() O.maptext = maptext O.maptext_height = maptext_height O.maptext_width = maptext_width @@ -300,8 +301,10 @@ return O /proc/Show2Group4Delay(obj/O, list/group, delay=0) - if(!isobj(O)) return - if(!group) group = clients + if(!isobj(O)) + return + if(!group) + group = clients for(var/client/C in group) C.screen += O if(delay) @@ -409,7 +412,8 @@ return candidates /proc/makeBody(mob/dead/observer/G_found) // Uses stripped down and bastardized code from respawn character - if(!G_found || !G_found.key) return + if(!G_found || !G_found.key) + return //First we spawn a dude. var/mob/living/carbon/human/new_character = new(pick(latejoin))//The mob being spawned. diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 31a40ca978f..436b4c76c78 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -55,7 +55,8 @@ //creates every subtype of prototype (excluding prototype) and adds it to list L. //if no list/L is provided, one is created. /proc/init_subtypes(prototype, list/L) - if(!istype(L)) L = list() + if(!istype(L)) + L = list() for(var/path in subtypesof(prototype)) L += new path() return L diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 74a1e3bb811..4e76b773352 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -783,7 +783,8 @@ The _flatIcons list is a cache for generated icon files. /proc/getIconMask(atom/A)//By yours truly. Creates a dynamic mask for a mob/whatever. /N var/icon/alpha_mask = new(A.icon,A.icon_state)//So we want the default icon and icon state of A. for(var/I in A.overlays)//For every image in overlays. var/image/I will not work, don't try it. - if(I:layer>A.layer) continue//If layer is greater than what we need, skip it. + if(I:layer>A.layer) + continue//If layer is greater than what we need, skip it. var/icon/image_overlay = new(I:icon,I:icon_state)//Blend only works with icon objects. //Also, icons cannot directly set icon_state. Slower than changing variables but whatever. alpha_mask.Blend(image_overlay,ICON_OR)//OR so they are lumped together in a nice overlay. @@ -799,10 +800,14 @@ The _flatIcons list is a cache for generated icon files. for(var/i=0,i<5,i++)//And now we add it as overlays. It's faster than creating an icon and then merging it. var/image/I = image("icon" = opacity_icon, "icon_state" = A.icon_state, "layer" = layer+0.8)//So it's above other stuff but below weapons and the like. switch(i)//Now to determine offset so the result is somewhat blurred. - if(1) I.pixel_x-- - if(2) I.pixel_x++ - if(3) I.pixel_y-- - if(4) I.pixel_y++ + if(1) + I.pixel_x-- + if(2) + I.pixel_x++ + if(3) + I.pixel_y-- + if(4) + I.pixel_y++ overlays += I//And finally add the overlay. /proc/getHologramIcon(icon/A, safety=1)//If safety is on, a new icon is not created. @@ -920,12 +925,12 @@ var/global/list/humanoid_icon_cache = list() /proc/get_flat_human_icon(var/icon_id,var/outfit,var/datum/preferences/prefs) if(!icon_id || !humanoid_icon_cache[icon_id]) var/mob/living/carbon/human/dummy/body = new() - + if(prefs) prefs.copy_to(body) if(outfit) body.equipOutfit(outfit, TRUE) - + var/icon/out_icon = icon('icons/effects/effects.dmi', "nothing") body.dir = NORTH @@ -945,7 +950,7 @@ var/global/list/humanoid_icon_cache = list() out_icon.Insert(partial,dir=EAST) qdel(body) - + humanoid_icon_cache[icon_id] = out_icon return out_icon else diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 37ad064b5c2..f928f620c39 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -3,30 +3,44 @@ /proc/random_eye_color() switch(pick(20;"brown",20;"hazel",20;"grey",15;"blue",15;"green",1;"amber",1;"albino")) - if("brown") return "630" - if("hazel") return "542" - if("grey") return pick("666","777","888","999","aaa","bbb","ccc") - if("blue") return "36c" - if("green") return "060" - if("amber") return "fc0" - if("albino") return pick("c","d","e","f") + pick("0","1","2","3","4","5","6","7","8","9") + pick("0","1","2","3","4","5","6","7","8","9") - else return "000" + if("brown") + return "630" + if("hazel") + return "542" + if("grey") + return pick("666","777","888","999","aaa","bbb","ccc") + if("blue") + return "36c" + if("green") + return "060" + if("amber") + return "fc0" + if("albino") + return pick("c","d","e","f") + pick("0","1","2","3","4","5","6","7","8","9") + pick("0","1","2","3","4","5","6","7","8","9") + else + return "000" /proc/random_underwear(gender) if(!underwear_list.len) init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear, underwear_list, underwear_m, underwear_f) switch(gender) - if(MALE) return pick(underwear_m) - if(FEMALE) return pick(underwear_f) - else return pick(underwear_list) + if(MALE) + return pick(underwear_m) + if(FEMALE) + return pick(underwear_f) + else + return pick(underwear_list) /proc/random_undershirt(gender) if(!undershirt_list.len) init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, undershirt_list, undershirt_m, undershirt_f) switch(gender) - if(MALE) return pick(undershirt_m) - if(FEMALE) return pick(undershirt_f) - else return pick(undershirt_list) + if(MALE) + return pick(undershirt_m) + if(FEMALE) + return pick(undershirt_f) + else + return pick(undershirt_list) /proc/random_socks() if(!socks_list.len) @@ -56,20 +70,28 @@ /proc/random_hair_style(gender) switch(gender) - if(MALE) return pick(hair_styles_male_list) - if(FEMALE) return pick(hair_styles_female_list) - else return pick(hair_styles_list) + if(MALE) + return pick(hair_styles_male_list) + if(FEMALE) + return pick(hair_styles_female_list) + else + return pick(hair_styles_list) /proc/random_facial_hair_style(gender) switch(gender) - if(MALE) return pick(facial_hair_styles_male_list) - if(FEMALE) return pick(facial_hair_styles_female_list) - else return pick(facial_hair_styles_list) + if(MALE) + return pick(facial_hair_styles_male_list) + if(FEMALE) + return pick(facial_hair_styles_female_list) + else + return pick(facial_hair_styles_list) /proc/random_unique_name(gender, attempts_to_find_unique_name=10) for(var/i=1, i<=attempts_to_find_unique_name, i++) - if(gender==FEMALE) . = capitalize(pick(first_names_female)) + " " + capitalize(pick(last_names)) - else . = capitalize(pick(first_names_male)) + " " + capitalize(pick(last_names)) + if(gender==FEMALE) + . = capitalize(pick(first_names_female)) + " " + capitalize(pick(last_names)) + else + . = capitalize(pick(first_names_male)) + " " + capitalize(pick(last_names)) if(i != attempts_to_find_unique_name && !findname(.)) break @@ -104,16 +126,26 @@ var/global/list/roundstart_species[0] /proc/age2agedescription(age) switch(age) - if(0 to 1) return "infant" - if(1 to 3) return "toddler" - if(3 to 13) return "child" - if(13 to 19) return "teenager" - if(19 to 30) return "young adult" - if(30 to 45) return "adult" - if(45 to 60) return "middle-aged" - if(60 to 70) return "aging" - if(70 to INFINITY) return "elderly" - else return "unknown" + if(0 to 1) + return "infant" + if(1 to 3) + return "toddler" + if(3 to 13) + return "child" + if(13 to 19) + return "teenager" + if(19 to 30) + return "young adult" + if(30 to 45) + return "adult" + if(45 to 60) + return "middle-aged" + if(60 to 70) + return "aging" + if(70 to INFINITY) + return "elderly" + else + return "unknown" /* Proc for attack log creation, because really why not @@ -148,10 +180,10 @@ Proc for attack log creation, because really why not if(!user || !target) return 0 var/user_loc = user.loc - + var/drifting = 0 if(!user.Process_Spacemove(0) && user.inertia_dir) - drifting = 1 + drifting = 1 var/target_loc = target.loc @@ -172,11 +204,11 @@ Proc for attack log creation, because really why not break if(uninterruptible) continue - + if(drifting && !user.inertia_dir) drifting = 0 user_loc = user.loc - + if((!drifting && user.loc != user_loc) || target.loc != target_loc || user.get_active_hand() != holding || user.incapacitated() || user.lying ) . = 0 break @@ -192,11 +224,11 @@ Proc for attack log creation, because really why not Tloc = target.loc var/atom/Uloc = user.loc - + var/drifting = 0 if(!user.Process_Spacemove(0) && user.inertia_dir) - drifting = 1 - + drifting = 1 + var/holding = user.get_active_hand() var/holdingnull = 1 //User's hand started out empty, check for an empty hand @@ -214,11 +246,11 @@ Proc for attack log creation, because really why not sleep(1) if (progress) progbar.update(world.time - starttime) - + if(drifting && !user.inertia_dir) drifting = 0 Uloc = user.loc - + if(!user || user.stat || user.weakened || user.stunned || (!drifting && user.loc != Uloc)) . = 0 break diff --git a/code/__HELPERS/sanitize_values.dm b/code/__HELPERS/sanitize_values.dm index cf840584c6f..4dec0e05de9 100644 --- a/code/__HELPERS/sanitize_values.dm +++ b/code/__HELPERS/sanitize_values.dm @@ -12,22 +12,30 @@ return default /proc/sanitize_inlist(value, list/List, default) - if(value in List) return value - if(default) return default - if(List && List.len)return pick(List) + if(value in List) + return value + if(default) + return default + if(List && List.len) + return pick(List) //more specialised stuff /proc/sanitize_gender(gender,neuter=0,plural=0, default="male") switch(gender) - if(MALE, FEMALE)return gender + if(MALE, FEMALE) + return gender if(NEUTER) - if(neuter) return gender - else return default + if(neuter) + return gender + else + return default if(PLURAL) - if(plural) return gender - else return default + if(plural) + return gender + else + return default return default /proc/sanitize_hexcolor(color, desired_format=3, include_crunch=0, default) @@ -43,14 +51,18 @@ for(var/i=start, i<=len, i+=step_size) var/ascii = text2ascii(color,i) switch(ascii) - if(48 to 57) . += ascii2text(ascii) //numbers 0 to 9 - if(97 to 102) . += ascii2text(ascii) //letters a to f - if(65 to 70) . += ascii2text(ascii+32) //letters A to F - translates to lowercase + if(48 to 57) + . += ascii2text(ascii) //numbers 0 to 9 + if(97 to 102) + . += ascii2text(ascii) //letters a to f + if(65 to 70) + . += ascii2text(ascii+32) //letters A to F - translates to lowercase else break if(length(.) != desired_format) - if(default) return default + if(default) + return default return crunch + repeat_string(desired_format, "0") return crunch + . diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index 27f8526c2e1..bdf517b9be9 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -62,16 +62,23 @@ //Returns null if there is any bad text in the string /proc/reject_bad_text(text, max_length=512) - if(length(text) > max_length) return //message too long + if(length(text) > max_length) + return //message too long var/non_whitespace = 0 for(var/i=1, i<=length(text), i++) switch(text2ascii(text,i)) - if(62,60,92,47) return //rejects the text if it contains these bad characters: <, >, \ or / - if(127 to 255) return //rejects weird letters like � - if(0 to 31) return //more weird stuff - if(32) continue //whitespace - else non_whitespace = 1 - if(non_whitespace) return text //only accepts the text if it has some non-spaces + if(62,60,92,47) + return //rejects the text if it contains these bad characters: <, >, \ or / + if(127 to 255) + return //rejects weird letters like � + if(0 to 31) + return //more weird stuff + if(32) + continue //whitespace + else + non_whitespace = 1 + if(non_whitespace) + return text //only accepts the text if it has some non-spaces // Used to get a properly sanitized input, of max_length /proc/stripped_input(mob/user, message = "", title = "", default = "", max_length=MAX_MESSAGE_LEN) @@ -103,47 +110,57 @@ // a .. z if(97 to 122) //Lowercase Letters - if(last_char_group<2) t_out += ascii2text(ascii_char-32) //Force uppercase first character - else t_out += ascii2text(ascii_char) + if(last_char_group<2) + t_out += ascii2text(ascii_char-32) //Force uppercase first character + else + t_out += ascii2text(ascii_char) number_of_alphanumeric++ last_char_group = 4 // 0 .. 9 if(48 to 57) //Numbers - if(!last_char_group) continue //suppress at start of string - if(!allow_numbers) continue + if(!last_char_group) + continue //suppress at start of string + if(!allow_numbers) + continue t_out += ascii2text(ascii_char) number_of_alphanumeric++ last_char_group = 3 // ' - . if(39,45,46) //Common name punctuation - if(!last_char_group) continue + if(!last_char_group) + continue t_out += ascii2text(ascii_char) last_char_group = 2 // ~ | @ : # $ % & * + if(126,124,64,58,35,36,37,38,42,43) //Other symbols that we'll allow (mainly for AI) - if(!last_char_group) continue //suppress at start of string - if(!allow_numbers) continue + if(!last_char_group) + continue //suppress at start of string + if(!allow_numbers) + continue t_out += ascii2text(ascii_char) last_char_group = 2 //Space if(32) - if(last_char_group <= 1) continue //suppress double-spaces and spaces at start of string + if(last_char_group <= 1) + continue //suppress double-spaces and spaces at start of string t_out += ascii2text(ascii_char) last_char_group = 1 else return - if(number_of_alphanumeric < 2) return //protects against tiny names like "A" and also names like "' ' ' ' ' ' ' '" + if(number_of_alphanumeric < 2) + return //protects against tiny names like "A" and also names like "' ' ' ' ' ' ' '" if(last_char_group == 1) t_out = copytext(t_out,1,length(t_out)) //removes the last character (in this case a space) for(var/bad_name in list("space","floor","wall","r-wall","monkey","unknown","inactive ai")) //prevents these common metagamey names - if(cmptext(t_out,bad_name)) return //(not case sensitive) + if(cmptext(t_out,bad_name)) + return //(not case sensitive) return t_out @@ -345,8 +362,10 @@ var/list/binary = list("0","1") //This was coded to handle DNA gene-splicing. /proc/merge_text(into, from, null_char="_") . = "" - if(!istext(into)) into = "" - if(!istext(from)) from = "" + if(!istext(into)) + into = "" + if(!istext(from)) + from = "" var/null_ascii = istext(null_char) ? text2ascii(null_char,1) : null_char var/previous = 0 @@ -379,7 +398,8 @@ var/list/binary = list("0","1") var/len = length(needles) for(var/i=1, i<=len, i++) temp = findtextEx(haystack, ascii2text(text2ascii(needles,i)), start, end) //Note: ascii2text(text2ascii) is faster than copytext() - if(temp) end = temp + if(temp) + end = temp return end diff --git a/code/__HELPERS/type2type.dm b/code/__HELPERS/type2type.dm index a9c35aee9b4..fad0c646c3d 100644 --- a/code/__HELPERS/type2type.dm +++ b/code/__HELPERS/type2type.dm @@ -21,13 +21,19 @@ for(var/i=1, i<=len, i++) var/num = text2ascii(hex,i) switch(num) - if(48 to 57) num -= 48 //0-9 - if(97 to 102) num -= 87 //a-f - if(65 to 70) num -= 55 //A-F - if(45) negative = 1//- + if(48 to 57) + num -= 48 //0-9 + if(97 to 102) + num -= 87 //a-f + if(65 to 70) + num -= 55 //A-F + if(45) + negative = 1//- else - if(num) break - else continue + if(num) + break + else + continue . *= 16 . += num if(negative) @@ -48,16 +54,21 @@ var/i=0 while(1) if(len<=0) - if(!num) break + if(!num) + break else - if(i>=len) break + if(i>=len) + break var/remainder = num/16 num = round(remainder) remainder = (remainder - num) * 16 switch(remainder) - if(9,8,7,6,5,4,3,2,1) . = "[remainder]" + . - if(10,11,12,13,14,15) . = ascii2text(remainder+87) + . - else . = "0" + . + if(9,8,7,6,5,4,3,2,1) + . = "[remainder]" + . + if(10,11,12,13,14,15) + . = ascii2text(remainder+87) + . + else + . = "0" + . i++ return . @@ -179,7 +190,8 @@ //Case Sensitive! /proc/text2listEx(text, delimiter="\n") var/delim_len = length(delimiter) - if(delim_len < 1) return list(text) + if(delim_len < 1) + return list(text) . = list() var/last_found = 1 var/found @@ -243,28 +255,44 @@ degree = SimplifyDegrees(degree) - if(degree < 45) return NORTH - if(degree < 90) return NORTHEAST - if(degree < 135) return EAST - if(degree < 180) return SOUTHEAST - if(degree < 225) return SOUTH - if(degree < 270) return SOUTHWEST - if(degree < 315) return WEST + if(degree < 45) + return NORTH + if(degree < 90) + return NORTHEAST + if(degree < 135) + return EAST + if(degree < 180) + return SOUTHEAST + if(degree < 225) + return SOUTH + if(degree < 270) + return SOUTHWEST + if(degree < 315) + return WEST return NORTH|WEST //returns the north-zero clockwise angle in degrees, given a direction /proc/dir2angle(D) switch(D) - if(NORTH) return 0 - if(SOUTH) return 180 - if(EAST) return 90 - if(WEST) return 270 - if(NORTHEAST) return 45 - if(SOUTHEAST) return 135 - if(NORTHWEST) return 315 - if(SOUTHWEST) return 225 - else return null + if(NORTH) + return 0 + if(SOUTH) + return 180 + if(EAST) + return 90 + if(WEST) + return 270 + if(NORTHEAST) + return 45 + if(SOUTHEAST) + return 135 + if(NORTHWEST) + return 315 + if(SOUTHWEST) + return 225 + else + return null //Returns the angle in english /proc/angle2text(degree) @@ -273,26 +301,43 @@ //Converts a blend_mode constant to one acceptable to icon.Blend() /proc/blendMode2iconMode(blend_mode) switch(blend_mode) - if(BLEND_MULTIPLY) return ICON_MULTIPLY - if(BLEND_ADD) return ICON_ADD - if(BLEND_SUBTRACT) return ICON_SUBTRACT - else return ICON_OVERLAY + if(BLEND_MULTIPLY) + return ICON_MULTIPLY + if(BLEND_ADD) + return ICON_ADD + if(BLEND_SUBTRACT) + return ICON_SUBTRACT + else + return ICON_OVERLAY //Converts a rights bitfield into a string /proc/rights2text(rights, seperator="", list/adds, list/subs) - if(rights & R_BUILDMODE) . += "[seperator]+BUILDMODE" - if(rights & R_ADMIN) . += "[seperator]+ADMIN" - if(rights & R_BAN) . += "[seperator]+BAN" - if(rights & R_FUN) . += "[seperator]+FUN" - if(rights & R_SERVER) . += "[seperator]+SERVER" - if(rights & R_DEBUG) . += "[seperator]+DEBUG" - if(rights & R_POSSESS) . += "[seperator]+POSSESS" - if(rights & R_PERMISSIONS) . += "[seperator]+PERMISSIONS" - if(rights & R_STEALTH) . += "[seperator]+STEALTH" - if(rights & R_REJUVINATE) . += "[seperator]+REJUVINATE" - if(rights & R_VAREDIT) . += "[seperator]+VAREDIT" - if(rights & R_SOUNDS) . += "[seperator]+SOUND" - if(rights & R_SPAWN) . += "[seperator]+SPAWN" + if(rights & R_BUILDMODE) + . += "[seperator]+BUILDMODE" + if(rights & R_ADMIN) + . += "[seperator]+ADMIN" + if(rights & R_BAN) + . += "[seperator]+BAN" + if(rights & R_FUN) + . += "[seperator]+FUN" + if(rights & R_SERVER) + . += "[seperator]+SERVER" + if(rights & R_DEBUG) + . += "[seperator]+DEBUG" + if(rights & R_POSSESS) + . += "[seperator]+POSSESS" + if(rights & R_PERMISSIONS) + . += "[seperator]+PERMISSIONS" + if(rights & R_STEALTH) + . += "[seperator]+STEALTH" + if(rights & R_REJUVINATE) + . += "[seperator]+REJUVINATE" + if(rights & R_VAREDIT) + . += "[seperator]+VAREDIT" + if(rights & R_SOUNDS) + . += "[seperator]+SOUND" + if(rights & R_SPAWN) + . += "[seperator]+SPAWN" for(var/verbpath in adds) . += "[seperator]+[verbpath]" @@ -302,11 +347,16 @@ /proc/ui_style2icon(ui_style) switch(ui_style) - if("Retro") return 'icons/mob/screen_retro.dmi' - if("Plasmafire") return 'icons/mob/screen_plasmafire.dmi' - if("Slimecore") return 'icons/mob/screen_slimecore.dmi' - if("Operative") return 'icons/mob/screen_operative.dmi' - else return 'icons/mob/screen_midnight.dmi' + if("Retro") + return 'icons/mob/screen_retro.dmi' + if("Plasmafire") + return 'icons/mob/screen_plasmafire.dmi' + if("Slimecore") + return 'icons/mob/screen_slimecore.dmi' + if("Operative") + return 'icons/mob/screen_operative.dmi' + else + return 'icons/mob/screen_midnight.dmi' //colour formats /proc/rgb2hsl(red, green, blue) @@ -318,18 +368,25 @@ var/hue=0;var/saturation=0;var/lightness=0; lightness = (max + min)/2 if(range != 0) - if(lightness < 0.5) saturation = range/(max+min) - else saturation = range/(2-max-min) + if(lightness < 0.5) + saturation = range/(max+min) + else + saturation = range/(2-max-min) var/dred = ((max-red)/(6*max)) + 0.5 var/dgreen = ((max-green)/(6*max)) + 0.5 var/dblue = ((max-blue)/(6*max)) + 0.5 - if(max==red) hue = dblue - dgreen - else if(max==green) hue = dred - dblue + (1/3) - else hue = dgreen - dred + (2/3) - if(hue < 0) hue++ - else if(hue > 1) hue-- + if(max==red) + hue = dblue - dgreen + else if(max==green) + hue = dred - dblue + (1/3) + else + hue = dgreen - dred + (2/3) + if(hue < 0) + hue++ + else if(hue > 1) + hue-- return list(hue, saturation, lightness) @@ -341,8 +398,10 @@ blue = red else var/a;var/b; - if(lightness < 0.5) b = lightness*(1+saturation) - else b = (lightness+saturation) - (saturation*lightness) + if(lightness < 0.5) + b = lightness*(1+saturation) + else + b = (lightness+saturation) - (saturation*lightness) a = 2*lightness - b red = round(255 * hue2rgb(a, b, hue+(1/3))) @@ -352,11 +411,16 @@ return list(red, green, blue) /proc/hue2rgb(a, b, hue) - if(hue < 0) hue++ - else if(hue > 1) hue-- - if(6*hue < 1) return (a+(b-a)*6*hue) - if(2*hue < 1) return b - if(3*hue < 2) return (a+(b-a)*((2/3)-hue)*6) + if(hue < 0) + hue++ + else if(hue > 1) + hue-- + if(6*hue < 1) + return (a+(b-a)*6*hue) + if(2*hue < 1) + return b + if(3*hue < 2) + return (a+(b-a)*((2/3)-hue)*6) return a // Very ugly, BYOND doesn't support unix time and rounding errors make it really hard to convert it to BYOND time. diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index e4c14cdf2d7..ac85c0ac425 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -122,19 +122,26 @@ Turf and target are seperate in case you want to teleport some distance from a t //Now to find a box from center location and make that our destination. for(var/turf/T in block(locate(center.x+b1xerror,center.y+b1yerror,location.z), locate(center.x+b2xerror,center.y+b2yerror,location.z) )) - if(density&&T.density) continue//If density was specified. - if(T.x>world.maxx || T.x<1) continue//Don't want them to teleport off the map. - if(T.y>world.maxy || T.y<1) continue + if(density&&T.density) + continue//If density was specified. + if(T.x>world.maxx || T.x<1) + continue//Don't want them to teleport off the map. + if(T.y>world.maxy || T.y<1) + continue destination_list += T if(destination_list.len) destination = pick(destination_list) else return else//Same deal here. - if(density&&destination.density) return - if(destination.x>world.maxx || destination.x<1) return - if(destination.y>world.maxy || destination.y<1) return - else return + if(density&&destination.density) + return + if(destination.x>world.maxx || destination.x<1) + return + if(destination.y>world.maxy || destination.y<1) + return + else + return return destination @@ -201,7 +208,8 @@ Turf and target are seperate in case you want to teleport some distance from a t //This will update a mob's name, real_name, mind.name, data_core records, pda, id and traitor text //Calling this proc without an oldname will only update the mob and skip updating the pda, id and records ~Carn /mob/proc/fully_replace_character_name(oldname,newname) - if(!newname) return 0 + if(!newname) + return 0 real_name = newname name = newname if(mind) @@ -237,7 +245,8 @@ Turf and target are seperate in case you want to teleport some distance from a t //update the datacore records! This is goig to be a bit costly. for(var/list/L in list(data_core.general,data_core.medical,data_core.security,data_core.locked)) var/datum/data/record/R = find_record("name", oldname, L) - if(R) R.fields["name"] = newname + if(R) + R.fields["name"] = newname //update our pda and id if we have them on our person var/list/searching = GetAllContents() @@ -250,7 +259,8 @@ Turf and target are seperate in case you want to teleport some distance from a t if(ID.registered_name == oldname) ID.registered_name = newname ID.update_label() - if(!search_pda) break + if(!search_pda) + break search_id = 0 else if( search_pda && istype(A,/obj/item/device/pda) ) @@ -258,7 +268,8 @@ Turf and target are seperate in case you want to teleport some distance from a t if(PDA.owner == oldname) PDA.owner = newname PDA.update_label() - if(!search_id) break + if(!search_id) + break search_pda = 0 for(var/datum/mind/T in ticker.minds) @@ -357,15 +368,19 @@ Turf and target are seperate in case you want to teleport some distance from a t /proc/select_active_free_borg(mob/user) var/list/borgs = active_free_borgs() if(borgs.len) - if(user) . = input(user,"Unshackled cyborg signals detected:", "Cyborg Selection", borgs[1]) in borgs - else . = pick(borgs) + if(user) + . = input(user,"Unshackled cyborg signals detected:", "Cyborg Selection", borgs[1]) in borgs + else + . = pick(borgs) return . /proc/select_active_ai(mob/user) var/list/ais = active_ais() if(ais.len) - if(user) . = input(user,"AI signals detected:", "AI Selection", ais[1]) in ais - else . = pick(ais) + if(user) + . = input(user,"AI signals detected:", "AI Selection", ais[1]) in ais + else + . = pick(ais) return . //Returns a list of all items of interest with their name @@ -461,7 +476,8 @@ Turf and target are seperate in case you want to teleport some distance from a t var/key var/ckey - if(!whom) return "*null*" + if(!whom) + return "*null*" if(istype(whom, /client)) C = whom M = C.mob @@ -623,10 +639,13 @@ Turf and target are seperate in case you want to teleport some distance from a t var/steps = 0 while(current != target_turf) - if(steps > length) return 0 - if(current.opacity) return 0 + if(steps > length) + return 0 + if(current.opacity) + return 0 for(var/atom/A in current) - if(A.opacity) return 0 + if(A.opacity) + return 0 current = get_step_towards(current, target_turf) steps++ @@ -634,7 +653,8 @@ Turf and target are seperate in case you want to teleport some distance from a t /proc/is_blocked_turf(turf/T) var/cant_pass = 0 - if(T.density) cant_pass = 1 + if(T.density) + cant_pass = 1 for(var/atom/A in T) if(A.density)//&&A.anchored cant_pass = 1 @@ -663,16 +683,21 @@ Turf and target are seperate in case you want to teleport some distance from a t turf_last2 = get_step(turf_last2,dir_alt2) breakpoint++ - if(!free_tile) return get_step(ref, base_dir) - else return get_step_towards(ref,free_tile) + if(!free_tile) + return get_step(ref, base_dir) + else + return get_step_towards(ref,free_tile) - else return get_step(ref, base_dir) + else + return get_step(ref, base_dir) //Takes: Anything that could possibly have variables and a varname to check. //Returns: 1 if found, 0 if not. /proc/hasvar(datum/A, varname) - if(A.vars.Find(lowertext(varname))) return 1 - else return 0 + if(A.vars.Find(lowertext(varname))) + return 1 + else + return 0 //Repopulates sortedAreas list /proc/SortAreas() @@ -690,15 +715,18 @@ Turf and target are seperate in case you want to teleport some distance from a t //Takes: Area type as text string or as typepath OR an instance of the area. //Returns: A list of all areas of that type in the world. /proc/get_areas(areatype) - if(!areatype) return null - if(istext(areatype)) areatype = text2path(areatype) + if(!areatype) + return null + if(istext(areatype)) + areatype = text2path(areatype) if(isarea(areatype)) var/area/areatemp = areatype areatype = areatemp.type var/list/areas = new/list() for(var/area/N in world) - if(istype(N, areatype)) areas += N + if(istype(N, areatype)) + areas += N return areas //Takes: Area type as text string or as typepath OR an instance of the area. @@ -706,7 +734,8 @@ Turf and target are seperate in case you want to teleport some distance from a t /proc/get_area_turfs(areatype, target_z = 0) if(!areatype) return null - if(istext(areatype)) areatype = text2path(areatype) + if(istext(areatype)) + areatype = text2path(areatype) if(isarea(areatype)) var/area/areatemp = areatype areatype = areatemp.type @@ -722,8 +751,10 @@ Turf and target are seperate in case you want to teleport some distance from a t //Takes: Area type as text string or as typepath OR an instance of the area. //Returns: A list of all atoms (objs, turfs, mobs) in areas of that type of that type in the world. /proc/get_area_all_atoms(areatype) - if(!areatype) return null - if(istext(areatype)) areatype = text2path(areatype) + if(!areatype) + return null + if(istext(areatype)) + areatype = text2path(areatype) if(isarea(areatype)) var/area/areatemp = areatype areatype = areatemp.type @@ -761,15 +792,24 @@ Turf and target are seperate in case you want to teleport some distance from a t return /proc/parse_zone(zone) - if(zone == "r_hand") return "right hand" - else if (zone == "l_hand") return "left hand" - else if (zone == "l_arm") return "left arm" - else if (zone == "r_arm") return "right arm" - else if (zone == "l_leg") return "left leg" - else if (zone == "r_leg") return "right leg" - else if (zone == "l_foot") return "left foot" - else if (zone == "r_foot") return "right foot" - else return zone + if(zone == "r_hand") + return "right hand" + else if (zone == "l_hand") + return "left hand" + else if (zone == "l_arm") + return "left arm" + else if (zone == "r_arm") + return "right arm" + else if (zone == "l_leg") + return "left leg" + else if (zone == "r_leg") + return "right leg" + else if (zone == "l_foot") + return "left foot" + else if (zone == "r_foot") + return "right foot" + else + return zone //Gets the turf this atom inhabits diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 74d90a37576..aa10b0b2793 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -304,22 +304,31 @@ // Simple helper to face what you clicked on, in case it should be needed in more than one place /mob/proc/face_atom(atom/A) - if( buckled || stat != CONSCIOUS || !A || !x || !y || !A.x || !A.y ) return + if( buckled || stat != CONSCIOUS || !A || !x || !y || !A.x || !A.y ) + return var/dx = A.x - x var/dy = A.y - y if(!dx && !dy) // Wall items are graphically shifted but on the floor - if(A.pixel_y > 16) dir = NORTH - else if(A.pixel_y < -16)dir = SOUTH - else if(A.pixel_x > 16) dir = EAST - else if(A.pixel_x < -16)dir = WEST + if(A.pixel_y > 16) + dir = NORTH + else if(A.pixel_y < -16) + dir = SOUTH + else if(A.pixel_x > 16) + dir = EAST + else if(A.pixel_x < -16) + dir = WEST return if(abs(dx) < abs(dy)) - if(dy > 0) dir = NORTH - else dir = SOUTH + if(dy > 0) + dir = NORTH + else + dir = SOUTH else - if(dx > 0) dir = EAST - else dir = WEST + if(dx > 0) + dir = EAST + else + dir = WEST /obj/screen/click_catcher icon = 'icons/mob/screen_full.dmi' diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 1171a9aa5c9..9ab93a6695a 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -18,7 +18,8 @@ for(var/datum/mutation/human/HM in dna.mutations) override += HM.on_attack_hand(src, A) - if(override) return + if(override) + return A.attack_hand(src) @@ -79,7 +80,8 @@ /mob/living/carbon/monkey/RestrainedClickOn(atom/A) if(..()) return - if(a_intent != "harm" || !ismob(A)) return + if(a_intent != "harm" || !ismob(A)) + return if(is_muzzled()) return var/mob/living/carbon/ML = A @@ -92,7 +94,8 @@ ML.apply_damage(rand(1,3), BRUTE, affecting, armor) ML.visible_message("[name] bites [ML]!", \ "[name] bites [ML]!") - if(armor >= 2) return + if(armor >= 2) + return for(var/datum/disease/D in viruses) ML.ForceContractDisease(D) else diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index 4a32ac96510..1fb7b369327 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -11,7 +11,8 @@ var/const/tk_maxrange = 15 By default, emulate the user's unarmed attack */ /atom/proc/attack_tk(mob/user) - if(user.stat) return + if(user.stat) + return user.UnarmedAttack(src,0) // attack_hand, attack_paw, etc return @@ -29,7 +30,8 @@ var/const/tk_maxrange = 15 attack_self(user) /obj/attack_tk(mob/user) - if(user.stat) return + if(user.stat) + return if(anchored) ..() return @@ -41,7 +43,8 @@ var/const/tk_maxrange = 15 return /obj/item/attack_tk(mob/user) - if(user.stat) return + if(user.stat) + return var/obj/item/tk_grab/O = new(src) user.put_in_active_hand(O) O.host = user @@ -86,7 +89,8 @@ var/const/tk_maxrange = 15 //stops TK grabs being equipped anywhere but into hands /obj/item/tk_grab/equipped(mob/user, slot) - if( (slot == slot_l_hand) || (slot== slot_r_hand) ) return + if( (slot == slot_l_hand) || (slot== slot_r_hand) ) + return qdel(src) return @@ -96,8 +100,10 @@ var/const/tk_maxrange = 15 focus.attack_self_tk(user) /obj/item/tk_grab/afterattack(atom/target, mob/living/carbon/user, proximity, params)//TODO: go over this - if(!target || !user) return - if(last_throw+3 > world.time) return + if(!target || !user) + return + if(last_throw+3 > world.time) + return if(!host || host != user) qdel(src) return @@ -148,7 +154,8 @@ var/const/tk_maxrange = 15 /obj/item/tk_grab/proc/focus_object(obj/target, mob/living/user) - if(!istype(target,/obj)) return//Cant throw non objects atm might let it do mobs later + if(!istype(target,/obj)) + return//Cant throw non objects atm might let it do mobs later if(target.anchored || !isturf(target.loc)) qdel(src) return @@ -159,7 +166,8 @@ var/const/tk_maxrange = 15 /obj/item/tk_grab/proc/apply_focus_overlay() - if(!focus) return + if(!focus) + return var/obj/effect/overlay/O = new /obj/effect/overlay(locate(focus.x,focus.y,focus.z)) O.name = "sparkles" O.anchored = 1 @@ -187,12 +195,15 @@ var/const/tk_maxrange = 15 /obj/item/tk_grab/proc/check_path() var/turf/ref = get_turf(src.loc) var/turf/target = get_turf(focus.loc) - if(!ref || !target) return 0 + if(!ref || !target) + return 0 var/distance = get_dist(ref, target) - if(distance >= 10) return 0 + if(distance >= 10) + return 0 for(var/i = 1 to distance) ref = get_step_to(ref, target, 0) - if(ref != target) return 0 + if(ref != target) + return 0 return 1 */ @@ -200,7 +211,8 @@ var/const/tk_maxrange = 15 /* if(istype(user, /mob/living/carbon)) if(user:mutations & TK && get_dist(source, user) <= 7) - if(user:get_active_hand()) return 0 + if(user:get_active_hand()) + return 0 var/X = source:x var/Y = source:y var/Z = source:z diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index 1846247a260..744af3376e6 100644 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -835,20 +835,20 @@ var/list/teleportlocs = list() icon_state = "armory" /* - New() - ..() +/area/security/transfer/New() + ..() - spawn(10) //let objects set up first - for(var/turf/turfToGrayscale in src) - if(turfToGrayscale.icon) - var/icon/newIcon = icon(turfToGrayscale.icon) + spawn(10) //let objects set up first + for(var/turf/turfToGrayscale in src) + if(turfToGrayscale.icon) + var/icon/newIcon = icon(turfToGrayscale.icon) + newIcon.GrayScale() + turfToGrayscale.icon = newIcon + for(var/obj/objectToGrayscale in turfToGrayscale) //1 level deep, means tables, apcs, locker, etc, but not locker contents + if(objectToGrayscale.icon) + var/icon/newIcon = icon(objectToGrayscale.icon) newIcon.GrayScale() - turfToGrayscale.icon = newIcon - for(var/obj/objectToGrayscale in turfToGrayscale) //1 level deep, means tables, apcs, locker, etc, but not locker contents - if(objectToGrayscale.icon) - var/icon/newIcon = icon(objectToGrayscale.icon) - newIcon.GrayScale() - objectToGrayscale.icon = newIcon + objectToGrayscale.icon = newIcon */ /area/security/nuke_storage diff --git a/code/game/atoms.dm b/code/game/atoms.dm index efe8e4883fd..1da001b3fff 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -90,11 +90,11 @@ /*//Convenience proc to see whether a container can be accessed in a certain way. - proc/can_subract_container() - return flags & EXTRACT_CONTAINER +/atom/proc/can_subract_container() + return flags & EXTRACT_CONTAINER - proc/can_add_container() - return flags & INSERT_CONTAINER +/atom/proc/can_add_container() + return flags & INSERT_CONTAINER */ @@ -302,11 +302,13 @@ var/list/blood_splatter_icons = list() B.blood_DNA[M.dna.unique_enzymes] = M.dna.blood_type else if(istype(M, /mob/living/carbon/alien)) var/obj/effect/decal/cleanable/xenoblood/B = locate() in contents - if(!B) B = new(src) + if(!B) + B = new(src) B.blood_DNA["UNKNOWN BLOOD"] = "X*" else if(istype(M, /mob/living/silicon/robot)) var/obj/effect/decal/cleanable/oil/B = locate() in contents - if(!B) B = new(src) + if(!B) + B = new(src) /atom/proc/clean_blood() if(istype(blood_DNA, /list)) diff --git a/code/game/gamemodes/factions.dm b/code/game/gamemodes/factions.dm index 587f75b90ef..66fb31a5690 100644 --- a/code/game/gamemodes/factions.dm +++ b/code/game/gamemodes/factions.dm @@ -23,8 +23,8 @@ var/uplink_contents // the contents of the uplink - proc/assign_objectives(var/datum/mind/traitor) - ..() +/datum/faction/syndicate/proc/assign_objectives(var/datum/mind/traitor) + ..() /* ----- Begin defining syndicate factions ------ */ diff --git a/code/game/machinery/telecomms/machines/receiver.dm b/code/game/machinery/telecomms/machines/receiver.dm index 071828fced2..b1dc2b53c92 100644 --- a/code/game/machinery/telecomms/machines/receiver.dm +++ b/code/game/machinery/telecomms/machines/receiver.dm @@ -88,8 +88,8 @@ freq_listening = list(COMM_FREQ, ENG_FREQ, SEC_FREQ) //command, engineering, security //Common and other radio frequencies for people to freely use - New() - for(var/i = 1441, i < 1489, i += 2) - freq_listening |= i - ..() +/obj/machinery/telecomms/receiver/preset_right/New() + for(var/i = 1441, i < 1489, i += 2) + freq_listening |= i + ..() diff --git a/code/game/objects/items/devices/radio/beacon.dm b/code/game/objects/items/devices/radio/beacon.dm index b075905dd01..3c372f71657 100644 --- a/code/game/objects/items/devices/radio/beacon.dm +++ b/code/game/objects/items/devices/radio/beacon.dm @@ -26,7 +26,7 @@ return /* -/obj/item/device/radio/beacon/bacon //Probably a better way of doing this, I'm lazy. - proc/digest_delay() - spawn(600) - qdel(src)*/ //Bacon beacons are no more rip in peace \ No newline at end of file +//Probably a better way of doing this, I'm lazy. +/obj/item/device/radio/beacon/bacon/proc/digest_delay() + spawn(600) + qdel(src)*/ //Bacon beacons are no more rip in peace \ No newline at end of file diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index b2db790d174..4587104e2d1 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -56,18 +56,23 @@ return ..() /obj/item/stack/sheet/glass/proc/construct_window(mob/user) - if(!user || !src) return 0 - if(!istype(user.loc,/turf)) return 0 + if(!user || !src) + return 0 + if(!istype(user.loc,/turf)) + return 0 if(!user.IsAdvancedToolUser()) user << "You don't have the dexterity to do this!" return 0 - if(zero_amount()) return 0 + if(zero_amount()) + return 0 var/title = "Sheet-Glass" title += " ([src.get_amount()] sheet\s left)" switch(alert(title, "Would you like full tile glass or one direction?", "One Direction", "Full Window", "Cancel", null)) if("One Direction") - if(!src) return 1 - if(src.loc != user) return 1 + if(!src) + return 1 + if(src.loc != user) + return 1 var/list/directions = new/list(cardinal) var/i = 0 @@ -101,8 +106,10 @@ src.use(1) W.add_fingerprint(user) if("Full Window") - if(!src) return 1 - if(src.loc != user) return 1 + if(!src) + return 1 + if(src.loc != user) + return 1 if(src.get_amount() < 2) user << "You need more glass to do that!" return 1 @@ -153,8 +160,10 @@ construct_window(user) /obj/item/stack/sheet/rglass/proc/construct_window(mob/user) - if(!user || !src) return 0 - if(!istype(user.loc,/turf)) return 0 + if(!user || !src) + return 0 + if(!istype(user.loc,/turf)) + return 0 if(!user.IsAdvancedToolUser()) user << "You don't have the dexterity to do this!" return 0 @@ -162,8 +171,10 @@ title += " ([src.get_amount()] sheet\s left)" switch(input(title, "Would you like full tile glass a one direction glass pane or a windoor?") in list("One Direction", "Full Window", "Windoor", "Cancel")) if("One Direction") - if(!src) return 1 - if(src.loc != user) return 1 + if(!src) + return 1 + if(src.loc != user) + return 1 var/list/directions = new/list(cardinal) var/i = 0 for (var/obj/structure/window/win in user.loc) @@ -197,8 +208,10 @@ src.use(1) if("Full Window") - if(!src) return 1 - if(src.loc != user) return 1 + if(!src) + return 1 + if(src.loc != user) + return 1 if(src.get_amount() < 2) user << "You need more glass to do that!" return 1 @@ -290,7 +303,8 @@ pixel_y = rand(-5, 5) /obj/item/weapon/shard/afterattack(atom/A as mob|obj, mob/user, proximity) - if(!proximity || !(src in user)) return + if(!proximity || !(src in user)) + return if(isturf(A)) return if(istype(A, /obj/item/weapon/storage)) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index c1c8fef41a7..2bdeba77802 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -222,7 +222,8 @@ /obj/item/stack/attack_hand(mob/user) if (user.get_inactive_hand() == src) - if(zero_amount()) return + if(zero_amount()) + return var/obj/item/stack/F = new src.type(user, 1) . = F F.copy_evidences(src) @@ -263,12 +264,13 @@ var/time = 0 var/one_per_turf = 0 var/on_floor = 0 - New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = 0, on_floor = 0) - src.title = title - src.result_type = result_type - src.req_amount = req_amount - src.res_amount = res_amount - src.max_res_amount = max_res_amount - src.time = time - src.one_per_turf = one_per_turf - src.on_floor = on_floor + +/datum/stack_recipe/New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = 0, on_floor = 0) + src.title = title + src.result_type = result_type + src.req_amount = req_amount + src.res_amount = res_amount + src.max_res_amount = max_res_amount + src.time = time + src.one_per_turf = one_per_turf + src.on_floor = on_floor diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 7ff548f6db8..8b43d98082e 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -69,7 +69,8 @@ /obj/item/weapon/card/emag/afterattack(atom/target, mob/user, proximity) var/atom/A = target - if(!proximity) return + if(!proximity) + return A.emag_act(user) /obj/item/weapon/card/id @@ -133,7 +134,8 @@ update_label("John Doe", "Clowny") origin_tech = "syndicate=3" /obj/item/weapon/card/id/syndicate/afterattack(obj/item/weapon/O, mob/user, proximity) - if(!proximity) return + if(!proximity) + return if(istype(O, /obj/item/weapon/card/id)) var/obj/item/weapon/card/id/I = O src.access |= I.access @@ -176,10 +178,11 @@ update_label("John Doe", "Clowny") item_state = "gold_id" registered_name = "Captain" assignment = "Captain" - New() - var/datum/job/captain/J = new/datum/job/captain - access = J.get_access() - ..() + +/obj/item/weapon/card/id/captains_spare/New() + var/datum/job/captain/J = new/datum/job/captain + access = J.get_access() + ..() /obj/item/weapon/card/id/centcom name = "\improper Centcom ID" @@ -187,31 +190,41 @@ update_label("John Doe", "Clowny") icon_state = "centcom" registered_name = "Central Command" assignment = "General" - New() - access = get_all_centcom_access() - ..() + +/obj/item/weapon/card/id/centcom/New() + access = get_all_centcom_access() + ..() + /obj/item/weapon/card/id/ert name = "\improper Centcom ID" desc = "A ERT ID card" icon_state = "centcom" registered_name = "Emergency Response Team Commander" assignment = "Emergency Response Team Commander" - New() access = get_all_accesses()+get_ert_access("commander")-access_change_ids + +/obj/item/weapon/card/id/ert/New() + access = get_all_accesses()+get_ert_access("commander")-access_change_ids /obj/item/weapon/card/id/ert/Security registered_name = "Security Response Officer" assignment = "Security Response Officer" - New() access = get_all_accesses()+get_ert_access("sec")-access_change_ids + +/obj/item/weapon/card/id/ert/Security/New() + access = get_all_accesses()+get_ert_access("sec")-access_change_ids /obj/item/weapon/card/id/ert/Engineer registered_name = "Engineer Response Officer" assignment = "Engineer Response Officer" - New() access = get_all_accesses()+get_ert_access("eng")-access_change_ids + +/obj/item/weapon/card/id/ert/Engineer/New() + access = get_all_accesses()+get_ert_access("eng")-access_change_ids /obj/item/weapon/card/id/ert/Medical registered_name = "Medical Response Officer" assignment = "Medical Response Officer" - New() access = get_all_accesses()+get_ert_access("med")-access_change_ids + +/obj/item/weapon/card/id/ert/Medical/New() + access = get_all_accesses()+get_ert_access("med")-access_change_ids /obj/item/weapon/card/id/prisoner name = "prisoner ID card" diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index b40c8e881b2..ea8a135b4c0 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -197,11 +197,11 @@ var/obj/item/sample_object var/number - New(obj/item/sample) - if(!istype(sample)) - qdel(src) - sample_object = sample - number = 1 +/datum/numbered_display/New(obj/item/sample) + if(!istype(sample)) + qdel(src) + sample_object = sample + number = 1 //This proc determins the size of the inventory to be displayed. Please touch it only if you know what you're doing. @@ -235,7 +235,8 @@ //This proc return 1 if the item can be picked up and 0 if it can't. //Set the stop_messages to stop it from printing messages /obj/item/weapon/storage/proc/can_be_inserted(obj/item/W, stop_messages = 0, mob/user) - if(!istype(W) || (W.flags & ABSTRACT)) return //Not an item + if(!istype(W) || (W.flags & ABSTRACT)) + return //Not an item if(loc == W) return 0 //Means the item is already in the storage item @@ -292,7 +293,8 @@ //The stop_warning parameter will stop the insertion message from being displayed. It is intended for cases where you are inserting multiple items at once, //such as when picking up all the items on a tile with one click. /obj/item/weapon/storage/proc/handle_item_insertion(obj/item/W, prevent_warning = 0, mob/user) - if(!istype(W)) return 0 + if(!istype(W)) + return 0 if(usr) if(!usr.unEquip(W)) return 0 @@ -325,7 +327,8 @@ //Call this proc to handle the removal of an item from the storage item. The item will be moved to the atom sent as new_target /obj/item/weapon/storage/proc/remove_from_storage(obj/item/W, atom/new_location, burn = 0) - if(!istype(W)) return 0 + if(!istype(W)) + return 0 if(istype(src, /obj/item/weapon/storage/fancy)) var/obj/item/weapon/storage/fancy/F = src diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 4b7309cd5bc..ce535fbd7e6 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -29,7 +29,8 @@ var/unwieldsound = null /obj/item/weapon/twohanded/proc/unwield(mob/living/carbon/user) - if(!wielded || !user) return + if(!wielded || !user) + return wielded = 0 if(force_unwielded) force = force_unwielded @@ -53,7 +54,8 @@ return /obj/item/weapon/twohanded/proc/wield(mob/living/carbon/user) - if(wielded) return + if(wielded) + return if(istype(user,/mob/living/carbon/monkey) ) user << "It's too heavy for you to wield fully." return @@ -272,13 +274,11 @@ if(wielded) return 1 -/obj/item/weapon/twohanded/dualsaber/green - New() - item_color = "green" +/obj/item/weapon/twohanded/dualsaber/green/New() + item_color = "green" -/obj/item/weapon/twohanded/dualsaber/red - New() - item_color = "red" +/obj/item/weapon/twohanded/dualsaber/red/New() + item_color = "red" /obj/item/weapon/twohanded/dualsaber/attackby(obj/item/weapon/W, mob/user, params) ..() diff --git a/code/modules/clothing/head/soft_caps.dm b/code/modules/clothing/head/soft_caps.dm index 0f6e39d72cf..e4250170a4d 100644 --- a/code/modules/clothing/head/soft_caps.dm +++ b/code/modules/clothing/head/soft_caps.dm @@ -6,16 +6,16 @@ item_color = "cargo" var/flipped = 0 - dropped() - src.icon_state = "[item_color]soft" - src.flipped=0 - ..() +/obj/item/clothing/head/soft/dropped() + src.icon_state = "[item_color]soft" + src.flipped=0 + ..() - verb/flipcap() - set category = "Object" - set name = "Flip cap" +/obj/item/clothing/head/soft/verb/flipcap() + set category = "Object" + set name = "Flip cap" - flip(usr) + flip(usr) /obj/item/clothing/head/soft/AltClick(mob/user) diff --git a/code/modules/detectivework/evidence.dm b/code/modules/detectivework/evidence.dm index 5f290278b75..d277998ef70 100644 --- a/code/modules/detectivework/evidence.dm +++ b/code/modules/detectivework/evidence.dm @@ -84,12 +84,13 @@ /obj/item/weapon/storage/box/evidence name = "evidence bag box" desc = "A box claiming to contain evidence bags." - New() - new /obj/item/weapon/evidencebag(src) - new /obj/item/weapon/evidencebag(src) - new /obj/item/weapon/evidencebag(src) - new /obj/item/weapon/evidencebag(src) - new /obj/item/weapon/evidencebag(src) - new /obj/item/weapon/evidencebag(src) - ..() - return \ No newline at end of file + +/obj/item/weapon/storage/box/evidence/New() + new /obj/item/weapon/evidencebag(src) + new /obj/item/weapon/evidencebag(src) + new /obj/item/weapon/evidencebag(src) + new /obj/item/weapon/evidencebag(src) + new /obj/item/weapon/evidencebag(src) + new /obj/item/weapon/evidencebag(src) + ..() + return \ No newline at end of file diff --git a/code/modules/food&drinks/food/snacks.dm b/code/modules/food&drinks/food/snacks.dm index ec95ab2298d..39c44dbe357 100644 --- a/code/modules/food&drinks/food/snacks.dm +++ b/code/modules/food&drinks/food/snacks.dm @@ -259,7 +259,7 @@ // name = "Xenoburger" //Name that displays in the UI. // desc = "Smells caustic. Tastes like heresy." //Duh // icon_state = "xburger" //Refers to an icon in food.dmi -// New() //Don't mess with this. +///obj/item/weapon/reagent_containers/food/snacks/xenoburger/New() //Don't mess with this. // ..() //Same here. // reagents.add_reagent("xenomicrobes", 10) //This is what is in the food item. you may copy/paste // reagents.add_reagent("nutriment", 2) // this line of code for all the contents. diff --git a/code/modules/holodeck/holo_effect.dm b/code/modules/holodeck/holo_effect.dm index e547b1ca813..d0beeca9d4d 100644 --- a/code/modules/holodeck/holo_effect.dm +++ b/code/modules/holodeck/holo_effect.dm @@ -8,17 +8,20 @@ icon = 'icons/mob/screen_gen.dmi' icon_state = "x2" invisibility = 101 - proc/activate(var/obj/machinery/computer/holodeck/HC) - return - proc/deactivate(var/obj/machinery/computer/holodeck/HC) - qdel(src) - return - // Called by the holodeck computer as long as the program is running - proc/tick(var/obj/machinery/computer/holodeck/HC) - return - proc/safety(var/active) - return +/obj/effect/holodeck_effect/proc/activate(var/obj/machinery/computer/holodeck/HC) + return + +/obj/effect/holodeck_effect/proc/deactivate(var/obj/machinery/computer/holodeck/HC) + qdel(src) + return + +// Called by the holodeck computer as long as the program is running +/obj/effect/holodeck_effect/proc/tick(var/obj/machinery/computer/holodeck/HC) + return + +/obj/effect/holodeck_effect/proc/safety(var/active) + return // Generates a holodeck-tracked card deck @@ -34,7 +37,8 @@ return D /obj/effect/holodeck_effect/cards/safety(active) - if(!D) return + if(!D) + return if(active) D.card_hitsound = null D.card_force = 0 @@ -67,7 +71,8 @@ var/mob/mob = null /obj/effect/holodeck_effect/mobspawner/activate(var/obj/machinery/computer/holodeck/HC) - if(islist(mobtype)) mobtype = pick(mobtype) + if(islist(mobtype)) + mobtype = pick(mobtype) mob = new mobtype(loc) // these vars are not really standardized but all would theoretically create stuff on death @@ -76,7 +81,8 @@ return mob /obj/effect/holodeck_effect/mobspawner/deactivate(var/obj/machinery/computer/holodeck/HC) - if(mob) HC.derez(mob) + if(mob) + HC.derez(mob) qdel(src) /obj/effect/holodeck_effect/mobspawner/pet @@ -84,4 +90,4 @@ /mob/living/simple_animal/butterfly, /mob/living/simple_animal/chick/holo, /mob/living/simple_animal/pet/cat, /mob/living/simple_animal/pet/cat/kitten, /mob/living/simple_animal/pet/dog/corgi, /mob/living/simple_animal/pet/dog/corgi/puppy, - /mob/living/simple_animal/pet/dog/pug, /mob/living/simple_animal/pet/fox) \ No newline at end of file + /mob/living/simple_animal/pet/dog/pug, /mob/living/simple_animal/pet/fox) diff --git a/code/modules/holodeck/items.dm b/code/modules/holodeck/items.dm index 769db5bddc7..d8c03fe3c8f 100644 --- a/code/modules/holodeck/items.dm +++ b/code/modules/holodeck/items.dm @@ -23,13 +23,11 @@ armour_penetration = 50 var/active = 0 -/obj/item/weapon/holo/esword/green - New() - item_color = "green" +/obj/item/weapon/holo/esword/green/New() + item_color = "green" -/obj/item/weapon/holo/esword/red - New() - item_color = "red" +/obj/item/weapon/holo/esword/red/New() + item_color = "red" /obj/item/weapon/holo/esword/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance) if(active) diff --git a/code/modules/mining/machine_input_output_plates.dm b/code/modules/mining/machine_input_output_plates.dm index e17cc7107f9..0049c86ae92 100644 --- a/code/modules/mining/machine_input_output_plates.dm +++ b/code/modules/mining/machine_input_output_plates.dm @@ -6,8 +6,9 @@ name = "Input area" density = 0 anchored = 1 - New() - icon_state = "blank" + +/obj/machinery/mineral/input/New() + icon_state = "blank" /obj/machinery/mineral/output icon = 'icons/mob/screen_gen.dmi' @@ -15,8 +16,9 @@ name = "Output area" density = 0 anchored = 1 - New() - icon_state = "blank" + +/obj/machinery/mineral/output/New() + icon_state = "blank" /obj/machinery/mineral var/input_dir = NORTH diff --git a/code/modules/mob/interactive.dm b/code/modules/mob/interactive.dm index 44ecafca878..41aa42d45de 100644 --- a/code/modules/mob/interactive.dm +++ b/code/modules/mob/interactive.dm @@ -634,26 +634,23 @@ nearby += M //END OF MODULES -/mob/living/carbon/human/interactive/angry - New() - TRAITS |= TRAIT_ROBUST - TRAITS |= TRAIT_MEAN - faction = list("bot_angry") - ..() +/mob/living/carbon/human/interactive/angry/New() + TRAITS |= TRAIT_ROBUST + TRAITS |= TRAIT_MEAN + faction = list("bot_angry") + ..() -/mob/living/carbon/human/interactive/friendly - New() - TRAITS |= TRAIT_FRIENDLY - TRAITS |= TRAIT_UNROBUST - faction = list("bot_friendly") - ..() +/mob/living/carbon/human/interactive/friendly/New() + TRAITS |= TRAIT_FRIENDLY + TRAITS |= TRAIT_UNROBUST + faction = list("bot_friendly") + ..() -/mob/living/carbon/human/interactive/greytide - New() - TRAITS |= TRAIT_ROBUST - TRAITS |= TRAIT_MEAN - TRAITS |= TRAIT_THIEVING - TRAITS |= TRAIT_DUMB - faction = list("bot_grey") - graytide = 1 - ..() +/mob/living/carbon/human/interactive/greytide/New() + TRAITS |= TRAIT_ROBUST + TRAITS |= TRAIT_MEAN + TRAITS |= TRAIT_THIEVING + TRAITS |= TRAIT_DUMB + faction = list("bot_grey") + graytide = 1 + ..() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index e6a44bb99a8..f5ffb053051 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -83,7 +83,8 @@ return "[mode_name[mode]]" /mob/living/simple_animal/bot/proc/turn_on() - if(stat) return 0 + if(stat) + return 0 on = 1 SetLuminosity(initial(luminosity)) update_icon() diff --git a/code/modules/mob/living/simple_animal/bot/construction.dm b/code/modules/mob/living/simple_animal/bot/construction.dm index c945aff44fc..01afccc9566 100644 --- a/code/modules/mob/living/simple_animal/bot/construction.dm +++ b/code/modules/mob/living/simple_animal/bot/construction.dm @@ -51,8 +51,10 @@ if(istype(W, /obj/item/weapon/pen)) var/t = stripped_input(user, "Enter new robot name", name, created_name,MAX_NAME_LEN) - if(!t) return - if(!in_range(src, usr) && loc != usr) return + if(!t) + return + if(!in_range(src, usr) && loc != usr) + return created_name = t return diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index e6a11108acd..bfb95d5d498 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -97,8 +97,10 @@ /mob/living/simple_animal/pet/cat/attack_hand(mob/living/carbon/human/M) . = ..() switch(M.a_intent) - if("help") wuv(1,M) - if("harm") wuv(-1,M) + if("help") + wuv(1,M) + if("harm") + wuv(-1,M) /mob/living/simple_animal/pet/cat/proc/wuv(change, mob/M) if(change) diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 9fcc023c4b2..88af1143648 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -210,7 +210,8 @@ return if(inventory_head) - if(user) user << "You can't put more than one hat on [src]!" + if(user) + user << "You can't put more than one hat on [src]!" return if(!item_to_add) user.visible_message("[user] pets [src].","You rest your hand on [src]'s head for a moment.") @@ -378,7 +379,7 @@ emote_see = list("plays tricks.", "slips.") else special_hat = 0 - + var/special_back = 0 if(inventory_back) special_back = 1 @@ -571,8 +572,10 @@ /mob/living/simple_animal/pet/dog/attack_hand(mob/living/carbon/human/M) . = ..() switch(M.a_intent) - if("help") wuv(1,M) - if("harm") wuv(-1,M) + if("help") + wuv(1,M) + if("harm") + wuv(-1,M) /mob/living/simple_animal/pet/dog/proc/wuv(change, mob/M) if(change) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm index b717b0ac252..3efd4d48f15 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm @@ -81,8 +81,10 @@ /mob/living/simple_animal/drone/equip_to_slot(obj/item/I, slot) - if(!slot) return - if(!istype(I)) return + if(!slot) + return + if(!istype(I)) + return if(I == l_hand) l_hand = null diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate.dm b/code/modules/mob/living/simple_animal/hostile/syndicate.dm index 7e037b9b5f5..0eb03cb8083 100644 --- a/code/modules/mob/living/simple_animal/hostile/syndicate.dm +++ b/code/modules/mob/living/simple_animal/hostile/syndicate.dm @@ -46,7 +46,8 @@ health = 170 /mob/living/simple_animal/hostile/syndicate/melee/bullet_act(obj/item/projectile/Proj) - if(!Proj) return + if(!Proj) + return if(prob(50)) if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) src.health -= Proj.damage diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index 1774f2e592d..366540b2b0b 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -24,7 +24,8 @@ /mob/living/simple_animal/slime/proc/AIprocess() // the master AI process - if(AIproc || stat == DEAD || client) return + if(AIproc || stat == DEAD || client) + return var/hungry = 0 if (nutrition < get_starve_nutrition()) @@ -94,7 +95,8 @@ break var/sleeptime = movement_delay() - if(sleeptime <= 0) sleeptime = 1 + if(sleeptime <= 0) + sleeptime = 1 sleep(sleeptime + 2) // this is about as fast as a player slime can go @@ -253,7 +255,8 @@ else canmove = 1 - if(attacked > 50) attacked = 50 + if(attacked > 50) + attacked = 50 if(attacked > 0) attacked-- @@ -261,15 +264,18 @@ if(Discipline > 0) if(Discipline >= 5 && rabid) - if(prob(60)) rabid = 0 + if(prob(60)) + rabid = 0 if(prob(10)) Discipline-- if(!client) - if(!canmove) return + if(!canmove) + return - if(buckled) return // if it's eating someone already, continue eating! + if(buckled) + return // if it's eating someone already, continue eating! if(Target) --target_patience @@ -277,7 +283,8 @@ target_patience = 0 Target = null - if(AIproc && SStun) return + if(AIproc && SStun) + return var/hungry = 0 // determines if the slime is hungry @@ -476,11 +483,14 @@ if (L in Friends) t += 20 friends_near += L - if (nutrition < get_hunger_nutrition()) t += 10 - if (nutrition < get_starve_nutrition()) t += 10 + if (nutrition < get_hunger_nutrition()) + t += 10 + if (nutrition < get_starve_nutrition()) + t += 10 if (prob(2) && prob(t)) var/phrases = list() - if (Target) phrases += "[Target]... looks tasty..." + if (Target) + phrases += "[Target]... looks tasty..." if (nutrition < get_starve_nutrition()) phrases += "So... hungry..." phrases += "Very... hungry..." @@ -512,13 +522,20 @@ if (buckled) phrases += "Nom..." phrases += "Tasty..." - if (powerlevel > 3) phrases += "Bzzz..." - if (powerlevel > 5) phrases += "Zap..." - if (powerlevel > 8) phrases += "Zap... Bzz..." - if (mood == "sad") phrases += "Bored..." - if (slimes_near) phrases += "Brother..." - if (slimes_near > 1) phrases += "Brothers..." - if (dead_slimes) phrases += "What happened?" + if (powerlevel > 3) + phrases += "Bzzz..." + if (powerlevel > 5) + phrases += "Zap..." + if (powerlevel > 8) + phrases += "Zap... Bzz..." + if (mood == "sad") + phrases += "Bored..." + if (slimes_near) + phrases += "Brother..." + if (slimes_near > 1) + phrases += "Brothers..." + if (dead_slimes) + phrases += "What happened?" if (!slimes_near) phrases += "Lonely..." for (var/M in friends_near) @@ -528,24 +545,36 @@ say (pick(phrases)) /mob/living/simple_animal/slime/proc/get_max_nutrition() // Can't go above it - if (is_adult) return 1200 - else return 1000 + if (is_adult) + return 1200 + else + return 1000 /mob/living/simple_animal/slime/proc/get_grow_nutrition() // Above it we grow, below it we can eat - if (is_adult) return 1000 - else return 800 + if (is_adult) + return 1000 + else + return 800 /mob/living/simple_animal/slime/proc/get_hunger_nutrition() // Below it we will always eat - if (is_adult) return 600 - else return 500 + if (is_adult) + return 600 + else + return 500 /mob/living/simple_animal/slime/proc/get_starve_nutrition() // Below it we will eat before everything else - if(is_adult) return 300 - else return 200 + if(is_adult) + return 300 + else + return 200 /mob/living/simple_animal/slime/proc/will_hunt(hunger = -1) // Check for being stopped from feeding and chasing - if (docile) return 0 - if (hunger == 2 || rabid || attacked) return 1 - if (Leader) return 0 - if (holding_still) return 0 + if (docile) + return 0 + if (hunger == 2 || rabid || attacked) + return 1 + if (Leader) + return 0 + if (holding_still) + return 0 return 1 diff --git a/code/modules/mob/living/simple_animal/slime/powers.dm b/code/modules/mob/living/simple_animal/slime/powers.dm index 286b63ad9d1..aef7334cc5b 100644 --- a/code/modules/mob/living/simple_animal/slime/powers.dm +++ b/code/modules/mob/living/simple_animal/slime/powers.dm @@ -44,7 +44,8 @@ choices += C var/mob/living/M = input(src,"Who do you wish to feed on?") in null|choices - if(!M) return 0 + if(!M) + return 0 if(CanFeedon(M)) Feedon(M) return 1 @@ -159,9 +160,11 @@ M.colour = slime_mutation[rand(1,4)] else M.colour = colour - if(ckey) M.nutrition = new_nutrition //Player slimes are more robust at spliting. Once an oversight of poor copypasta, now a feature! + if(ckey) + M.nutrition = new_nutrition //Player slimes are more robust at spliting. Once an oversight of poor copypasta, now a feature! M.powerlevel = new_powerlevel - if(i != 1) step_away(M,src) + if(i != 1) + step_away(M,src) M.Friends = Friends.Copy() babies += M M.mutation_chance = Clamp(mutation_chance+(rand(5,-5)),0,100) diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 12243cf713a..598a031ba2d 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -133,12 +133,18 @@ if(!client && powerlevel > 0) var/probab = 10 switch(powerlevel) - if(1 to 2) probab = 20 - if(3 to 4) probab = 30 - if(5 to 6) probab = 40 - if(7 to 8) probab = 60 - if(9) probab = 70 - if(10) probab = 95 + if(1 to 2) + probab = 20 + if(3 to 4) + probab = 30 + if(5 to 6) + probab = 40 + if(7 to 8) + probab = 60 + if(9) + probab = 70 + if(10) + probab = 95 if(prob(probab)) if(istype(O, /obj/structure/window) || istype(O, /obj/structure/grille)) if(nutrition <= get_hunger_nutrition() && !Atkcool) diff --git a/code/modules/mob/living/simple_animal/worm.dm b/code/modules/mob/living/simple_animal/worm.dm index f17d5a6ad9a..5ddc3aeb993 100644 --- a/code/modules/mob/living/simple_animal/worm.dm +++ b/code/modules/mob/living/simple_animal/worm.dm @@ -44,156 +44,156 @@ var/atom/currentlyEating //what the worm is currently eating var/eatingDuration = 0 //how long he's been eating it for - head - name = "space worm head" - icon_state = "spacewormhead" - icon_living = "spacewormhead" - icon_dead = "spacewormdead" +/mob/living/simple_animal/space_worm/head + name = "space worm head" + icon_state = "spacewormhead" + icon_living = "spacewormhead" + icon_dead = "spacewormdead" - maxHealth = 20 - health = 20 + maxHealth = 20 + health = 20 - melee_damage_lower = 10 - melee_damage_upper = 15 - attacktext = "bites" + melee_damage_lower = 10 + melee_damage_upper = 15 + attacktext = "bites" - animate_movement = SLIDE_STEPS + animate_movement = SLIDE_STEPS - New(var/location, var/segments = 6) - ..() +/mob/living/simple_animal/space_worm/head/New(var/location, var/segments = 6) + ..() - var/mob/living/simple_animal/space_worm/current = src + var/mob/living/simple_animal/space_worm/current = src - for(var/i = 1 to segments) - var/mob/living/simple_animal/space_worm/newSegment = new /mob/living/simple_animal/space_worm(loc) - current.Attach(newSegment) - current = newSegment + for(var/i = 1 to segments) + var/mob/living/simple_animal/space_worm/newSegment = new /mob/living/simple_animal/space_worm(loc) + current.Attach(newSegment) + current = newSegment - update_icon() - if(stat == CONSCIOUS || stat == UNCONSCIOUS) - icon_state = "spacewormhead[previous?1:0]" - if(previous) - dir = get_dir(previous,src) - else - icon_state = "spacewormheaddead" +/mob/living/simple_animal/space_worm/head/update_icon() + if(stat == CONSCIOUS || stat == UNCONSCIOUS) + icon_state = "spacewormhead[previous?1:0]" + if(previous) + dir = get_dir(previous,src) + else + icon_state = "spacewormheaddead" - Life() - ..() +/mob/living/simple_animal/space_worm/Life() + ..() - if(next && !(next in view(src,1))) - Detach() + if(next && !(next in view(src,1))) + Detach() - if(stat == DEAD) //dead chunks fall off and die immediately - if(previous) - previous.Detach() - if(next) - Detach(1) - - if(prob(stomachProcessProbability)) - ProcessStomach() - - update_icon() - - return - - Delete() //if a chunk a destroyed, make a new worm out of the split halves + if(stat == DEAD) //dead chunks fall off and die immediately if(previous) previous.Detach() - ..() + if(next) + Detach(1) - Move() - var/attachementNextPosition = loc - if(..()) - if(previous) - previous.Move(attachementNextPosition) - update_icon() + if(prob(stomachProcessProbability)) + ProcessStomach() - Bump(atom/obstacle) - if(currentlyEating != obstacle) - currentlyEating = obstacle - eatingDuration = 0 + update_icon() - if(!AttemptToEat(obstacle)) - eatingDuration++ - else - currentlyEating = null - eatingDuration = 0 + return - return - - proc/update_icon() //only for the sake of consistency with the other update icon procs - if(stat == CONSCIOUS || stat == UNCONSCIOUS) - if(previous) //midsection - icon_state = "spaceworm[get_dir(src,previous) | get_dir(src,next)]" //see 3 lines below - else //tail - icon_state = "spacewormtail" - dir = get_dir(src,next) //next will always be present since it's not a head and if it's dead, it goes in the other if branch - else - icon_state = "spacewormdead" - - return - - proc/AttemptToEat(atom/target) - if(istype(target,/turf/simulated/wall)) - if((!istype(target,/turf/simulated/wall/r_wall) && eatingDuration >= 100) || eatingDuration >= 200) //need 20 ticks to eat an rwall, 10 for a regular one - var/turf/simulated/wall/wall = target - wall.ChangeTurf(/turf/simulated/floor/plasteel) - new /obj/item/stack/sheet/metal(src, flatPlasmaValue) - return 1 - else if(istype(target,/atom/movable)) - if(istype(target,/mob) || eatingDuration >= 50) //5 ticks to eat stuff like airlocks - var/atom/movable/objectOrMob = target - contents += objectOrMob - return 1 - - return 0 - - proc/Attach(mob/living/simple_animal/space_worm/attachement) - if(!attachement) - return - - previous = attachement - attachement.next = src - - return - - proc/Detach(die = 0) - var/mob/living/simple_animal/space_worm/newHead = new /mob/living/simple_animal/space_worm/head(loc,0) - var/mob/living/simple_animal/space_worm/newHeadPrevious = previous - - previous = null //so that no extra heads are spawned - - newHead.Attach(newHeadPrevious) - - if(die) - newHead.Die() - - qdel(src) - - proc/ProcessStomach() - for(var/atom/movable/stomachContent in contents) - if(prob(digestionProbability)) - if(istype(stomachContent,/obj/item/stack)) //converts to plasma, keeping the stack value - if(!istype(stomachContent,/obj/item/stack/sheet/mineral/plasma)) - var/obj/item/stack/oldStack = stomachContent - new /obj/item/stack/sheet/mineral/plasma(src, oldStack.amount) - qdel(oldStack) - continue - else if(istype(stomachContent,/obj/item)) //converts to plasma, keeping the w_class - var/obj/item/oldItem = stomachContent - new /obj/item/stack/sheet/mineral/plasma(src, oldItem.w_class) - qdel(oldItem) - continue - else - new /obj/item/stack/sheet/mineral/plasma(src, flatPlasmaValue) //just flat amount - qdel(stomachContent) - continue +/mob/living/simple_animal/space_worm/Delete() //if a chunk a destroyed, make a new worm out of the split halves + if(previous) + previous.Detach() + ..() +/mob/living/simple_animal/space_worm/Move() + var/attachementNextPosition = loc + if(..()) if(previous) - for(var/atom/movable/stomachContent in contents) //transfer it along the digestive tract - previous.contents += stomachContent - else - for(var/atom/movable/stomachContent in contents) //or poop it out - loc.contents += stomachContent + previous.Move(attachementNextPosition) + update_icon() - return \ No newline at end of file +/mob/living/simple_animal/space_worm/Bump(atom/obstacle) + if(currentlyEating != obstacle) + currentlyEating = obstacle + eatingDuration = 0 + + if(!AttemptToEat(obstacle)) + eatingDuration++ + else + currentlyEating = null + eatingDuration = 0 + + return + +/mob/living/simple_animal/space_worm/proc/update_icon() //only for the sake of consistency with the other update icon procs + if(stat == CONSCIOUS || stat == UNCONSCIOUS) + if(previous) //midsection + icon_state = "spaceworm[get_dir(src,previous) | get_dir(src,next)]" //see 3 lines below + else //tail + icon_state = "spacewormtail" + dir = get_dir(src,next) //next will always be present since it's not a head and if it's dead, it goes in the other if branch + else + icon_state = "spacewormdead" + + return + +/mob/living/simple_animal/space_worm/proc/AttemptToEat(atom/target) + if(istype(target,/turf/simulated/wall)) + if((!istype(target,/turf/simulated/wall/r_wall) && eatingDuration >= 100) || eatingDuration >= 200) //need 20 ticks to eat an rwall, 10 for a regular one + var/turf/simulated/wall/wall = target + wall.ChangeTurf(/turf/simulated/floor/plasteel) + new /obj/item/stack/sheet/metal(src, flatPlasmaValue) + return 1 + else if(istype(target,/atom/movable)) + if(istype(target,/mob) || eatingDuration >= 50) //5 ticks to eat stuff like airlocks + var/atom/movable/objectOrMob = target + contents += objectOrMob + return 1 + + return 0 + +/mob/living/simple_animal/space_worm/proc/Attach(mob/living/simple_animal/space_worm/attachement) + if(!attachement) + return + + previous = attachement + attachement.next = src + + return + +/mob/living/simple_animal/space_worm/proc/Detach(die = 0) + var/mob/living/simple_animal/space_worm/newHead = new /mob/living/simple_animal/space_worm/head(loc,0) + var/mob/living/simple_animal/space_worm/newHeadPrevious = previous + + previous = null //so that no extra heads are spawned + + newHead.Attach(newHeadPrevious) + + if(die) + newHead.Die() + + qdel(src) + +/mob/living/simple_animal/space_worm/proc/ProcessStomach() + for(var/atom/movable/stomachContent in contents) + if(prob(digestionProbability)) + if(istype(stomachContent,/obj/item/stack)) //converts to plasma, keeping the stack value + if(!istype(stomachContent,/obj/item/stack/sheet/mineral/plasma)) + var/obj/item/stack/oldStack = stomachContent + new /obj/item/stack/sheet/mineral/plasma(src, oldStack.amount) + qdel(oldStack) + continue + else if(istype(stomachContent,/obj/item)) //converts to plasma, keeping the w_class + var/obj/item/oldItem = stomachContent + new /obj/item/stack/sheet/mineral/plasma(src, oldItem.w_class) + qdel(oldItem) + continue + else + new /obj/item/stack/sheet/mineral/plasma(src, flatPlasmaValue) //just flat amount + qdel(stomachContent) + continue + + if(previous) + for(var/atom/movable/stomachContent in contents) //transfer it along the digestive tract + previous.contents += stomachContent + else + for(var/atom/movable/stomachContent in contents) //or poop it out + loc.contents += stomachContent + + return diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 82f40f51a3a..2c3bae91b6a 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -81,7 +81,8 @@ if(src != usr) return 0 - if(!client) return 0 + if(!client) + return 0 //Determines Relevent Population Cap var/relevant_cap @@ -107,7 +108,8 @@ if(href_list["observe"]) if(alert(src,"Are you sure you wish to observe? You will not be able to play this round!","Player Setup","Yes","No") == "Yes") - if(!client) return 1 + if(!client) + return 1 var/mob/dead/observer/observer = new() spawning = 1 diff --git a/code/modules/mob/new_player/sprite_accessories.dm b/code/modules/mob/new_player/sprite_accessories.dm index 97fec9be03e..b8fb08bb18e 100644 --- a/code/modules/mob/new_player/sprite_accessories.dm +++ b/code/modules/mob/new_player/sprite_accessories.dm @@ -17,20 +17,28 @@ conversion in savefile.dm */ /proc/init_sprite_accessory_subtypes(prototype, list/L, list/male, list/female) - if(!istype(L)) L = list() - if(!istype(male)) male = list() - if(!istype(female)) female = list() + if(!istype(L)) + L = list() + if(!istype(male)) + male = list() + if(!istype(female)) + female = list() for(var/path in typesof(prototype)) - if(path == prototype) continue + if(path == prototype) + continue var/datum/sprite_accessory/D = new path() - if(D.icon_state) L[D.name] = D - else L += D.name + if(D.icon_state) + L[D.name] = D + else + L += D.name switch(D.gender) - if(MALE) male += D.name - if(FEMALE) female += D.name + if(MALE) + male += D.name + if(FEMALE) + female += D.name else male += D.name female += D.name diff --git a/code/modules/ninja/suit/n_suit_verbs/energy_net_nets.dm b/code/modules/ninja/suit/n_suit_verbs/energy_net_nets.dm index 8d82ae40c5d..9a3849e202e 100644 --- a/code/modules/ninja/suit/n_suit_verbs/energy_net_nets.dm +++ b/code/modules/ninja/suit/n_suit_verbs/energy_net_nets.dm @@ -61,8 +61,10 @@ It is possible to destroy the net by the occupant or someone else. health = INFINITY//Make the net invincible so that an explosion/something else won't kill it while, spawn() is running. for(var/obj/item/W in M) if(istype(M,/mob/living/carbon/human)) - if(W==M:w_uniform) continue//So all they're left with are shoes and uniform. - if(W==M:shoes) continue + if(W==M:w_uniform) + continue//So all they're left with are shoes and uniform. + if(W==M:shoes) + continue M.unEquip(W) spawn(0) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index 4d071708fb3..8d6174cbe77 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -114,7 +114,8 @@ if(virgin) for(var/datum/data/record/G in data_core.general) var/datum/data/record/S = find_record("name", G.fields["name"], data_core.security) - if(!S) continue + if(!S) + continue var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src) P.info = "
[content]
" - else if (title && !content) - title = "[title]
" - else if (!title && content) - content = "[content]
" + if (title && content) + title = "[content]
" + else if (title && !content) + title = "[title]
" + else if (!title && content) + content = "[content]
" - //Make our dumb param object - params = {"{ "cursor": "[params]", "screenLoc": "[thing.screen_loc]" }"} + //Make our dumb param object + params = {"{ "cursor": "[params]", "screenLoc": "[thing.screen_loc]" }"} - //Send stuff to the tooltip - src.owner << output(list2params(list(params, src.owner.view, "[title][content]", theme, special)), "[src.control]:tooltip.update") + //Send stuff to the tooltip + src.owner << output(list2params(list(params, src.owner.view, "[title][content]", theme, special)), "[src.control]:tooltip.update") - //If a hide() was hit while we were showing, run hide() again to avoid stuck tooltips - src.showing = 0 - if (src.queueHide) - src.hide() + //If a hide() was hit while we were showing, run hide() again to avoid stuck tooltips + src.showing = 0 + if (src.queueHide) + src.hide() - return 1 + return 1 - proc/hide() - if (src.queueHide) - spawn(1) - winshow(src.owner, src.control, 0) - else +/datum/tooltip/proc/hide() + if (src.queueHide) + spawn(1) winshow(src.owner, src.control, 0) + else + winshow(src.owner, src.control, 0) - src.queueHide = src.showing ? 1 : 0 + src.queueHide = src.showing ? 1 : 0 - return 1 + return 1 /* TG SPECIFIC CODE */ diff --git a/tools/Redirector/Redirector.dm b/tools/Redirector/Redirector.dm index 9ba2096e73c..b19aee82f9d 100644 --- a/tools/Redirector/Redirector.dm +++ b/tools/Redirector/Redirector.dm @@ -18,9 +18,9 @@ var/admin_substr = "admins=" // search for this to locate # of admins world name = "TGstation Redirector" - New() - ..() - gen_configs() +world/New() + ..() + gen_configs() /datum/server var/players = 0