Merge pull request #14981 from neersighted/510

BYOND 510
This commit is contained in:
tkdrg
2016-02-05 00:04:59 -03:00
90 changed files with 708 additions and 1231 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums
continue
//Split the line at every "="
var/list/List = text2list(line, "=")
var/list/List = splittext(line, "=")
if(!List.len)
continue
+1 -1
View File
@@ -596,7 +596,7 @@ var/list/admin_verbs_hideable = list(
//load text from file
var/list/Lines = file2list("config/admins.txt")
for(var/line in Lines)
var/list/splitline = text2list(line, " = ")
var/list/splitline = splittext(line, " = ")
if(ckey(splitline[1]) == ckey)
if(splitline.len >= 2)
rank = ckeyEx(splitline[2])
+1 -1
View File
@@ -2,7 +2,7 @@
/datum/admins/proc/create_mob(mob/user)
if (!create_mob_html)
var/mobjs = null
mobjs = list2text(typesof(/mob), ";")
mobjs = jointext(typesof(/mob), ";")
create_mob_html = file2text('html/create_object.html')
create_mob_html = replacetext(create_mob_html, "null /* object types */", "\"[mobjs]\"")
+2 -2
View File
@@ -7,7 +7,7 @@ var/list/create_object_forms = list(
/datum/admins/proc/create_object(mob/user)
if (!create_object_html)
var/objectjs = null
objectjs = list2text(typesof(/obj), ";")
objectjs = jointext(typesof(/obj), ";")
create_object_html = file2text('html/create_object.html')
create_object_html = replacetext(create_object_html, "null /* object types */", "\"[objectjs]\"")
@@ -19,7 +19,7 @@ var/list/create_object_forms = list(
var/html_form = create_object_forms[path]
if (!html_form)
var/objectjs = list2text(typesof(path), ";")
var/objectjs = jointext(typesof(path), ";")
html_form = file2text('html/create_object.html')
html_form = replacetext(html_form, "null /* object types */", "\"[objectjs]\"")
create_object_forms[path] = html_form
+1 -1
View File
@@ -2,7 +2,7 @@
/datum/admins/proc/create_turf(mob/user)
if (!create_turf_html)
var/turfjs = null
turfjs = list2text(typesof(/turf), ";")
turfjs = jointext(typesof(/turf), ";")
create_turf_html = file2text('html/create_object.html')
create_turf_html = replacetext(create_turf_html, "null /* object types */", "\"[turfjs]\"")
+7 -10
View File
@@ -169,9 +169,6 @@
output += ruler
usr << browse(output, "window=show_notes;size=900x500")
/proc/regex_note_sql_extract(str, exp)
return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_find")(str, exp))
#define NOTESFILE "data/player_notes.sav"
//if the AUTOCONVERT_NOTES is turned on, anytime a player connects this will be run to try and add all their notes to the databas
/proc/convert_notes_sql(ckey)
@@ -184,13 +181,13 @@
var/notetext
notesfile >> notetext
var/server
if (config && config.server_name)
if(config && config.server_name)
server = config.server_name
var/regex = "^(\\d{2}-\\w{3}-\\d{4}) \\| (.+) ~(\\w+)$"
var/datum/regex/results = regex_note_sql_extract(notetext, regex)
var/timestamp = results.str(2)
notetext = results.str(3)
var/adminckey = results.str(4)
var/regex/note = new("^(\\d{2}-\\w{3}-\\d{4}) \\| (.+) ~(\\w+)$", "i")
note.Find(notetext)
var/timestamp = note.group[2]
notetext = note.group[3]
var/adminckey = note.group[4]
var/DBQuery/query_convert_time = dbcon.NewQuery("SELECT ADDTIME(STR_TO_DATE('[timestamp]','%d-%b-%Y'), '0')")
if(!query_convert_time.Execute())
var/err = query_convert_time.ErrorMsg()
@@ -217,4 +214,4 @@ this proc can take several minutes to execute fully if converting and cause DD t
world << "Deleting NOTESFILE"
fdel(NOTESFILE)
world << "Finished mass note conversion, remember to turn off AUTOCONVERT_NOTES"*/
#undef NOTESFILE
#undef NOTESFILE
+8 -8
View File
@@ -175,10 +175,10 @@
if (!ban)
return null
. = params2list(ban)
.["keys"] = text2list(.["keys"], ",")
.["type"] = text2list(.["type"], ",")
.["IP"] = text2list(.["IP"], ",")
.["computer_id"] = text2list(.["computer_id"], ",")
.["keys"] = splittext(.["keys"], ",")
.["type"] = splittext(.["type"], ",")
.["IP"] = splittext(.["IP"], ",")
.["computer_id"] = splittext(.["computer_id"], ",")
/proc/list2stickyban(var/list/ban)
@@ -186,13 +186,13 @@
return null
. = ban.Copy()
if (.["keys"])
.["keys"] = list2text(.["keys"], ",")
.["keys"] = jointext(.["keys"], ",")
if (.["type"])
.["type"] = list2text(.["type"], ",")
.["type"] = jointext(.["type"], ",")
if (.["IP"])
.["IP"] = list2text(.["IP"], ",")
.["IP"] = jointext(.["IP"], ",")
if (.["computer_id"])
.["computer_id"] = list2text(.["computer_id"], ",")
.["computer_id"] = jointext(.["computer_id"], ",")
. = list2params(.)
+1 -1
View File
@@ -1882,7 +1882,7 @@
alert("Select fewer object types, (max 5)")
return
var/list/offset = text2list(href_list["offset"],",")
var/list/offset = splittext(href_list["offset"],",")
var/number = Clamp(text2num(href_list["object_count"]), 1, 100)
var/X = offset.len > 0 ? text2num(offset[1]) : 0
var/Y = offset.len > 1 ? text2num(offset[2]) : 0
+2 -2
View File
@@ -4,7 +4,7 @@
var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","alien","as", "i")
//explode the input msg into a list
var/list/msglist = text2list(msg, " ")
var/list/msglist = splittext(msg, " ")
//generate keywords lookup
var/list/surnames = list()
@@ -16,7 +16,7 @@
indexing += M.mind.name
for(var/string in indexing)
var/list/L = text2list(string, " ")
var/list/L = splittext(string, " ")
var/surname_found = 0
//surnames
for(var/i=L.len, i>=1, i--)
+7 -7
View File
@@ -688,19 +688,19 @@ var/global/list/g_fancy_list_of_types = null
switch(input("Which list?") in list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Clients","Joined Clients"))
if("Players")
usr << list2text(player_list,",")
usr << jointext(player_list,",")
if("Admins")
usr << list2text(admins,",")
usr << jointext(admins,",")
if("Mobs")
usr << list2text(mob_list,",")
usr << jointext(mob_list,",")
if("Living Mobs")
usr << list2text(living_mob_list,",")
usr << jointext(living_mob_list,",")
if("Dead Mobs")
usr << list2text(dead_mob_list,",")
usr << jointext(dead_mob_list,",")
if("Clients")
usr << list2text(clients,",")
usr << jointext(clients,",")
if("Joined Clients")
usr << list2text(joined_player_list,",")
usr << jointext(joined_player_list,",")
/client/proc/cmd_display_del_log()
set category = "Debug"
@@ -151,7 +151,7 @@ var/global/dmm_suite/preloader/_preloader = null
var/variables_start = findtext(full_def,"{")
if(variables_start)//if there's any variable
full_def = copytext(full_def,variables_start+1,length(full_def))//removing the last '}'
fields = text2list(full_def,";")
fields = readlist(full_def, ";")
//then fill the members_attributes list with the corresponding variables
members_attributes.len++
@@ -258,7 +258,7 @@ var/global/dmm_suite/preloader/_preloader = null
//build a list from variables in text form (e.g {var1="derp"; var2; var3=7} => list(var1="derp", var2, var3=7))
//return the filled list
/dmm_suite/proc/text2list(text as text,delimiter=",")
/dmm_suite/proc/readlist(text as text, delimiter=",")
var/list/to_return = list()
@@ -292,7 +292,7 @@ var/global/dmm_suite/preloader/_preloader = null
//Check for list
else if(copytext(trim_right,1,5) == "list")
trim_right = text2list(copytext(trim_right,6,length(trim_right)))
trim_right = readlist(copytext(trim_right,6,length(trim_right)))
//Check for file
else if(copytext(trim_right,1,2) == "'")
+3 -3
View File
@@ -201,12 +201,12 @@ var/next_external_rsc = 0
else
winset(src, "infowindow.changelog", "font-style=bold")
if (ckey in clientmessages)
for (var/message in clientmessages[ckey])
if(ckey in clientmessages)
for(var/message in clientmessages[ckey])
src << message
clientmessages.Remove(ckey)
if (config && config.autoconvert_notes)
if(config && config.autoconvert_notes)
convert_notes_sql(ckey)
if(!winexists(src, "asset_cache_browser")) // The client is using a custom skin, tell them.
+1 -1
View File
@@ -25,7 +25,7 @@
var/obj/item/weapon/paper/P = new(get_turf(src))
P.name = "paper- 'Scanner Report'"
P.info = "<center><font size='6'><B>Scanner Report</B></font></center><HR><BR>"
P.info += list2text(log, "<BR>")
P.info += jointext(log, "<BR>")
P.info += "<HR><B>Notes:</B><BR>"
P.info_links = P.info
+4 -4
View File
@@ -4,7 +4,7 @@
/proc/NewStutter(phrase,stunned)
phrase = html_decode(phrase)
var/list/split_phrase = text2list(phrase," ") //Split it up into words.
var/list/split_phrase = splittext(phrase," ") //Split it up into words.
var/list/unstuttered_words = split_phrase.Copy()
var/i = rand(1,3)
@@ -35,7 +35,7 @@
split_phrase[index] = word
return sanitize(list2text(split_phrase," "))
return sanitize(jointext(split_phrase," "))
/proc/Stagger(mob/M,d) //Technically not a filter, but it relates to drunkenness.
step(M, pick(d,turn(d,90),turn(d,-90)))
@@ -45,7 +45,7 @@
if(chance >= 100) return original_msg
var/list
words = text2list(original_msg," ")
words = splittext(original_msg," ")
new_words = list()
var/new_msg = ""
@@ -57,6 +57,6 @@
continue
new_words += w
new_msg = list2text(new_words," ")
new_msg = jointext(new_words," ")
return new_msg
+2 -2
View File
@@ -124,7 +124,7 @@
if(!src.req_access)
src.req_access = list()
if(src.req_access_txt)
var/list/req_access_str = text2list(req_access_txt,";")
var/list/req_access_str = splittext(req_access_txt,";")
for(var/x in req_access_str)
var/n = text2num(x)
if(n)
@@ -133,7 +133,7 @@
if(!src.req_one_access)
src.req_one_access = list()
if(src.req_one_access_txt)
var/list/req_one_access_str = text2list(req_one_access_txt,";")
var/list/req_one_access_str = splittext(req_one_access_txt,";")
for(var/x in req_one_access_str)
var/n = text2num(x)
if(n)
-284
View File
@@ -1,284 +0,0 @@
/* Usage:
JSON.stringify(obj) - Converts lists and values into a JSON string.
JSON.parse(json) - Converts a JSON string into lists and values.
*/
/var/datum/jsonHelper/JSON = new // A namespace for procs.
// ************************************ WRITER ************************************
/datum/jsonHelper/proc/stringify(value)
return list2text(WriteValue(list(), value))
/datum/jsonHelper/proc/WriteValue(list/json, value)
. = json
if(isnum(value))
json += value // Consider num2text(value, 20) for maximum accuracy.
else if(isnull(value))
json += "null"
else if(istext(value))
WriteString(json, value)
else if(istype(value, /list))
WriteList(json, value)
else
throw EXCEPTION("Datums cannot be converted to JSON.")
/datum/jsonHelper/proc/WriteString(list/json, str)
. = json
var/quotePos = findtextEx(str, "\"")
var/bsPos = findtextEx(str, "\\")
if (quotePos == 0 && bsPos == 0)
json.Add("\"", str, "\"")
else
json += "\""
var/lastStop = 1
while(quotePos != 0 || bsPos != 0)
var/escPos
if(quotePos < bsPos && quotePos != 0 || bsPos == 0)
escPos = quotePos
else
escPos = bsPos
json.Add(copytext(str, lastStop, escPos), "\\")
lastStop = escPos
if(escPos == quotePos)
quotePos = findtextEx(str, "\"", escPos + 1)
else if(escPos == bsPos)
bsPos = findtextEx(str, "\\", escPos + 1)
json.Add(copytext(str, lastStop), "\"")
/datum/jsonHelper/proc/WriteList(list/json, list/listVal)
. = json
#define Either 0
#define CannotBeArray 1
#define CannotBeObject 2
#define BadList (CannotBeArray | CannotBeObject)
var/listType = Either
for(var/key in listVal)
if(istext(key))
if(!isnull(listVal[key]))
listType |= CannotBeArray
else
if(!isnum(key) && !isnull(listVal[key]))
listType = BadList
else
listType |= CannotBeObject
if(listType == BadList)
throw EXCEPTION("The given list cannot be converted to JSON.")
if(listType == CannotBeArray)
json += "{"
var/addComma
for(var/key in listVal)
if(addComma)
json += ","
else
addComma = TRUE
WriteString(json, key)
json += ":"
WriteValue(json, listVal[key])
json += "}"
else
json += "\["
var/addComma
for(var/key in listVal)
if(addComma)
json += ","
else
addComma = TRUE
WriteValue(json, key)
json += "]"
#undef Either
#undef CannotBeFlat
#undef CannotBeAssoc
#undef BadList
// ************************************ READER ************************************
#define aBackspace 0x08
#define aTab 0x09
#define aLineBreak 0x0A
#define aVertTab 0x0B
#define aFormFeed 0x0C
#define aCarriageReturn 0x0D
#define aSpace 0x20
#define aZero 0x30
#define aNonBreakSpace 0xA0
#define Advance if(++readPos > jsonLen) { curAscii = 0; curChar = "" } else { curAscii = text2ascii(json, readPos); curChar = ascii2text(curAscii) } // Deal with it.
#define SkipWhitespace while(curAscii in whitespace) Advance
#define AdvanceWS Advance; SkipWhitespace
/datum/jsonHelper/var
readPos
jsonLen
json
curAscii
curChar
static/list/whitespace = list(aTab, aLineBreak, aVertTab, aFormFeed, aCarriageReturn, aSpace, aNonBreakSpace)
/datum/jsonHelper/proc/parse(json)
readPos = 0
jsonLen = length(json)
src.json = json
curAscii = 0
curChar = ""
AdvanceWS
var/value = ParseValue()
if(readPos < jsonLen)
throw EXCEPTION("Expected: End of JSON")
return value
/datum/jsonHelper/proc/ParseValue()
if(curChar == "\"")
return ParseString()
else if(curChar == "-" || (curAscii >= aZero && curAscii <= aZero + 9))
return ParseNumber()
else if(curChar == "{")
return ParseObject()
else if(curChar == "\[")
return ParseArray()
else if(curChar == "t")
if(copytext(json, readPos, readPos+4) == "true")
readPos += 3
AdvanceWS
return TRUE
else
throw EXCEPTION("Expected: 'true'")
else if(curChar == "f")
if(copytext(json, readPos, readPos+5) == "false")
readPos += 4
AdvanceWS
return FALSE
else
throw EXCEPTION("Expected: 'false'")
else if(curChar == "n")
if(copytext(json, readPos, readPos+4) == "null")
readPos += 3
AdvanceWS
return null
else
throw EXCEPTION("Expected: 'null'")
else if(curChar == "")
throw EXCEPTION("Unexpected: End of JSON")
else
throw EXCEPTION("Unexpected: '[curChar]'")
/datum/jsonHelper/proc/ParseString()
ASSERT(curChar == "\"")
Advance
var/list/chars = list()
while(readPos <= jsonLen)
if(curChar == "\"")
AdvanceWS
return list2text(chars)
else if(curChar == "\\")
Advance
switch(curChar)
if("\"", "\\", "/")
chars += ascii2text(curAscii)
if("b")
chars += ascii2text(aBackspace)
if("f")
chars += ascii2text(aFormFeed)
if("n")
chars += "\n"
if("r")
chars += ascii2text(aCarriageReturn) // Should we ignore these?
if("t")
chars += "\t"
if("u")
throw EXCEPTION("JSON \\uXXXX escape sequence not supported")
else
throw EXCEPTION("Invalid escape sequence")
Advance
else
chars += ascii2text(curAscii)
Advance
throw EXCEPTION("Unterminated string")
/datum/jsonHelper/proc/ParseNumber()
var/firstPos = readPos
if(curChar == "-")
Advance
if(curAscii >= aZero + 1 && curAscii <= aZero + 9)
do
Advance
while(curAscii >= aZero && curAscii <= aZero + 9)
else if(curAscii == aZero)
Advance
else
throw EXCEPTION("Expected: digit")
if(curChar == ".")
Advance
var/found = FALSE
while(curAscii >= aZero && curAscii <= aZero + 9)
found = TRUE
Advance
if(!found)
throw EXCEPTION("Expected: digit")
if(curChar == "E" || curChar == "e")
Advance
var/found = FALSE
if(curChar == "-")
Advance
else if(curChar == "+")
Advance
while(curAscii >= aZero && curAscii <= aZero + 9)
found = TRUE
Advance
if(!found)
throw EXCEPTION("Expected: digit")
SkipWhitespace
return text2num(copytext(json, firstPos, readPos))
/datum/jsonHelper/proc/ParseObject()
ASSERT(curChar == "{")
var/list/object = list()
AdvanceWS
while(curChar == "\"")
var/key = ParseString()
if(curChar != ":")
throw EXCEPTION("Expected: ':'")
AdvanceWS
object[key] = ParseValue()
if(curChar == ",")
AdvanceWS
else
break
if(curChar != "}")
throw EXCEPTION("Expected: string or '}'")
AdvanceWS
return object
/datum/jsonHelper/proc/ParseArray()
ASSERT(curChar == "\[")
var/list/array = list()
AdvanceWS
while(curChar != "]")
array += list(ParseValue()) // Wrapped in a list in case ParseValue() returns a list.
if(curChar == ",")
AdvanceWS
else
break
if(curChar != "]")
throw EXCEPTION("Expected: ']'")
AdvanceWS
return array
#undef aBackspace
#undef aTab
#undef aLineBreak
#undef aVertTab
#undef aFormFeed
#undef aCarriageReturn
#undef aSpace
#undef aZero
#undef aNonBreakSpace
#undef Advance
#undef SkipWhitespace
#undef AdvanceWS
@@ -9,8 +9,6 @@
playsound(loc, 'sound/voice/hiss6.ogg', 80, 1, 1)
visible_message("<span class='name'>[src]</span> lets out a waning guttural screech, green blood bubbling from its maw...")
update_canmove()
if(client)
blind.layer = 0
update_icons()
status_flags |=CANPUSH
@@ -9,7 +9,6 @@
if(!gibbed)
visible_message("<span class='name'>[src]</span> lets out a waning high-pitched cry.")
update_canmove()
if(client) blind.layer = 0
tod = worldtime2text() //weasellos time of death patch
if(mind)
@@ -10,7 +10,6 @@
container.icon_state = "mmi_dead"
stat = DEAD
if(blind) blind.layer = 0
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
+3 -2
View File
@@ -169,9 +169,11 @@
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
/mob/living/carbon/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0)
/mob/living/carbon/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0)
var/damage = intensity - check_eye_prot()
if(..()) // we've been flashed
if(visual)
return
if(weakeyes)
Stun(2)
switch(damage)
@@ -202,7 +204,6 @@
else
src << "<span class='warning'>Your eyes are really starting to hurt. This can't be good for you!</span>"
return 1
else if(damage == 0) // just enough protection
if(prob(20))
src << "<span class='notice'>Something bright flashes in the corner of your vision!</span>"
@@ -32,9 +32,8 @@
emote("deathgasp") //let the world KNOW WE ARE DEAD
update_canmove()
if(client) blind.layer = 0
dna.species.spec_death(gibbed,src)
dna.species.spec_death(gibbed, src)
tod = worldtime2text() //weasellos time of death patch
if(mind)
@@ -263,7 +263,6 @@
dna.species.handle_chemicals_in_body(src)
/mob/living/carbon/human/handle_vision()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)
if(machine)
if(!machine.check_eye(src))
reset_view(null)
+2 -2
View File
@@ -12,7 +12,7 @@
message = dna.species.handle_speech(message,src)
if(viruses.len)
for(var/datum/disease/pierrot_throat/D in viruses)
var/list/temp_message = text2list(message, " ") //List each word in the message
var/list/temp_message = splittext(message, " ") //List each word in the message
var/list/pick_list = list()
for(var/i = 1, i <= temp_message.len, i++) //Create a second list for excluding words down the line
pick_list += i
@@ -22,7 +22,7 @@
if(findtext(temp_message[H], "*") || findtext(temp_message[H], ";") || findtext(temp_message[H], ":")) continue
temp_message[H] = "HONK"
pick_list -= H //Make sure that you dont HONK the same word twice
message = list2text(temp_message, " ")
message = jointext(temp_message, " ")
message = ..(message)
message = dna.mutations_say_mods(message)
return message
+69 -61
View File
@@ -668,78 +668,86 @@
return
/datum/species/proc/handle_vision(mob/living/carbon/human/H)
if( H.stat == DEAD )
if(H.stat == DEAD)
H.sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
H.see_in_dark = 8
if(!H.druggy)
H.see_invisible = SEE_INVISIBLE_LEVEL_TWO
return
if(!(SEE_TURFS & H.permanent_sight_flags))
H.sight &= ~SEE_TURFS
if(!(SEE_MOBS & H.permanent_sight_flags))
H.sight &= ~SEE_MOBS
if(!(SEE_OBJS & H.permanent_sight_flags))
H.sight &= ~SEE_OBJS
if(H.remote_view)
H.sight |= SEE_TURFS
H.sight |= SEE_MOBS
H.sight |= SEE_OBJS
H.see_in_dark = (H.sight == SEE_TURFS|SEE_MOBS|SEE_OBJS) ? 8 : darksight
var/see_temp = H.see_invisible
H.see_invisible = invis_sight
if(H.glasses)
if(istype(H.glasses, /obj/item/clothing/glasses))
var/obj/item/clothing/glasses/G = H.glasses
H.sight |= G.vision_flags
H.see_in_dark = G.darkness_view
if(G.invis_override)
H.see_invisible = G.invis_override
else
H.see_invisible = min(G.invis_view, H.see_invisible)
if(H.druggy) //Override for druggy
H.see_invisible = see_temp
if(H.see_override) //Override all
H.see_invisible = H.see_override
// This checks how much the mob's eyewear impairs their vision
if(H.tinttotal >= TINT_IMPAIR)
if(tinted_weldhelh)
H.overlay_fullscreen("tint", /obj/screen/fullscreen/impaired, 2)
if(H.tinttotal >= TINT_BLIND)
H.eye_blind = max(H.eye_blind, 1)
else
if(!(SEE_TURFS & H.permanent_sight_flags))
H.sight &= ~SEE_TURFS
if(!(SEE_MOBS & H.permanent_sight_flags))
H.sight &= ~SEE_MOBS
if(!(SEE_OBJS & H.permanent_sight_flags))
H.sight &= ~SEE_OBJS
H.clear_fullscreen("tint")
if(H.remote_view)
H.sight |= SEE_TURFS
H.sight |= SEE_MOBS
H.sight |= SEE_OBJS
if(H.eye_stat > 30)
H.overlay_fullscreen("impaired", /obj/screen/fullscreen/impaired, 2)
else if(H.eye_stat > 20)
H.overlay_fullscreen("impaired", /obj/screen/fullscreen/impaired, 1)
else
H.clear_fullscreen("impaired")
H.see_in_dark = (H.sight == SEE_TURFS|SEE_MOBS|SEE_OBJS) ? 8 : darksight
var/see_temp = H.see_invisible
H.see_invisible = invis_sight
if(!H.client)//no client, no screen to update
return 1
if(H.glasses)
if(istype(H.glasses, /obj/item/clothing/glasses))
var/obj/item/clothing/glasses/G = H.glasses
H.sight |= G.vision_flags
H.see_in_dark = G.darkness_view
if(G.invis_override)
H.see_invisible = G.invis_override
else
H.see_invisible = min(G.invis_view, H.see_invisible)
if(H.druggy) //Override for druggy
H.see_invisible = see_temp
if(H.eye_blind)
H.overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
H.throw_alert("blind", /obj/screen/alert/blind)
else
H.clear_fullscreen("blind")
H.clear_alert("blind")
if(H.see_override) //Override all
H.see_invisible = H.see_override
if(H.disabilities & NEARSIGHT && !istype(H.glasses, /obj/item/clothing/glasses/regular))
H.overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1)
else
H.clear_fullscreen("nearsighted")
// This checks how much the mob's eyewear impairs their vision
if(H.tinttotal >= TINT_IMPAIR)
if(tinted_weldhelh)
if(H.tinttotal >= TINT_BLIND)
H.eye_blind = max(H.eye_blind, 1)
if(H.client)
H.client.screen += global_hud.darkMask
if(H.eye_blurry)
H.overlay_fullscreen("blurry", /obj/screen/fullscreen/blurry)
else
H.clear_fullscreen("blurry")
if(H.blind)
if(H.eye_blind)
H.throw_alert("blind", /obj/screen/alert/blind)
H.blind.layer = 18
else
H.clear_alert("blind")
H.blind.layer = 0
if(!H.client)//no client, no screen to update
return 1
if( H.disabilities & NEARSIGHT && !istype(H.glasses, /obj/item/clothing/glasses/regular) )
H.client.screen += global_hud.vimpaired
if(H.eye_blurry)
H.client.screen += global_hud.blurry
if(H.druggy)
H.client.screen += global_hud.druggy
H.throw_alert("high", /obj/screen/alert/high)
else
H.clear_alert("high")
if(H.eye_stat > 20)
if(H.eye_stat > 30)
H.client.screen += global_hud.darkMask
else
H.client.screen += global_hud.vimpaired
if(H.druggy)
H.overlay_fullscreen("high", /obj/screen/fullscreen/high)
H.throw_alert("high", /obj/screen/alert/high)
else
H.clear_fullscreen("high")
H.clear_alert("high")
return 1
@@ -74,14 +74,12 @@ datum/species/human/spec_death(gibbed, mob/living/carbon/human/H)
return randname
var/regex/lizard_hiss = new("s+", "g")
var/regex/lizard_hiSS = new("S+", "g")
/datum/species/lizard/handle_speech(message)
if(copytext(message, 1, 2) != "*")
message = regEx_replaceall(message, "(?<!s)s(?!s)", "sss") //(?<!s) Not s before. (?!s) not s after. That way it only triples a single s instead of double ss.
message = regEx_replaceall(message, "(?<!s)ss(?!s)", "ssss")
message = regEx_replaceall(message, "(?<!S)S(?!S)", "SSS")
message = regEx_replaceall(message, "(?<!S)SS(?!S)", "SSSS")
message = lizard_hiss.Replace(message, "sss")
message = lizard_hiSS.Replace(message, "SSS")
return message
//I wag in death
@@ -415,7 +413,7 @@ datum/species/human/spec_death(gibbed, mob/living/carbon/human/H)
specflags = list(NOBREATH,HEATRES,COLDRES,NOBLOOD,RADIMMUNE)
/datum/species/zombie/handle_speech(message)
var/list/message_list = text2list(message, " ")
var/list/message_list = splittext(message, " ")
var/maxchanges = max(round(message_list.len / 1.5), 2)
for(var/i = rand(maxchanges / 2, maxchanges), i > 0, i--)
@@ -428,7 +426,7 @@ datum/species/human/spec_death(gibbed, mob/living/carbon/human/H)
if(prob(20) && message_list.len > 3)
message_list.Insert(insertpos, "[pick("BRAINS", "Brains", "Braaaiinnnsss", "BRAAAIIINNSSS")]...")
return list2text(message_list, " ")
return jointext(message_list, " ")
/datum/species/cosmetic_zombie
name = "Human"
+43 -74
View File
@@ -403,84 +403,53 @@
if(!client)
return 0
if(damageoverlay)
if(damageoverlay.overlays)
damageoverlay.overlays = list()
if(stat == UNCONSCIOUS)
//Critical damage passage overlay
if(health <= config.health_threshold_crit)
var/image/I = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "passage0")
I.blend_mode = BLEND_OVERLAY //damageoverlay is BLEND_MULTIPLY
switch(health)
if(-20 to -10)
I.icon_state = "passage1"
if(-30 to -20)
I.icon_state = "passage2"
if(-40 to -30)
I.icon_state = "passage3"
if(-50 to -40)
I.icon_state = "passage4"
if(-60 to -50)
I.icon_state = "passage5"
if(-70 to -60)
I.icon_state = "passage6"
if(-80 to -70)
I.icon_state = "passage7"
if(-90 to -80)
I.icon_state = "passage8"
if(-95 to -90)
I.icon_state = "passage9"
if(-INFINITY to -95)
I.icon_state = "passage10"
damageoverlay.overlays += I
if(stat == UNCONSCIOUS && health <= config.health_threshold_crit)
var/severity = 0
switch(health)
if(-20 to -10) severity = 1
if(-30 to -20) severity = 2
if(-40 to -30) severity = 3
if(-50 to -40) severity = 4
if(-60 to -50) severity = 5
if(-70 to -60) severity = 6
if(-80 to -70) severity = 7
if(-90 to -80) severity = 8
if(-95 to -90) severity = 9
if(-INFINITY to -95) severity = 10
overlay_fullscreen("crit", /obj/screen/fullscreen/crit, severity)
else
clear_fullscreen("crit")
if(oxyloss)
var/severity = 0
switch(oxyloss)
if(10 to 20) severity = 1
if(20 to 25) severity = 2
if(25 to 30) severity = 3
if(30 to 35) severity = 4
if(35 to 40) severity = 5
if(40 to 45) severity = 6
if(45 to INFINITY) severity = 7
overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity)
else
//Oxygen damage overlay
if(oxyloss)
var/image/I = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "oxydamageoverlay0")
switch(oxyloss)
if(10 to 20)
I.icon_state = "oxydamageoverlay1"
if(20 to 25)
I.icon_state = "oxydamageoverlay2"
if(25 to 30)
I.icon_state = "oxydamageoverlay3"
if(30 to 35)
I.icon_state = "oxydamageoverlay4"
if(35 to 40)
I.icon_state = "oxydamageoverlay5"
if(40 to 45)
I.icon_state = "oxydamageoverlay6"
if(45 to INFINITY)
I.icon_state = "oxydamageoverlay7"
damageoverlay.overlays += I
clear_fullscreen("oxy")
//Fire and Brute damage overlay (BSSR)
var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp
damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not.
if(hurtdamage)
var/image/I = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "brutedamageoverlay0")
I.blend_mode = BLEND_ADD
switch(hurtdamage)
if(5 to 15)
I.icon_state = "brutedamageoverlay1"
if(15 to 30)
I.icon_state = "brutedamageoverlay2"
if(30 to 45)
I.icon_state = "brutedamageoverlay3"
if(45 to 70)
I.icon_state = "brutedamageoverlay4"
if(70 to 85)
I.icon_state = "brutedamageoverlay5"
if(85 to INFINITY)
I.icon_state = "brutedamageoverlay6"
var/image/black = image(I.icon, I.icon_state) //BLEND_ADD doesn't let us darken, so this is just to blacken the edge of the screen
black.color = "#170000"
damageoverlay.overlays += I
damageoverlay.overlays += black
//Fire and Brute damage overlay (BSSR)
var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp
damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not.
if(hurtdamage)
var/severity = 0
switch(hurtdamage)
if(5 to 15) severity = 1
if(15 to 30) severity = 2
if(30 to 45) severity = 3
if(45 to 70) severity = 4
if(70 to 85) severity = 5
if(85 to INFINITY) severity = 6
overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity)
else
clear_fullscreen("brute")
..()
return 1
/mob/living/carbon/update_sight()
@@ -18,8 +18,6 @@
visible_message("<b>[src]</b> lets out a faint chimper as it collapses and stops moving...") //ded -- Urist
update_canmove()
if(blind)
blind.layer = 0
if(ticker && ticker.mode)
ticker.mode.check_win()
+13 -11
View File
@@ -1,3 +1,16 @@
/mob/living/death(gibbed)
eye_blind = max(eye_blind, 1)
timeofdeath = world.time
living_mob_list -= src
if(!gibbed)
dead_mob_list += src
else if(buckled)
buckled.unbuckle_mob()
clear_fullscreens()
..()
/mob/living/gib(animation = 1)
var/prev_lying = lying
death(1)
@@ -34,17 +47,6 @@
/mob/living/proc/dust_animation(animate, flick_name = "")
flick(flick_name, animate)
/mob/living/death(gibbed)
eye_blind = max(eye_blind, 1)
timeofdeath = world.time
living_mob_list -= src
if(!gibbed)
dead_mob_list += src
else if(buckled)
buckled.unbuckle_mob()
/mob/living/proc/setup_animation(animation, prev_lying)
var/atom/movable/overlay/animate = null
notransform = 1
+37 -34
View File
@@ -182,44 +182,47 @@
return 1
/mob/living/proc/handle_vision()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)
update_sight()
if(stat != DEAD)
if(blind)
if(eye_blind)
blind.layer = 18
throw_alert("blind", /obj/screen/alert/blind)
else
blind.layer = 0
clear_alert("blind")
if(stat == DEAD)
return
if(eye_blind)
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
throw_alert("blind", /obj/screen/alert/blind)
else
clear_fullscreen("blind")
clear_alert("blind")
if (disabilities & NEARSIGHT)
client.screen += global_hud.vimpaired
if (eye_blurry)
client.screen += global_hud.blurry
if (druggy)
client.screen += global_hud.druggy
throw_alert("high", /obj/screen/alert/high)
else
clear_alert("high")
if(eye_stat > 20)
if(eye_stat > 30)
client.screen += global_hud.darkMask
else
client.screen += global_hud.vimpaired
if(machine)
if (!( machine.check_eye(src) ))
reset_view(null)
if(disabilities & NEARSIGHT)
overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1)
else
if(!remote_view && !client.adminobs)
reset_view(null)
clear_fullscreen("nearsighted")
if(eye_blurry)
overlay_fullscreen("blurry", /obj/screen/fullscreen/blurry)
else
clear_fullscreen("blurry")
if(druggy)
overlay_fullscreen("high", /obj/screen/fullscreen/high)
throw_alert("high", /obj/screen/alert/high)
else
clear_fullscreen("high")
clear_alert("high")
if(eye_stat > 30)
overlay_fullscreen("impaired", /obj/screen/fullscreen/impaired, 2)
else if(eye_stat > 20)
overlay_fullscreen("impaired", /obj/screen/fullscreen/impaired, 1)
else
clear_fullscreen("impaired")
if(machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!remote_view && !client.adminobs)
reset_view(null)
/mob/living/proc/update_sight()
return
+4 -4
View File
@@ -193,8 +193,7 @@ Sorry Giacom. Please don't be mad :(
/mob/living/ex_act(severity, target)
..()
if(client && !eye_blind)
flick("flash", src.flash)
flash_eyes()
/mob/living/proc/updatehealth()
if(status_flags & GODMODE)
@@ -704,9 +703,10 @@ Sorry Giacom. Please don't be mad :(
floating = 0
//called when the mob receives a bright flash
/mob/living/proc/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0)
/mob/living/proc/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, type = /obj/screen/fullscreen/flash)
if(check_eye_prot() < intensity && (override_blindness_check || !(disabilities & BLIND)))
flick("e_flash", flash)
overlay_fullscreen("flash", type)
addtimer(src, "clear_fullscreen", 25, FALSE, "flash", 25)
return 1
//this returns the mob's protection against eye damage (number between -1 and 2)
+3 -5
View File
@@ -13,10 +13,8 @@
anchored = 0 //unbolt floorbolts
update_canmove()
if(src.eyeobj)
src.eyeobj.setLoc(get_turf(src))
if(blind)
blind.layer = 0
if(eyeobj)
eyeobj.setLoc(get_turf(src))
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
@@ -45,7 +43,7 @@
for(var/obj/machinery/ai_status_display/O in world) //change status
if(src.key)
O.mode = 2
if (istype(loc, /obj/item/device/aicard))
if(istype(loc, /obj/item/device/aicard))
loc.icon_state = "aicard-404"
tod = worldtime2text() //weasellos time of death patch
+16 -21
View File
@@ -53,15 +53,13 @@
//stage = 5
blindness = 1
if (!blindness)
if(!blindness)
//stage = 4.5
if (src.blind.layer != 0)
src.blind.layer = 0
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(see_override)
see_invisible = see_override
@@ -74,26 +72,23 @@
if (aiRestorePowerRoutine==2)
src << "Alert cancelled. Power has been restored without our assistance."
aiRestorePowerRoutine = 0
src.blind.layer = 0
return
else if (aiRestorePowerRoutine==3)
src << "Alert cancelled. Power has been restored."
aiRestorePowerRoutine = 0
src.blind.layer = 0
return
else
//stage = 6
src.blind.screen_loc = "1,1 to 15,15"
if (src.blind.layer!=18)
src.blind.layer = 18
src.sight = src.sight&~SEE_TURFS
src.sight = src.sight&~SEE_MOBS
src.sight = src.sight&~SEE_OBJS
src.see_in_dark = 0
src.see_invisible = SEE_INVISIBLE_LIVING
sight = src.sight&~SEE_TURFS
sight = src.sight&~SEE_MOBS
sight = src.sight&~SEE_OBJS
see_in_dark = 0
see_invisible = SEE_INVISIBLE_LIVING
if (lacks_power())
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
if(lacks_power())
if (aiRestorePowerRoutine==0)
aiRestorePowerRoutine = 1
@@ -111,7 +106,7 @@
if (!istype(T, /turf/space))
src << "Alert cancelled. Power has been restored without our assistance."
aiRestorePowerRoutine = 0
src.blind.layer = 0
clear_fullscreen("blind")
return
src << "Fault confirmed: missing external power. Shutting down main control system to save power."
sleep(20)
@@ -149,7 +144,7 @@
if (!istype(T, /turf/space))
src << "Alert cancelled. Power has been restored without our assistance."
aiRestorePowerRoutine = 0
src.blind.layer = 0 //This, too, is a fix to issue 603
clear_fullscreen("blind")
return
switch(PRP)
if (1) src << "APC located. Optimizing route to APC to avoid needless power waste."
+1 -13
View File
@@ -5,21 +5,9 @@
blood.override = 1
client.images += blood
regenerate_icons()
flash = new /obj/screen()
flash.icon_state = "blank"
flash.name = "flash"
flash.screen_loc = "1,1 to 15,15"
flash.layer = 17
blind = new /obj/screen()
blind.icon_state = "black"
blind.name = " "
blind.screen_loc = "1,1 to 15,15"
blind.layer = 0
client.screen.Add( blind, flash )
if(stat != DEAD)
for(var/obj/machinery/ai_status_display/O in machines) //change status
O.mode = 1
O.emotion = "Neutral"
src.view_core()
return
view_core()
+1 -1
View File
@@ -109,7 +109,7 @@ var/const/VOX_DELAY = 600
src << "<span class='notice'>Wireless interface disabled, unable to interact with announcement PA.</span>"
return
var/list/words = text2list(trim(message), " ")
var/list/words = splittext(trim(message), " ")
var/list/incorrect_words = list()
if(words.len > 30)
@@ -3,8 +3,6 @@
return
stat = DEAD
canmove = 0
if(blind)
blind.layer = 0
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
@@ -32,8 +32,6 @@
uneq_all() // particularly to ensure sight modes are cleared
if(blind)
blind.layer = 0
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
@@ -676,7 +676,7 @@
/mob/living/silicon/robot/attack_slime(mob/living/simple_animal/slime/M)
if(..()) //successful slime shock
flick("noise", flash)
flash_eyes()
var/stunprob = M.powerlevel * 7 + 10
if(prob(stunprob) && M.powerlevel >= 8)
adjustBruteLoss(M.powerlevel * rand(6,10))
@@ -1187,4 +1187,4 @@
Stun(8)
if(2)
Stun(3)
..()
..()
+3 -3
View File
@@ -135,9 +135,9 @@
src.take_organ_damage(20)
if(2)
src.take_organ_damage(10)
flick("noise", src:flash)
src << "<span class='userdanger'>*BZZZT*</span>"
src << "<span class='danger'>Warning: Electromagnetic pulse detected.</span>"
flash_eyes(affect_silicon = 1)
..()
/mob/living/silicon/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = 0)
@@ -393,7 +393,7 @@
visible_message("<span class='danger'>[M] has slashed at [src]!</span>", \
"<span class='userdanger'>[M] has slashed at [src]!</span>")
if(prob(8))
flick("noise", flash)
flash_eyes(affect_silicon = 1)
add_logs(M, src, "attacked")
adjustBruteLoss(damage)
updatehealth()
@@ -466,7 +466,7 @@
/mob/living/silicon/grabbedby(mob/living/user)
return
/mob/living/silicon/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0)
/mob/living/silicon/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, type = /obj/screen/fullscreen/flash/noise)
if(affect_silicon)
return ..()
@@ -18,14 +18,12 @@
return
if(buckled)
Feedstop(silent=1) //releases ourselves from the mob we fed on.
Feedstop(silent = 1) //releases ourselves from the mob we fed on.
stat = DEAD
overlays.len = 0
update_canmove()
if(blind)
blind.layer = 0
if(ticker && ticker.mode)
ticker.mode.check_win()
-3
View File
@@ -10,8 +10,6 @@
var/stat = 0 //Whether a mob is alive or dead. TODO: Move this to living - Nodrak
var/obj/screen/flash = null
var/obj/screen/blind = null
var/obj/screen/hands = null
var/obj/screen/pullin = null
var/obj/screen/internals = null
@@ -19,7 +17,6 @@
var/obj/screen/m_select = null
var/obj/screen/healths = null
var/obj/screen/throw_icon = null
var/obj/screen/damageoverlay = null
/*A bunch of this stuff really needs to go under their own defines instead of being globally attached to mob.
A variable should only be globally attached to turfs/objects/whatever, when it is in fact needed as such.
The current method unnecessarily clusters up the variable list, especially for humans (although rearranging won't really clean it up a lot but the difference will be noticable for other mobs).
+2 -2
View File
@@ -21,7 +21,7 @@ Contents:
/obj/item/clothing/mask/gas/voice/space_ninja/speechModification(message)
if(voice == "Unknown")
if(copytext(message, 1, 2) != "*")
var/list/temp_message = text2list(message, " ")
var/list/temp_message = splittext(message, " ")
var/list/pick_list = list()
for(var/i = 1, i <= temp_message.len, i++)
pick_list += i
@@ -30,7 +30,7 @@ Contents:
if(findtext(temp_message[H], "*") || findtext(temp_message[H], ";") || findtext(temp_message[H], ":")) continue
temp_message[H] = ninjaspeak(temp_message[H])
pick_list -= H
message = list2text(temp_message, " ")
message = jointext(temp_message, " ")
//The Alternate speech mod is now the main one.
message = replacetext(message, "l", "r")
@@ -155,8 +155,8 @@
src << "Missing Input"
return
var/list/startCoords = text2list(startInput, ";")
var/list/endCoords = text2list(endInput, ";")
var/list/startCoords = splittext(startInput, ";")
var/list/endCoords = splittext(endInput, ";")
if(!startCoords || !endCoords)
src << "Invalid Coords"
src << "Start Input: [startInput]"
+2 -2
View File
@@ -39,12 +39,12 @@
var/list/temp_list
if(!id_with_upload.len)
temp_list = list()
temp_list = text2list(id_with_upload_string, ";")
temp_list = splittext(id_with_upload_string, ";")
for(var/N in temp_list)
id_with_upload += text2num(N)
if(!id_with_download.len)
temp_list = list()
temp_list = text2list(id_with_download_string, ";")
temp_list = splittext(id_with_download_string, ";")
for(var/N in temp_list)
id_with_download += text2num(N)
+1 -1
View File
@@ -47,4 +47,4 @@
target.equip_to_slot_if_possible(magichead, slot_wear_mask, 1, 1)
playsound(get_turf(target), mSounds[randM], 50, 1)
flick("e_flash", target.flash)
target.flash_eyes()
+3 -3
View File
@@ -245,10 +245,10 @@
json_data["data"] = data
// Generate the JSON.
var/json = JSON.stringify(json_data)
var/json = json_encode(json_data)
// Strip #255/improper.
json = regex_replaceall(json, "\improper", "")
json = regex_replaceall(json, "\proper", "")
json = replacetext(json, "\improper", "")
json = replacetext(json, "\proper", "")
return json
/**