Changes relatives paths into absolute paths and makes some if()'s better

This commit is contained in:
Firecage
2016-01-17 01:36:56 +02:00
parent e5a6113157
commit 754491ce4c
69 changed files with 1294 additions and 857 deletions
+77 -75
View File
@@ -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<font color='red'>[error]</font>"
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<font color='red'>[error]</font>"
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
+36 -37
View File
@@ -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()
/mob/verb/findall_casesensitive(t as text)
results = regEx_findall(t, expression)
world << results.report()
+8 -4
View File
@@ -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.
+2 -1
View File
@@ -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
+13 -8
View File
@@ -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
+73 -41
View File
@@ -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
+24 -12
View File
@@ -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 + .
+40 -20
View File
@@ -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
+128 -64
View File
@@ -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.
+80 -40
View File
@@ -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
+18 -9
View File
@@ -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'
+6 -3
View File
@@ -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("<span class='danger'>[name] bites [ML]!</span>", \
"<span class='userdanger'>[name] bites [ML]!</span>")
if(armor >= 2) return
if(armor >= 2)
return
for(var/datum/disease/D in viruses)
ML.ForceContractDisease(D)
else
+24 -12
View File
@@ -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
+12 -12
View File
@@ -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
+8 -6
View File
@@ -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))
+2 -2
View File
@@ -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 ------ */
@@ -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
..()
@@ -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
//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
+28 -14
View File
@@ -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 << "<span class='warning'>You don't have the dexterity to do this!</span>"
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 << "<span class='warning'>You need more glass to do that!</span>"
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 << "<span class='warning'>You don't have the dexterity to do this!</span>"
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 << "<span class='warning'>You need more glass to do that!</span>"
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))
+12 -10
View File
@@ -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
+26 -13
View File
@@ -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"
@@ -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
+8 -8
View File
@@ -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 << "<span class='warning'>It's too heavy for you to wield fully.</span>"
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)
..()
+8 -8
View File
@@ -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)
+10 -9
View File
@@ -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
/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
+1 -1
View File
@@ -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.
+20 -14
View File
@@ -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)
/mob/living/simple_animal/pet/dog/pug, /mob/living/simple_animal/pet/fox)
+4 -6
View File
@@ -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)
@@ -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
+18 -21
View File
@@ -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
..()
@@ -83,7 +83,8 @@
return "<span class='average'>[mode_name[mode]]</span>"
/mob/living/simple_animal/bot/proc/turn_on()
if(stat) return 0
if(stat)
return 0
on = 1
SetLuminosity(initial(luminosity))
update_icon()
@@ -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
@@ -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)
@@ -210,7 +210,8 @@
return
if(inventory_head)
if(user) user << "<span class='warning'>You can't put more than one hat on [src]!</span>"
if(user)
user << "<span class='warning'>You can't put more than one hat on [src]!</span>"
return
if(!item_to_add)
user.visible_message("[user] pets [src].","<span class='notice'>You rest your hand on [src]'s head for a moment.</span>")
@@ -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)
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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)
+134 -134
View File
@@ -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
/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
+4 -2
View File
@@ -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
@@ -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
@@ -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)
+4 -2
View File
@@ -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 = "<CENTER><B>Security Record</B></CENTER><BR>"
P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]<BR>\nSex: [G.fields["sex"]]<BR>\nAge: [G.fields["age"]]<BR>\nFingerprint: [G.fields["fingerprint"]]<BR>\nPhysical Status: [G.fields["p_stat"]]<BR>\nMental Status: [G.fields["m_stat"]]<BR>"
@@ -144,7 +145,8 @@
if(virgin)
for(var/datum/data/record/G in data_core.general)
var/datum/data/record/M = find_record("name", G.fields["name"], data_core.medical)
if(!M) continue
if(!M)
continue
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src)
P.info = "<CENTER><B>Medical Record</B></CENTER><BR>"
P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]<BR>\nSex: [G.fields["sex"]]<BR>\nAge: [G.fields["age"]]<BR>\nFingerprint: [G.fields["fingerprint"]]<BR>\nPhysical Status: [G.fields["p_stat"]]<BR>\nMental Status: [G.fields["m_stat"]]<BR>"
+2 -1
View File
@@ -87,7 +87,8 @@
/obj/item/weapon/pen/sleepy/attack(mob/living/M, mob/user)
if(!istype(M)) return
if(!istype(M))
return
if(..())
if(reagents.total_volume)
+36 -18
View File
@@ -44,7 +44,8 @@
/obj/machinery/power/am_control_unit/process()
if(exploding)
explosion(get_turf(src),8,12,18,12)
if(src) qdel(src)
if(src)
qdel(src)
if(update_shield_icons && !shield_icon_delay)
check_shield_icons()
@@ -71,17 +72,22 @@
/obj/machinery/power/am_control_unit/proc/produce_power()
playsound(src.loc, 'sound/effects/bang.ogg', 25, 1)
var/core_power = reported_core_efficiency//Effectively how much fuel we can safely deal with
if(core_power <= 0) return 0//Something is wrong
if(core_power <= 0)
return 0//Something is wrong
var/core_damage = 0
var/fuel = fueljar.usefuel(fuel_injection)
stored_power = (fuel/core_power)*fuel*200000
//Now check if the cores could deal with it safely, this is done after so you can overload for more power if needed, still a bad idea
if(fuel > (2*core_power))//More fuel has been put in than the current cores can deal with
if(prob(50))core_damage = 1//Small chance of damage
if((fuel-core_power) > 5) core_damage = 5//Now its really starting to overload the cores
if((fuel-core_power) > 10) core_damage = 20//Welp now you did it, they wont stand much of this
if(core_damage == 0) return
if(prob(50))
core_damage = 1//Small chance of damage
if((fuel-core_power) > 5)
core_damage = 5//Now its really starting to overload the cores
if((fuel-core_power) > 10)
core_damage = 20//Welp now you did it, they wont stand much of this
if(core_damage == 0)
return
for(var/obj/machinery/am_shielding/AMS in linked_cores)
AMS.stability -= core_damage
AMS.check_stability(1)
@@ -92,10 +98,12 @@
/obj/machinery/power/am_control_unit/emp_act(severity)
switch(severity)
if(1)
if(active) toggle_power()
if(active)
toggle_power()
stability -= rand(15,30)
if(2)
if(active) toggle_power()
if(active)
toggle_power()
stability -= rand(10,20)
..()
return 0
@@ -132,7 +140,8 @@
/obj/machinery/power/am_control_unit/update_icon()
if(active) icon_state = "control_on"
if(active)
icon_state = "control_on"
else icon_state = "control"
//No other icons for it atm
@@ -186,19 +195,24 @@
/obj/machinery/power/am_control_unit/proc/add_shielding(obj/machinery/am_shielding/AMS, AMS_linking = 0)
if(!istype(AMS)) return 0
if(!anchored) return 0
if(!AMS_linking && !AMS.link_control(src)) return 0
if(!istype(AMS))
return 0
if(!anchored)
return 0
if(!AMS_linking && !AMS.link_control(src))
return 0
linked_shielding.Add(AMS)
update_shield_icons = 1
return 1
/obj/machinery/power/am_control_unit/proc/remove_shielding(obj/machinery/am_shielding/AMS)
if(!istype(AMS)) return 0
if(!istype(AMS))
return 0
linked_shielding.Remove(AMS)
update_shield_icons = 2
if(active) toggle_power()
if(active)
toggle_power()
return 1
@@ -221,11 +235,13 @@
/obj/machinery/power/am_control_unit/proc/check_shield_icons()//Forces icon_update for all shields
if(shield_icon_delay) return
if(shield_icon_delay)
return
shield_icon_delay = 1
if(update_shield_icons == 2)//2 means to clear everything and rebuild
for(var/obj/machinery/am_shielding/AMS in linked_shielding)
if(AMS.processing) AMS.shutdown_core()
if(AMS.processing)
AMS.shutdown_core()
AMS.control_unit = null
spawn(10)
AMS.controllerscan()
@@ -240,7 +256,8 @@
/obj/machinery/power/am_control_unit/proc/check_core_stability()
if(stored_core_stability_delay || linked_cores.len <= 0) return
if(stored_core_stability_delay || linked_cores.len <= 0)
return
stored_core_stability_delay = 1
stored_core_stability = 0
for(var/obj/machinery/am_shielding/AMS in linked_cores)
@@ -317,7 +334,8 @@
if(href_list["strengthdown"])
fuel_injection--
if(fuel_injection < 0) fuel_injection = 0
if(fuel_injection < 0)
fuel_injection = 0
if(href_list["refreshstability"])
check_core_stability()
+30 -15
View File
@@ -39,7 +39,8 @@
qdel(src)
return
for(var/obj/machinery/am_shielding/AMS in loc.contents)
if(AMS == src) continue
if(AMS == src)
continue
qdel(src)
return
@@ -64,20 +65,24 @@
/obj/machinery/am_shielding/Destroy()
if(control_unit) control_unit.remove_shielding(src)
if(processing) shutdown_core()
if(control_unit)
control_unit.remove_shielding(src)
if(processing)
shutdown_core()
visible_message("<span class='danger'>The [src.name] melts!</span>")
//Might want to have it leave a mess on the floor but no sprites for now
return ..()
/obj/machinery/am_shielding/CanPass(atom/movable/mover, turf/target, height=0)
if(height==0) return 1
if(height==0)
return 1
return 0
/obj/machinery/am_shielding/process()
if(!processing) . = PROCESS_KILL
if(!processing)
. = PROCESS_KILL
//TODO: core functions and stability
//TODO: think about checking the airmix for plasma and increasing power output
return
@@ -121,8 +126,10 @@
if(core_check())
overlays += "core"
if(!processing) setup_core()
else if(processing) shutdown_core()
if(!processing)
setup_core()
else if(processing)
shutdown_core()
/obj/machinery/am_shielding/attackby(obj/item/W, mob/user, params)
@@ -134,8 +141,10 @@
//Call this to link a detected shilding unit to the controller
/obj/machinery/am_shielding/proc/link_control(obj/machinery/power/am_control_unit/AMC)
if(!istype(AMC)) return 0
if(control_unit && control_unit != AMC) return 0//Already have one
if(!istype(AMC))
return 0
if(control_unit && control_unit != AMC)
return 0//Already have one
control_unit = AMC
control_unit.add_shielding(src,1)
return 1
@@ -145,8 +154,10 @@
/obj/machinery/am_shielding/proc/core_check()
for(var/direction in alldirs)
var/machine = locate(/obj/machinery, get_step(loc, direction))
if(!machine) return 0//Need all for a core
if(!istype(machine, /obj/machinery/am_shielding) && !istype(machine, /obj/machinery/power/am_control_unit)) return 0
if(!machine)
return 0//Need all for a core
if(!istype(machine, /obj/machinery/am_shielding) && !istype(machine, /obj/machinery/power/am_control_unit))
return 0
return 1
@@ -154,7 +165,8 @@
processing = 1
machines |= src
SSmachine.processing |= src
if(!control_unit) return
if(!control_unit)
return
control_unit.linked_cores.Add(src)
control_unit.reported_core_efficiency += efficiency
return
@@ -162,14 +174,16 @@
/obj/machinery/am_shielding/proc/shutdown_core()
processing = 0
if(!control_unit) return
if(!control_unit)
return
control_unit.linked_cores.Remove(src)
control_unit.reported_core_efficiency -= efficiency
return
/obj/machinery/am_shielding/proc/check_stability(injecting_fuel = 0)
if(stability > 0) return
if(stability > 0)
return
if(injecting_fuel && control_unit)
control_unit.exploding = 1
if(src)
@@ -178,7 +192,8 @@
/obj/machinery/am_shielding/proc/recalc_efficiency(new_efficiency)//tbh still not 100% sure how I want to deal with efficiency so this is likely temp
if(!control_unit || !processing) return
if(!control_unit || !processing)
return
if(stability < 50)
new_efficiency /= 2
control_unit.reported_core_efficiency += (new_efficiency - efficiency)
+8 -4
View File
@@ -329,7 +329,8 @@ By design, d1 is the smallest direction and d2 is the highest
if(istype(AM,/obj/structure/cable))
var/obj/structure/cable/C = AM
if(C.d1 == d1 || C.d2 == d1 || C.d1 == d2 || C.d2 == d2) //only connected if they have a common direction
if(C.powernet == powernet) continue
if(C.powernet == powernet)
continue
if(C.powernet)
merge_powernets(powernet, C.powernet)
else
@@ -337,7 +338,8 @@ By design, d1 is the smallest direction and d2 is the highest
else if(istype(AM,/obj/machinery/power/apc))
var/obj/machinery/power/apc/N = AM
if(!N.terminal) continue // APC are connected through their terminal
if(!N.terminal)
continue // APC are connected through their terminal
if(N.terminal.powernet == powernet)
continue
@@ -416,7 +418,8 @@ By design, d1 is the smallest direction and d2 is the highest
/obj/structure/cable/proc/cut_cable_from_powernet()
var/turf/T1 = loc
var/list/P_list
if(!T1) return
if(!T1)
return
if(d1)
T1 = get_step(T1, d1)
P_list = power_list(T1, src, turn(d1,180),0,cable_only = 1) // what adjacently joins on to cut cable...
@@ -520,7 +523,8 @@ var/global/list/datum/stack_recipe/cable_coil_recipes = list ( \
var/obj/item/organ/limb/affecting = H.get_organ(check_zone(user.zone_sel.selecting))
if(affecting.status == ORGAN_ROBOTIC)
user.visible_message("<span class='notice'>[user] starts to fix some of the wires in [H]'s [affecting.getDisplayName()].</span>", "<span class='notice'>You start fixing some of the wires in [H]'s [affecting.getDisplayName()].</span>")
if(!do_mob(user, H, 50)) return
if(!do_mob(user, H, 50))
return
item_heal_robotic(H, user, 0, 5)
src.use(1)
return
+4 -2
View File
@@ -42,7 +42,8 @@
if(rigged && amount > 0)
explode()
return 0
if(charge < amount) return 0
if(charge < amount)
return 0
charge = (charge - amount)
if(!istype(loc, /obj/machinery/power/apc))
feedback_add_details("cell_used","[src.type]")
@@ -56,7 +57,8 @@
if(maxcharge < amount)
amount = maxcharge
var/power_used = min(maxcharge-charge,amount)
if(crit_fail) return 0
if(crit_fail)
return 0
if(!prob(reliability))
minor_fault++
if(prob(minor_fault))
+4 -2
View File
@@ -161,7 +161,8 @@
/obj/machinery/light/Move()
if(status != LIGHT_BROKEN) broken(1)
if(status != LIGHT_BROKEN)
broken(1)
return ..()
/obj/machinery/light/built/New()
@@ -396,7 +397,8 @@
return
/obj/machinery/light/attack_animal(mob/living/simple_animal/M)
if(M.melee_damage_upper == 0) return
if(M.melee_damage_upper == 0)
return
if(status == LIGHT_EMPTY||status == LIGHT_BROKEN)
M << "<span class='danger'>That object is useless to you.</span>"
return
+12 -6
View File
@@ -152,7 +152,8 @@
cdir = get_dir(T,loc)
for(var/obj/structure/cable/C in T)
if(C.powernet) continue
if(C.powernet)
continue
if(C.d1 == cdir || C.d2 == cdir)
. += C
return .
@@ -179,7 +180,8 @@
/obj/machinery/power/proc/get_indirect_connections()
. = list()
for(var/obj/structure/cable/C in loc)
if(C.powernet) continue
if(C.powernet)
continue
if(C.d1 == 0) // the cable is a node cable
. += C
return .
@@ -197,11 +199,13 @@
//var/fdir = (!d)? 0 : turn(d, 180) // the opposite direction to d (or 0 if d==0)
for(var/AM in T)
if(AM == source) continue //we don't want to return source
if(AM == source)
continue //we don't want to return source
if(!cable_only && istype(AM,/obj/machinery/power))
var/obj/machinery/power/P = AM
if(P.powernet == 0) continue // exclude APCs which have powernet=0
if(P.powernet == 0)
continue // exclude APCs which have powernet=0
if(!unmarked || !P.powernet) //if unmarked=1 we only return things with no powernet
if(d == 0)
@@ -281,12 +285,14 @@
//source is an object caused electrocuting (airlock, grille, etc)
//No animations will be performed by this proc.
/proc/electrocute_mob(mob/living/carbon/M, power_source, obj/source, siemens_coeff = 1)
if(istype(M.loc,/obj/mecha)) return 0 //feckin mechs are dumb
if(istype(M.loc,/obj/mecha))
return 0 //feckin mechs are dumb
if(istype(M,/mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.gloves)
var/obj/item/clothing/gloves/G = H.gloves
if(G.siemens_coefficient == 0) return 0 //to avoid spamming with insulated glvoes on
if(G.siemens_coefficient == 0)
return 0 //to avoid spamming with insulated glvoes on
var/area/source_area
if(istype(power_source,/area))
@@ -116,7 +116,8 @@
/obj/singularity/proc/admin_investigate_setup()
last_warning = world.time
var/count = locate(/obj/machinery/field/containment) in ultra_range(30, src, 1)
if(!count) message_admins("A singulo has been created without containment fields active ([x],[y],[z])",1)
if(!count)
message_admins("A singulo has been created without containment fields active ([x],[y],[z])",1)
investigate_log("was created. [count?"":"<font color='red'>No containment fields were active</font>"]","singulo")
/obj/singularity/proc/dissipate()
+9 -6
View File
@@ -189,7 +189,8 @@
/obj/machinery/power/smes/update_icon()
overlays.Cut()
if(stat & BROKEN) return
if(stat & BROKEN)
return
if(panel_open)
return
@@ -231,7 +232,8 @@
/obj/machinery/power/smes/process()
if(stat & BROKEN) return
if(stat & BROKEN)
return
//store machine state to see if we need to update the icon overlays
var/last_disp = chargedisplay()
@@ -428,10 +430,11 @@
/obj/machinery/power/smes/magical
name = "magical power storage unit"
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit. Magically produces power."
process()
capacity = INFINITY
charge = INFINITY
..()
/obj/machinery/power/smes/magical/process()
capacity = INFINITY
charge = INFINITY
..()
#undef SMESRATE
+4 -2
View File
@@ -55,13 +55,15 @@
/obj/item/weapon/gun/magic/Destroy()
if(can_charge) SSobj.processing.Remove(src)
if(can_charge)
SSobj.processing.Remove(src)
return ..()
/obj/item/weapon/gun/magic/process()
charge_tick++
if(charge_tick < recharge_rate || charges >= max_charges) return 0
if(charge_tick < recharge_rate || charges >= max_charges)
return 0
charge_tick = 0
charges++
return 1
@@ -30,7 +30,8 @@
return (chambered.BB ? 1 : 0)
/obj/item/weapon/gun/projectile/shotgun/attack_self(mob/living/user)
if(recentpump) return
if(recentpump)
return
pump(user)
recentpump = 1
spawn(10)
@@ -52,7 +53,8 @@
chambered = null
/obj/item/weapon/gun/projectile/shotgun/proc/pump_reload(mob/M)
if(!magazine.ammo_count()) return 0
if(!magazine.ammo_count())
return 0
var/obj/item/ammo_casing/AC = magazine.get_round() //load next casing.
chambered = AC
@@ -151,12 +151,11 @@
reagents.handle_reactions()
return 1
/obj/item/projectile/bullet/dart/metalfoam
New()
..()
reagents.add_reagent("aluminium", 15)
reagents.add_reagent("foaming_agent", 5)
reagents.add_reagent("facid", 5)
/obj/item/projectile/bullet/dart/metalfoam/New()
..()
reagents.add_reagent("aluminium", 15)
reagents.add_reagent("foaming_agent", 5)
reagents.add_reagent("facid", 5)
//This one is for future syringe guns update
/obj/item/projectile/bullet/dart/syringe
+56 -28
View File
@@ -123,7 +123,8 @@
/proc/wabbajack(mob/living/M)
if(istype(M))
if(istype(M, /mob/living) && M.stat != DEAD)
if(M.notransform) return
if(M.notransform)
return
M.notransform = 1
M.canmove = 0
M.icon = null
@@ -132,7 +133,8 @@
if(istype(M, /mob/living/silicon/robot))
var/mob/living/silicon/robot/Robot = M
if(Robot.mmi) qdel(Robot.mmi)
if(Robot.mmi)
qdel(Robot.mmi)
Robot.notify_ai(1)
else
for(var/obj/item/W in M)
@@ -153,8 +155,10 @@
if("robot")
var/robot = pick("cyborg","syndiborg","drone")
switch(robot)
if("cyborg") new_mob = new /mob/living/silicon/robot(M.loc)
if("syndiborg") new_mob = new /mob/living/silicon/robot/syndicate(M.loc)
if("cyborg")
new_mob = new /mob/living/silicon/robot(M.loc)
if("syndiborg")
new_mob = new /mob/living/silicon/robot/syndicate(M.loc)
if("drone")
new_mob = new /mob/living/simple_animal/drone(M.loc)
var/mob/living/simple_animal/drone/D = new_mob
@@ -192,33 +196,57 @@
if(prob(50))
var/beast = pick("carp","bear","mushroom","statue", "bat", "goat","killertomato", "spiderbase", "spiderhunter", "blobbernaut", "magicarp", "chaosmagicarp")
switch(beast)
if("carp") new_mob = new /mob/living/simple_animal/hostile/carp(M.loc)
if("bear") new_mob = new /mob/living/simple_animal/hostile/bear(M.loc)
if("mushroom") new_mob = new /mob/living/simple_animal/hostile/mushroom(M.loc)
if("statue") new_mob = new /mob/living/simple_animal/hostile/statue(M.loc)
if("bat") new_mob = new /mob/living/simple_animal/hostile/retaliate/bat(M.loc)
if("goat") new_mob = new /mob/living/simple_animal/hostile/retaliate/goat(M.loc)
if("killertomato") new_mob = new /mob/living/simple_animal/hostile/killertomato(M.loc)
if("spiderbase") new_mob = new /mob/living/simple_animal/hostile/poison/giant_spider(M.loc)
if("spiderhunter") new_mob = new /mob/living/simple_animal/hostile/poison/giant_spider/hunter(M.loc)
if("blobbernaut") new_mob = new /mob/living/simple_animal/hostile/blob/blobbernaut(M.loc)
if("magicarp") new_mob = new /mob/living/simple_animal/hostile/carp/ranged(M.loc)
if("chaosmagicarp") new_mob = new /mob/living/simple_animal/hostile/carp/ranged/chaos(M.loc)
if("carp")
new_mob = new /mob/living/simple_animal/hostile/carp(M.loc)
if("bear")
new_mob = new /mob/living/simple_animal/hostile/bear(M.loc)
if("mushroom")
new_mob = new /mob/living/simple_animal/hostile/mushroom(M.loc)
if("statue")
new_mob = new /mob/living/simple_animal/hostile/statue(M.loc)
if("bat")
new_mob = new /mob/living/simple_animal/hostile/retaliate/bat(M.loc)
if("goat")
new_mob = new /mob/living/simple_animal/hostile/retaliate/goat(M.loc)
if("killertomato")
new_mob = new /mob/living/simple_animal/hostile/killertomato(M.loc)
if("spiderbase")
new_mob = new /mob/living/simple_animal/hostile/poison/giant_spider(M.loc)
if("spiderhunter")
new_mob = new /mob/living/simple_animal/hostile/poison/giant_spider/hunter(M.loc)
if("blobbernaut")
new_mob = new /mob/living/simple_animal/hostile/blob/blobbernaut(M.loc)
if("magicarp")
new_mob = new /mob/living/simple_animal/hostile/carp/ranged(M.loc)
if("chaosmagicarp")
new_mob = new /mob/living/simple_animal/hostile/carp/ranged/chaos(M.loc)
else
var/animal = pick("parrot","corgi","crab","pug","cat","mouse","chicken","cow","lizard","chick","fox","butterfly")
switch(animal)
if("parrot") new_mob = new /mob/living/simple_animal/parrot(M.loc)
if("corgi") new_mob = new /mob/living/simple_animal/pet/dog/corgi(M.loc)
if("crab") new_mob = new /mob/living/simple_animal/crab(M.loc)
if("pug") new_mob = new /mob/living/simple_animal/pet/dog/pug(M.loc)
if("cat") new_mob = new /mob/living/simple_animal/pet/cat(M.loc)
if("mouse") new_mob = new /mob/living/simple_animal/mouse(M.loc)
if("chicken") new_mob = new /mob/living/simple_animal/chicken(M.loc)
if("cow") new_mob = new /mob/living/simple_animal/cow(M.loc)
if("lizard") new_mob = new /mob/living/simple_animal/lizard(M.loc)
if("fox") new_mob = new /mob/living/simple_animal/pet/fox(M.loc)
if("butterfly") new_mob = new /mob/living/simple_animal/butterfly(M.loc)
else new_mob = new /mob/living/simple_animal/chick(M.loc)
if("parrot")
new_mob = new /mob/living/simple_animal/parrot(M.loc)
if("corgi")
new_mob = new /mob/living/simple_animal/pet/dog/corgi(M.loc)
if("crab")
new_mob = new /mob/living/simple_animal/crab(M.loc)
if("pug")
new_mob = new /mob/living/simple_animal/pet/dog/pug(M.loc)
if("cat")
new_mob = new /mob/living/simple_animal/pet/cat(M.loc)
if("mouse")
new_mob = new /mob/living/simple_animal/mouse(M.loc)
if("chicken")
new_mob = new /mob/living/simple_animal/chicken(M.loc)
if("cow")
new_mob = new /mob/living/simple_animal/cow(M.loc)
if("lizard")
new_mob = new /mob/living/simple_animal/lizard(M.loc)
if("fox")
new_mob = new /mob/living/simple_animal/pet/fox(M.loc)
if("butterfly")
new_mob = new /mob/living/simple_animal/butterfly(M.loc)
else
new_mob = new /mob/living/simple_animal/chick(M.loc)
new_mob.languages |= HUMAN
if("humanoid")
new_mob = new /mob/living/carbon/human(M.loc)
+26 -13
View File
@@ -71,10 +71,13 @@ var/const/INJECT = 5 //injection
current_list_element = rand(1,reagent_list.len)
while(total_transfered != amount)
if(total_transfered >= amount) break
if(total_volume <= 0 || !reagent_list.len) break
if(total_transfered >= amount)
break
if(total_volume <= 0 || !reagent_list.len)
break
if(current_list_element > reagent_list.len) current_list_element = 1
if(current_list_element > reagent_list.len)
current_list_element = 1
var/datum/reagent/current_reagent = reagent_list[current_list_element]
src.remove_reagent(current_reagent.id, 1)
@@ -318,11 +321,13 @@ var/const/INJECT = 5 //injection
var/required_temp = C.required_temp
for(var/B in C.required_reagents)
if(!has_reagent(B, C.required_reagents[B])) break
if(!has_reagent(B, C.required_reagents[B]))
break
total_matching_reagents++
multipliers += round(get_reagent_amount(B) / C.required_reagents[B])
for(var/B in C.required_catalysts)
if(!has_reagent(B, C.required_catalysts[B])) break
if(!has_reagent(B, C.required_catalysts[B]))
break
total_matching_catalysts++
if(!C.required_container)
@@ -459,7 +464,8 @@ var/const/INJECT = 5 //injection
if(!isnum(amount) || !amount)
return 1
update_total()
if(total_volume + amount > maximum_volume) amount = (maximum_volume - total_volume) //Doesnt fit in. Make it disappear. Shouldnt happen. Will happen.
if(total_volume + amount > maximum_volume)
amount = (maximum_volume - total_volume) //Doesnt fit in. Make it disappear. Shouldnt happen. Will happen.
chem_temp = round(((amount * reagtemp) + (total_volume * chem_temp)) / (total_volume + amount)) //equalize with new chems
for(var/A in reagent_list)
@@ -505,7 +511,8 @@ var/const/INJECT = 5 //injection
/datum/reagents/proc/remove_reagent(reagent, amount, safety)//Added a safety check for the trans_id_to
if(!isnum(amount)) return 1
if(!isnum(amount))
return 1
for(var/A in reagent_list)
var/datum/reagent/R = A
@@ -524,10 +531,13 @@ var/const/INJECT = 5 //injection
for(var/A in reagent_list)
var/datum/reagent/R = A
if (R.id == reagent)
if(!amount) return R
if(!amount)
return R
else
if(R.volume >= amount) return R
else return 0
if(R.volume >= amount)
return R
else
return 0
return 0
@@ -542,7 +552,8 @@ var/const/INJECT = 5 //injection
/datum/reagents/proc/get_reagents()
var/res = ""
for(var/datum/reagent/A in reagent_list)
if (res != "") res += ","
if (res != "")
res += ","
res += A.name
return res
@@ -582,8 +593,10 @@ var/const/INJECT = 5 //injection
D.data = new_data
/datum/reagents/proc/copy_data(datum/reagent/current_reagent)
if (!current_reagent || !current_reagent.data) return null
if (!istype(current_reagent.data, /list)) return current_reagent.data
if (!current_reagent || !current_reagent.data)
return null
if (!istype(current_reagent.data, /list))
return current_reagent.data
var/list/trans_data = current_reagent.data.Copy()
@@ -297,12 +297,18 @@
for(var/i=1, i<=len, i+=1)
var/ascii = text2ascii(N.dna.features["mcolor"],i)
switch(ascii)
if(48) newcolor += "0"
if(49 to 57) newcolor += ascii2text(ascii-1) //numbers 1 to 9
if(97) newcolor += "9"
if(98 to 102) newcolor += ascii2text(ascii-1) //letters b to f lowercase
if(65) newcolor +="9"
if(66 to 70) newcolor += ascii2text(ascii+31) //letters B to F - translates to lowercase
if(48)
newcolor += "0"
if(49 to 57)
newcolor += ascii2text(ascii-1) //numbers 1 to 9
if(97)
newcolor += "9"
if(98 to 102)
newcolor += ascii2text(ascii-1) //letters b to f lowercase
if(65)
newcolor +="9"
if(66 to 70)
newcolor += ascii2text(ascii+31) //letters B to F - translates to lowercase
else
break
N.dna.features["mcolor"] = newcolor
@@ -20,9 +20,12 @@
/obj/item/weapon/reagent_containers/blood/update_icon()
var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9) icon_state = "empty"
if(10 to 50) icon_state = "half"
if(51 to INFINITY) icon_state = "full"
if(0 to 9)
icon_state = "empty"
if(10 to 50)
icon_state = "half"
if(51 to INFINITY)
icon_state = "full"
/obj/item/weapon/reagent_containers/blood/random/New()
blood_type = pick("A+", "A-", "B+", "B-", "O+", "O-")
@@ -53,7 +56,7 @@
/obj/item/weapon/reagent_containers/blood/attackby(obj/item/I, mob/user, params)
if (istype(I, /obj/item/weapon/pen) || istype(I, /obj/item/toy/crayon))
var/t = stripped_input(user, "What would you like to label the blood pack?", name, null, 53)
if(!user.canUseTopic(src))
return
@@ -179,13 +179,20 @@
var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9) filling.icon_state = "[icon_state]-10"
if(10 to 24) filling.icon_state = "[icon_state]10"
if(25 to 49) filling.icon_state = "[icon_state]25"
if(50 to 74) filling.icon_state = "[icon_state]50"
if(75 to 79) filling.icon_state = "[icon_state]75"
if(80 to 90) filling.icon_state = "[icon_state]80"
if(91 to INFINITY) filling.icon_state = "[icon_state]100"
if(0 to 9)
filling.icon_state = "[icon_state]-10"
if(10 to 24)
filling.icon_state = "[icon_state]10"
if(25 to 49)
filling.icon_state = "[icon_state]25"
if(50 to 74)
filling.icon_state = "[icon_state]50"
if(75 to 79)
filling.icon_state = "[icon_state]75"
if(80 to 90)
filling.icon_state = "[icon_state]80"
if(91 to INFINITY)
filling.icon_state = "[icon_state]100"
filling.color = mix_color_from_reagents(reagents.reagent_list)
overlays += filling
+4 -2
View File
@@ -124,11 +124,13 @@
user << "<span class='notice'>You remove the conveyor belt.</span>"
qdel(src)
return
if(isrobot(user)) return //Carn: fix for borgs dropping their modules on conveyor belts
if(isrobot(user))
return //Carn: fix for borgs dropping their modules on conveyor belts
if(!user.drop_item())
user << "<span class='warning'>\The [I] is stuck to your hand, you cannot place it on the conveyor!</span>"
return
if(I && I.loc) I.loc = src.loc
if(I && I.loc)
I.loc = src.loc
return
// attack with hand, move pulled object onto conveyor
+6 -3
View File
@@ -578,9 +578,12 @@
if(href_list["move"])
switch(SSshuttle.moveShuttle(shuttleId, href_list["move"], 1))
if(0) usr << "<span class='notice'>Shuttle received message and will be sent shortly.</span>"
if(1) usr << "<span class='warning'>Invalid shuttle requested.</span>"
else usr << "<span class='notice'>Unable to comply.</span>"
if(0)
usr << "<span class='notice'>Shuttle received message and will be sent shortly.</span>"
if(1)
usr << "<span class='warning'>Invalid shuttle requested.</span>"
else
usr << "<span class='notice'>Unable to comply.</span>"
/obj/machinery/computer/shuttle/emag_act(mob/user)
if(!emagged)
+6 -3
View File
@@ -52,15 +52,18 @@
if(istype(tool, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = tool
if(WT.isOn()) return 1
if(WT.isOn())
return 1
else if(istype(tool, /obj/item/weapon/lighter))
var/obj/item/weapon/lighter/L = tool
if(L.lit) return 1
if(L.lit)
return 1
else if(istype(tool, /obj/item/weapon/match))
var/obj/item/weapon/match/M = tool
if(M.lit) return 1
if(M.lit)
return 1
return 0
+6 -3
View File
@@ -36,15 +36,18 @@
/datum/surgery_step/manipulate_organs/tool_check(mob/user, obj/item/tool)
if(istype(tool, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = tool
if(!WT.isOn()) return 0
if(!WT.isOn())
return 0
else if(istype(tool, /obj/item/weapon/lighter))
var/obj/item/weapon/lighter/L = tool
if(!L.lit) return 0
if(!L.lit)
return 0
else if(istype(tool, /obj/item/weapon/match))
var/obj/item/weapon/match/M = tool
if(!M.lit) return 0
if(!M.lit)
return 0
return 1
+18 -9
View File
@@ -79,7 +79,8 @@
//Damage will not exceed max_damage using this proc
//Cannot apply negative damage
/obj/item/organ/limb/proc/take_damage(brute, burn)
if(owner && (owner.status_flags & GODMODE)) return 0 //godmode
if(owner && (owner.status_flags & GODMODE))
return 0 //godmode
brute = max(brute,0)
burn = max(burn,0)
@@ -89,7 +90,8 @@
burn = max(0, burn - 4)
var/can_inflict = max_damage - (brute_dam + burn_dam)
if(!can_inflict) return 0
if(!can_inflict)
return 0
if((brute + burn) < can_inflict)
brute_dam += brute
@@ -149,13 +151,20 @@
//Returns a display name for the organ
/obj/item/organ/limb/proc/getDisplayName() //Added "Chest" and "Head" just in case, this may not be needed
switch(name)
if("l_leg") return "left leg"
if("r_leg") return "right leg"
if("l_arm") return "left arm"
if("r_arm") return "right arm"
if("chest") return "chest"
if("head") return "head"
else return name
if("l_leg")
return "left leg"
if("r_leg")
return "right leg"
if("l_arm")
return "left arm"
if("r_arm")
return "right arm"
if("chest")
return "chest"
if("head")
return "head"
else
return name
//Remove all embedded objects from all limbs on the human mob
+2 -1
View File
@@ -19,7 +19,8 @@
/datum/surgery/proc/next_step(mob/user, mob/living/carbon/target)
if(step_in_progress) return
if(step_in_progress)
return
var/datum/surgery_step/S = get_surgery_step()
if(S)
+42 -42
View File
@@ -32,64 +32,64 @@ Notes:
/datum/tooltip
var
client/owner
control = "mainwindow.tooltip"
file = 'code/modules/tooltip/tooltip.html'
showing = 0
queueHide = 0
init = 0
var = client/owner
var = control = "mainwindow.tooltip"
var = file = 'code/modules/tooltip/tooltip.html'
var = showing = 0
var = queueHide = 0
var = init = 0
New(client/C)
if (C)
src.owner = C
src.owner << browse(file2text(src.file), "window=[src.control]")
/datum/tooltip/New(client/C)
if (C)
src.owner = C
src.owner << browse(file2text(src.file), "window=[src.control]")
..()
..()
proc/show(atom/movable/thing, params = null, title = null, content = null, theme = "default", special = "none")
if (!thing || !params || (!title && !content) || !src.owner || !isnum(world.icon_size)) return 0
if (!src.init)
//Initialize some vars
src.init = 1
src.owner << output(list2params(list(world.icon_size, src.control)), "[src.control]:tooltip.init")
/datum/tooltip/proc/show(atom/movable/thing, params = null, title = null, content = null, theme = "default", special = "none")
if (!thing || !params || (!title && !content) || !src.owner || !isnum(world.icon_size))
return 0
if (!src.init)
//Initialize some vars
src.init = 1
src.owner << output(list2params(list(world.icon_size, src.control)), "[src.control]:tooltip.init")
src.showing = 1
src.showing = 1
if (title && content)
title = "<h1>[title]</h1>"
content = "<p>[content]</p>"
else if (title && !content)
title = "<p>[title]</p>"
else if (!title && content)
content = "<p>[content]</p>"
if (title && content)
title = "<h1>[title]</h1>"
content = "<p>[content]</p>"
else if (title && !content)
title = "<p>[title]</p>"
else if (!title && content)
content = "<p>[content]</p>"
//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 */
+3 -3
View File
@@ -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