From 7b720a20b6b667600f8b540ef00db22d4d21f9c3 Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Wed, 24 Oct 2012 14:39:36 +0000 Subject: [PATCH] >Moved most of the helper procs into code/__HELPERS. If you see ANYTHING generic enough to be a helper proc just throw it in there and help purge the copypasta 5ever >Replaced dd_text2list, dd_text2listcase, tg_text2listcase and tg_text2list with text2list and text2listEx. text2list will return a list of each and every character in the string if you set separator="" >added return_file_text(filepath) which returns text from a file after doing some checks: does the file exist? is the file empty? It prints helpful error messages to the world.log if it runs into problems >Replaced dd_file2list(filepath, seperator) with file2list(filepath, seperator). It just calls text2list(return_file_text(filepath), seperator). rather than copypasta >Replaced time_stamp() so it's not as retarded >Lots of the world setup stuff uses file2list now, rather than file2text -> sanity -> text2list >Added error() warning() testing() procs. These print messages to world.log with a prefix. e.g. ## ERROR: msg. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4948 316c924e-a436-60f5-8080-3fe189b3f50e --- code/__HELPERS/files.dm | 18 + .../gamehelpers.dm => __HELPERS/game.dm} | 0 .../procs => __HELPERS}/global_lists.dm | 0 .../icon_procs.dm => __HELPERS/icons.dm} | 217 +++++++++++- .../helper_list.dm => __HELPERS/lists.dm} | 0 code/{defines/procs => __HELPERS}/logging.dm | 12 + .../syndicate_name.dm => __HELPERS/names.dm} | 114 +++++++ .../helper_text.dm => __HELPERS/text.dm} | 4 +- .../procs/time_stamp.dm => __HELPERS/time.dm} | 10 +- .../type2type.dm} | 146 +++------ .../helpers.dm => __HELPERS/unsorted.dm} | 0 code/controllers/configuration.dm | 50 +-- code/datums/helper_datums/getrev.dm | 18 +- code/defines/procs/church_name.dm | 16 - code/defines/procs/command_name.dm | 30 -- code/defines/procs/icon_procs_readme.dm | 214 ------------ code/defines/procs/religion_name.dm | 11 - code/defines/procs/station_name.dm | 68 ---- code/game/jobs/access.dm | 4 +- code/game/jobs/job_controller.dm | 8 +- code/game/jobs/whitelist.dm | 7 +- code/game/machinery/computer/security.dm | 2 +- code/game/machinery/navbeacon.dm | 2 +- code/game/machinery/vending.dm | 14 +- code/game/objects/items/devices/uplinks.dm | 2 +- code/game/objects/items/devices/violin.dm | 8 +- code/game/objects/structures/musician.dm | 14 +- code/modules/admin/ToRban.dm | 30 +- code/modules/admin/holder2.dm | 4 +- code/modules/admin/verbs/adminhelp.dm | 4 +- code/modules/awaymissions/zlevel.dm | 13 +- code/modules/flufftext/TextFilters.dm | 4 +- code/modules/mob/living/carbon/human/say.dm | 4 +- .../mob/living/carbon/human/whisper.dm | 2 +- code/modules/mob/mob.dm | 12 +- code/modules/research/server.dm | 4 +- .../scripting/Implementations/_Logic.dm | 2 +- code/names.dm | 25 +- code/world.dm | 38 +-- tgstation.dme | 308 +----------------- 40 files changed, 531 insertions(+), 908 deletions(-) create mode 100644 code/__HELPERS/files.dm rename code/{defines/procs/gamehelpers.dm => __HELPERS/game.dm} (100%) rename code/{defines/procs => __HELPERS}/global_lists.dm (100%) rename code/{defines/procs/icon_procs.dm => __HELPERS/icons.dm} (61%) rename code/{defines/procs/helper_list.dm => __HELPERS/lists.dm} (100%) rename code/{defines/procs => __HELPERS}/logging.dm (73%) rename code/{defines/procs/syndicate_name.dm => __HELPERS/names.dm} (65%) rename code/{defines/procs/helper_text.dm => __HELPERS/text.dm} (96%) rename code/{defines/procs/time_stamp.dm => __HELPERS/time.dm} (66%) rename code/{defines/procs/helper_type2type.dm => __HELPERS/type2type.dm} (51%) rename code/{defines/procs/helpers.dm => __HELPERS/unsorted.dm} (100%) delete mode 100644 code/defines/procs/church_name.dm delete mode 100644 code/defines/procs/command_name.dm delete mode 100644 code/defines/procs/icon_procs_readme.dm delete mode 100644 code/defines/procs/religion_name.dm delete mode 100644 code/defines/procs/station_name.dm diff --git a/code/__HELPERS/files.dm b/code/__HELPERS/files.dm new file mode 100644 index 0000000000..955c5ba300 --- /dev/null +++ b/code/__HELPERS/files.dm @@ -0,0 +1,18 @@ +//checks if a file exists and contains text +//returns text as a string if these conditions are met +/proc/return_file_text(filename) + if(fexists(filename) == 0) + error("File not found ([filename])") + return + + var/text = file2text(filename) + if(!text) + error("File empty ([filename])") + return + + return text + +//Sends resource files to client cache +/mob/proc/getFiles() + for(var/file in args) + src << browse_rsc(file) \ No newline at end of file diff --git a/code/defines/procs/gamehelpers.dm b/code/__HELPERS/game.dm similarity index 100% rename from code/defines/procs/gamehelpers.dm rename to code/__HELPERS/game.dm diff --git a/code/defines/procs/global_lists.dm b/code/__HELPERS/global_lists.dm similarity index 100% rename from code/defines/procs/global_lists.dm rename to code/__HELPERS/global_lists.dm diff --git a/code/defines/procs/icon_procs.dm b/code/__HELPERS/icons.dm similarity index 61% rename from code/defines/procs/icon_procs.dm rename to code/__HELPERS/icons.dm index c8d731bcde..09526c0703 100644 --- a/code/defines/procs/icon_procs.dm +++ b/code/__HELPERS/icons.dm @@ -1,8 +1,217 @@ /* - IconProcs - by Lummox JR - Check the icon_procs_readme.dm for how they work. - */ +IconProcs README + +A BYOND library for manipulating icons and colors + +by Lummox JR + +version 1.0 + +The IconProcs library was made to make a lot of common icon operations much easier. BYOND's icon manipulation +routines are very capable but some of the advanced capabilities like using alpha transparency can be unintuitive to beginners. + +CHANGING ICONS + +Several new procs have been added to the /icon datum to simplify working with icons. To use them, +remember you first need to setup an /icon var like so: + +var/icon/my_icon = new('iconfile.dmi') + +icon/ChangeOpacity(amount = 1) + A very common operation in DM is to try to make an icon more or less transparent. Making an icon more + transparent is usually much easier than making it less so, however. This proc basically is a frontend + for MapColors() which can change opacity any way you like, in much the same way that SetIntensity() + can make an icon lighter or darker. If amount is 0.5, the opacity of the icon will be cut in half. + If amount is 2, opacity is doubled and anything more than half-opaque will become fully opaque. +icon/GrayScale() + Converts the icon to grayscale instead of a fully colored icon. Alpha values are left intact. +icon/ColorTone(tone) + Similar to GrayScale(), this proc converts the icon to a range of black -> tone -> white, where tone is an + RGB color (its alpha is ignored). This can be used to create a sepia tone or similar effect. + See also the global ColorTone() proc. +icon/MinColors(icon) + The icon is blended with a second icon where the minimum of each RGB pixel is the result. + Transparency may increase, as if the icons were blended with ICON_ADD. You may supply a color in place of an icon. +icon/MaxColors(icon) + The icon is blended with a second icon where the maximum of each RGB pixel is the result. + Opacity may increase, as if the icons were blended with ICON_OR. You may supply a color in place of an icon. +icon/Opaque(background = "#000000") + All alpha values are set to 255 throughout the icon. Transparent pixels become black, or whatever background color you specify. +icon/BecomeAlphaMask() + You can convert a simple grayscale icon into an alpha mask to use with other icons very easily with this proc. + The black parts become transparent, the white parts stay white, and anything in between becomes a translucent shade of white. +icon/AddAlphaMask(mask) + The alpha values of the mask icon will be blended with the current icon. Anywhere the mask is opaque, + the current icon is untouched. Anywhere the mask is transparent, the current icon becomes transparent. + Where the mask is translucent, the current icon becomes more transparent. +icon/UseAlphaMask(mask, mode) + Sometimes you may want to take the alpha values from one icon and use them on a different icon. + This proc will do that. Just supply the icon whose alpha mask you want to use, and src will change + so it has the same colors as before but uses the mask for opacity. + +COLOR MANAGEMENT AND HSV + +RGB isn't the only way to represent color. Sometimes it's more useful to work with a model called HSV, which stands for hue, saturation, and value. + + * The hue of a color describes where it is along the color wheel. It goes from red to yellow to green to + cyan to blue to magenta and back to red. + * The saturation of a color is how much color is in it. A color with low saturation will be more gray, + and with no saturation at all it is a shade of gray. + * The value of a color determines how bright it is. A high-value color is vivid, moderate value is dark, + and no value at all is black. + +Just as BYOND uses "#rrggbb" to represent RGB values, a similar format is used for HSV: "#hhhssvv". The hue is three +hex digits because it ranges from 0 to 0x5FF. + + * 0 to 0xFF - red to yellow + * 0x100 to 0x1FF - yellow to green + * 0x200 to 0x2FF - green to cyan + * 0x300 to 0x3FF - cyan to blue + * 0x400 to 0x4FF - blue to magenta + * 0x500 to 0x5FF - magenta to red + +Knowing this, you can figure out that red is "#000ffff" in HSV format, which is hue 0 (red), saturation 255 (as colorful as possible), +value 255 (as bright as possible). Green is "#200ffff" and blue is "#400ffff". + +More than one HSV color can match the same RGB color. + +Here are some procs you can use for color management: + +ReadRGB(rgb) + Takes an RGB string like "#ffaa55" and converts it to a list such as list(255,170,85). If an RGBA format is used + that includes alpha, the list will have a fourth item for the alpha value. +hsv(hue, sat, val, apha) + Counterpart to rgb(), this takes the values you input and converts them to a string in "#hhhssvv" or "#hhhssvvaa" + format. Alpha is not included in the result if null. +ReadHSV(rgb) + Takes an HSV string like "#100FF80" and converts it to a list such as list(256,255,128). If an HSVA format is used that + includes alpha, the list will have a fourth item for the alpha value. +RGBtoHSV(rgb) + Takes an RGB or RGBA string like "#ffaa55" and converts it into an HSV or HSVA color such as "#080aaff". +HSVtoRGB(hsv) + Takes an HSV or HSVA string like "#080aaff" and converts it into an RGB or RGBA color such as "#ff55aa". +BlendRGB(rgb1, rgb2, amount) + Blends between two RGB or RGBA colors using regular RGB blending. If amount is 0, the first color is the result; + if 1, the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well. + The returned value is an RGB or RGBA color. +BlendHSV(hsv1, hsv2, amount) + Blends between two HSV or HSVA colors using HSV blending, which tends to produce nicer results than regular RGB + blending because the brightness of the color is left intact. If amount is 0, the first color is the result; if 1, + the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well. + The returned value is an HSV or HSVA color. +BlendRGBasHSV(rgb1, rgb2, amount) + Like BlendHSV(), but the colors used and the return value are RGB or RGBA colors. The blending is done in HSV form. +HueToAngle(hue) + Converts a hue to an angle range of 0 to 360. Angle 0 is red, 120 is green, and 240 is blue. +AngleToHue(hue) + Converts an angle to a hue in the valid range. +RotateHue(hsv, angle) + Takes an HSV or HSVA value and rotates the hue forward through red, green, and blue by an angle from 0 to 360. + (Rotating red by 60° produces yellow.) The result is another HSV or HSVA color with the same saturation and value + as the original, but a different hue. +GrayScale(rgb) + Takes an RGB or RGBA color and converts it to grayscale. Returns an RGB or RGBA string. +ColorTone(rgb, tone) + Similar to GrayScale(), this proc converts an RGB or RGBA color to a range of black -> tone -> white instead of + using strict shades of gray. The tone value is an RGB color; any alpha value is ignored. +*/ + +/* +Get Flat Icon DEMO by DarkCampainger + +This is a test for the get flat icon proc, modified approprietly for icons and their states. +Probably not a good idea to run this unless you want to see how the proc works in detail. +mob + icon = 'old_or_unused.dmi' + icon_state = "green" + + Login() + // Testing image underlays + underlays += image(icon='old_or_unused.dmi',icon_state="red") + underlays += image(icon='old_or_unused.dmi',icon_state="red", pixel_x = 32) + underlays += image(icon='old_or_unused.dmi',icon_state="red", pixel_x = -32) + + // Testing image overlays + overlays += image(icon='old_or_unused.dmi',icon_state="green", pixel_x = 32, pixel_y = -32) + overlays += image(icon='old_or_unused.dmi',icon_state="green", pixel_x = 32, pixel_y = 32) + overlays += image(icon='old_or_unused.dmi',icon_state="green", pixel_x = -32, pixel_y = -32) + + // Testing icon file overlays (defaults to mob's state) + overlays += '_flat_demoIcons2.dmi' + + // Testing icon_state overlays (defaults to mob's icon) + overlays += "white" + + // Testing dynamic icon overlays + var/icon/I = icon('old_or_unused.dmi', icon_state="aqua") + I.Shift(NORTH,16,1) + overlays+=I + + // Testing dynamic image overlays + I=image(icon=I,pixel_x = -32, pixel_y = 32) + overlays+=I + + // Testing object types (and layers) + overlays+=/obj/effect/overlayTest + + loc = locate (10,10,1) + verb + Browse_Icon() + set name = "1. Browse Icon" + // Give it a name for the cache + var/iconName = "[ckey(src.name)]_flattened.dmi" + // Send the icon to src's local cache + src<

") + + Output_Icon() + set name = "2. Output Icon" + src<<"Icon is: \icon[getFlatIcon(src)]" + + Label_Icon() + set name = "3. Label Icon" + // Give it a name for the cache + var/iconName = "[ckey(src.name)]_flattened.dmi" + // Copy the file to the rsc manually + var/icon/I = fcopy_rsc(getFlatIcon(src)) + // Send the icon to src's local cache + src< textlength) - textList += "" - return textList - loops-- - return - -//Text 'text' will be added as elements of a list when seperated by 'seperator'. The separator is case sensitive. -/proc/dd_text2list_case(text, separator, var/list/withinList) - var/textlength = length(text) - var/separatorlength = length(separator) - if(withinList && !withinList.len) withinList = null - var/list/textList = new() - var/searchPosition = 1 - var/findPosition = 1 - var/loops = 999 - while(loops) //Byond will think 1000+ iterations of a loop is an infinite loop - findPosition = findtextEx(text, separator, searchPosition, 0) - var/buggyText = copytext(text, searchPosition, findPosition) - if(!withinList || (buggyText in withinList)) textList += "[buggyText]" - if(!findPosition) return textList - searchPosition = findPosition + separatorlength - if(searchPosition > textlength) - textList += "" - return textList - loops-- - return //Attaches each element of a list to a single string seperated by 'seperator'. /proc/dd_list2text(var/list/the_list, separator) @@ -138,46 +97,6 @@ count++ return newText -//tg_text2list is faster then dd_text2list -//not case sensitive version -proc/tg_text2list(string, separator=",") - if(!string) - return - var/list/output = new - var/seplength = length(separator) - var/strlength = length(string) - var/prev = 1 - var/index - do - index = findtext(string, separator, prev, 0) - output += copytext(string, prev, index) - if(!index) - break - prev = index+seplength - if(prev>strlength) - break - while(index) - return output - -//case sensitive version -proc/tg_text2list_case(string, separator=",") - if(!string) - return - var/list/output = new - var/seplength = length(separator) - var/strlength = length(string) - var/prev = 1 - var/index - do - index = findtextEx(string, separator, prev, 0) - output += copytext(string, prev, index) - if(!index) - break - prev = index+seplength - if(prev>strlength) - break - while(index) - return output //slower then dd_list2text, but correctly processes associative lists. proc/tg_list2text(list/list, glue=",") @@ -188,16 +107,58 @@ proc/tg_list2text(list/list, glue=",") output += (i!=1? glue : null)+(!isnull(list["[list[i]]"])?"[list["[list[i]]"]]":"[list[i]]") return output -//Gets a file and adds its contents to a list. -/proc/dd_file2list(file_path, separator) - var/file - if(separator == null) - separator = "\n" - if(isfile(file_path)) - file = file_path - else - file = file(file_path) - return dd_text2list(file2text(file), separator) + +//Converts a text string into a list by splitting the string at each seperator found in text (discarding the seperator) +//Returns an empty list if the text cannot be split, or the split text in a list. +//Not giving a "" seperator will cause the text to be broken into a list of single letters. +/proc/text2list(text, seperator="\n") + . = list() + + var/text_len = length(text) //length of the input text + var/seperator_len = length(seperator) //length of the seperator text + + if(text_len >= seperator_len) + var/i + var/last_i = 1 + + for(i=1,i<=(text_len+1-seperator_len),i++) + if( cmptext(copytext(text,i,i+seperator_len), seperator) ) + if(i != last_i) + . += copytext(text,last_i,i) + last_i = i + seperator_len + + if(last_i <= text_len) + . += copytext(text, last_i, 0) + return . + +//Converts a text string into a list by splitting the string at each seperator found in text (discarding the seperator) +//Returns an empty list if the text cannot be split, or the split text in a list. +//Not giving a "" seperator will cause the text to be broken into a list of single letters. +//Case Sensitive! +/proc/text2listEx(text, seperator="\n") + . = list() + + var/text_len = length(text) //length of the input text + var/seperator_len = length(seperator) //length of the seperator text + + if(text_len > seperator_len) + var/i + var/last_i = 1 + + for(i=1,i<=(text_len+1-seperator_len),i++) + if( cmptextEx(copytext(text,i,i+seperator_len), seperator) ) + if(i != last_i) + . += copytext(text,last_i,i) + last_i = i + seperator_len + + if(last_i <= text_len) + . += copytext(text, last_i, 0) + return . + +//Splits the text of a file at seperator and returns them in a list. +/proc/file2list(filename, seperator="\n") + return text2list(return_file_text(filename),seperator) + //Turns a direction into text /proc/dir2text(direction) @@ -259,6 +220,3 @@ proc/tg_list2text(list/list, glue=",") /proc/angle2text(var/degree) return dir2text(angle2dir(degree)) -//Returns the world time in english -proc/worldtime2text() - return "[round(world.time / 36000)+12]:[(world.time / 600 % 60) < 10 ? add_zero(world.time / 600 % 60, 1) : world.time / 600 % 60]" \ No newline at end of file diff --git a/code/defines/procs/helpers.dm b/code/__HELPERS/unsorted.dm similarity index 100% rename from code/defines/procs/helpers.dm rename to code/__HELPERS/unsorted.dm diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index ee557da241..d1a8e5e00f 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -110,20 +110,10 @@ src.votable_modes += "secret" /datum/configuration/proc/load(filename, type = "config") //the type can also be game_options, in which case it uses a different switch. not making it separate to not copypaste code - Urist - var/text = file2text(filename) + var/list/Lines = file2list(filename) - if (!text) - diary << "No [filename] file found, setting defaults" - src = new /datum/configuration() - return - - diary << "Reading configuration file [filename]" - - var/list/CL = dd_text2list(text, "\n") - - for (var/t in CL) - if (!t) - continue + for(var/t in Lines) + if(!t) continue t = trim(t) if (length(t) == 0) @@ -377,20 +367,9 @@ diary << "Unknown setting in configuration: '[name]'" /datum/configuration/proc/loadsql(filename) // -- TLE - var/text = file2text(filename) - - if (!text) - diary << "No dbconfig.txt file found, retaining defaults" - world << "No dbconfig.txt file found, retaining defaults" - return - - diary << "Reading database configuration file [filename]" - - var/list/CL = dd_text2list(text, "\n") - - for (var/t in CL) - if (!t) - continue + var/list/Lines = file2list(filename) + for(var/t in Lines) + if(!t) continue t = trim(t) if (length(t) == 0) @@ -434,20 +413,9 @@ diary << "Unknown setting in configuration: '[name]'" /datum/configuration/proc/loadforumsql(filename) // -- TLE - var/text = file2text(filename) - - if (!text) - diary << "No forumdbconfig.txt file found, retaining defaults" - world << "No forumdbconfig.txt file found, retaining defaults" - return - - diary << "Reading forum database configuration file [filename]" - - var/list/CL = dd_text2list(text, "\n") - - for (var/t in CL) - if (!t) - continue + var/list/Lines = file2list(filename) + for(var/t in Lines) + if(!t) continue t = trim(t) if (length(t) == 0) diff --git a/code/datums/helper_datums/getrev.dm b/code/datums/helper_datums/getrev.dm index 03732d6873..04ee19210d 100644 --- a/code/datums/helper_datums/getrev.dm +++ b/code/datums/helper_datums/getrev.dm @@ -20,18 +20,10 @@ var/global/datum/getrev/revdata = new("config/svndir.txt") New(filename) ..() - if(!fexists(filename)) - return abort() - - var/text = file2text(file(filename)) - if(!text) - world.log << "Unable to get [filename] contents, aborting" - return abort() - - var/list/CL = tg_text2list(text, "\n") - for (var/t in CL) - if (!t) - continue + var/list/Lines = file2list(filename) + if(!Lines.len) return abort() + for(var/t in Lines) + if(!t) continue t = trim(t) if (length(t) == 0) continue @@ -54,7 +46,7 @@ var/global/datum/getrev/revdata = new("config/svndir.txt") revhref = value if(svndirpath && fexists(svndirpath) && fexists("[svndirpath]/entries") && isfile(file("[svndirpath]/entries"))) - var/list/filelist = dd_file2list("[svndirpath]/entries",null) + var/list/filelist = file2list("[svndirpath]/entries") if(filelist.len < 4) return abort() revision = filelist[4] diff --git a/code/defines/procs/church_name.dm b/code/defines/procs/church_name.dm deleted file mode 100644 index 0c8f1a6667..0000000000 --- a/code/defines/procs/church_name.dm +++ /dev/null @@ -1,16 +0,0 @@ -var/church_name = null -/proc/church_name() - if (church_name) - return church_name - - var/name = "" - - name += pick("Holy", "United", "First", "Second", "Last") - - if (prob(20)) - name += " Space" - - name += " " + pick("Church", "Cathedral", "Body", "Worshippers", "Movement", "Witnesses") - name += " of [religion_name()]" - - return name diff --git a/code/defines/procs/command_name.dm b/code/defines/procs/command_name.dm deleted file mode 100644 index 255c3947db..0000000000 --- a/code/defines/procs/command_name.dm +++ /dev/null @@ -1,30 +0,0 @@ -var/command_name = null -/proc/command_name() - if (command_name) - return command_name - - var/name = "Central Command" -/* - if (prob(10)) - name += pick("Super", "Ultra") - name += " " - - // Prefix - if (name) - name += pick("", "Central", "System", "Home", "Primary", "Alpha", "Friend", "Science", "Renegade") - else - name += pick("Central", "System", "Home", "Primary", "Alpha", "Friend", "Science", "Renegade") - if (name) - name += " " - - // Suffix - name += pick("Federation", "Command", "Alliance", "Unity", "Empire", "Confederation", "Kingdom", "Monarchy", "Complex", "Protectorate", "Commonwealth", "Imperium", "Republic") -*/ - command_name = name - return name - -/proc/change_command_name(var/name) - - command_name = name - - return name diff --git a/code/defines/procs/icon_procs_readme.dm b/code/defines/procs/icon_procs_readme.dm deleted file mode 100644 index f51ae4246f..0000000000 --- a/code/defines/procs/icon_procs_readme.dm +++ /dev/null @@ -1,214 +0,0 @@ -/* -IconProcs README - -A BYOND library for manipulating icons and colors - -by Lummox JR - -version 1.0 - -The IconProcs library was made to make a lot of common icon operations much easier. BYOND's icon manipulation -routines are very capable but some of the advanced capabilities like using alpha transparency can be unintuitive to beginners. - -CHANGING ICONS - -Several new procs have been added to the /icon datum to simplify working with icons. To use them, -remember you first need to setup an /icon var like so: - -var/icon/my_icon = new('iconfile.dmi') - -icon/ChangeOpacity(amount = 1) - A very common operation in DM is to try to make an icon more or less transparent. Making an icon more - transparent is usually much easier than making it less so, however. This proc basically is a frontend - for MapColors() which can change opacity any way you like, in much the same way that SetIntensity() - can make an icon lighter or darker. If amount is 0.5, the opacity of the icon will be cut in half. - If amount is 2, opacity is doubled and anything more than half-opaque will become fully opaque. -icon/GrayScale() - Converts the icon to grayscale instead of a fully colored icon. Alpha values are left intact. -icon/ColorTone(tone) - Similar to GrayScale(), this proc converts the icon to a range of black -> tone -> white, where tone is an - RGB color (its alpha is ignored). This can be used to create a sepia tone or similar effect. - See also the global ColorTone() proc. -icon/MinColors(icon) - The icon is blended with a second icon where the minimum of each RGB pixel is the result. - Transparency may increase, as if the icons were blended with ICON_ADD. You may supply a color in place of an icon. -icon/MaxColors(icon) - The icon is blended with a second icon where the maximum of each RGB pixel is the result. - Opacity may increase, as if the icons were blended with ICON_OR. You may supply a color in place of an icon. -icon/Opaque(background = "#000000") - All alpha values are set to 255 throughout the icon. Transparent pixels become black, or whatever background color you specify. -icon/BecomeAlphaMask() - You can convert a simple grayscale icon into an alpha mask to use with other icons very easily with this proc. - The black parts become transparent, the white parts stay white, and anything in between becomes a translucent shade of white. -icon/AddAlphaMask(mask) - The alpha values of the mask icon will be blended with the current icon. Anywhere the mask is opaque, - the current icon is untouched. Anywhere the mask is transparent, the current icon becomes transparent. - Where the mask is translucent, the current icon becomes more transparent. -icon/UseAlphaMask(mask, mode) - Sometimes you may want to take the alpha values from one icon and use them on a different icon. - This proc will do that. Just supply the icon whose alpha mask you want to use, and src will change - so it has the same colors as before but uses the mask for opacity. - -COLOR MANAGEMENT AND HSV - -RGB isn't the only way to represent color. Sometimes it's more useful to work with a model called HSV, which stands for hue, saturation, and value. - - * The hue of a color describes where it is along the color wheel. It goes from red to yellow to green to - cyan to blue to magenta and back to red. - * The saturation of a color is how much color is in it. A color with low saturation will be more gray, - and with no saturation at all it is a shade of gray. - * The value of a color determines how bright it is. A high-value color is vivid, moderate value is dark, - and no value at all is black. - -Just as BYOND uses "#rrggbb" to represent RGB values, a similar format is used for HSV: "#hhhssvv". The hue is three -hex digits because it ranges from 0 to 0x5FF. - - * 0 to 0xFF - red to yellow - * 0x100 to 0x1FF - yellow to green - * 0x200 to 0x2FF - green to cyan - * 0x300 to 0x3FF - cyan to blue - * 0x400 to 0x4FF - blue to magenta - * 0x500 to 0x5FF - magenta to red - -Knowing this, you can figure out that red is "#000ffff" in HSV format, which is hue 0 (red), saturation 255 (as colorful as possible), -value 255 (as bright as possible). Green is "#200ffff" and blue is "#400ffff". - -More than one HSV color can match the same RGB color. - -Here are some procs you can use for color management: - -ReadRGB(rgb) - Takes an RGB string like "#ffaa55" and converts it to a list such as list(255,170,85). If an RGBA format is used - that includes alpha, the list will have a fourth item for the alpha value. -hsv(hue, sat, val, apha) - Counterpart to rgb(), this takes the values you input and converts them to a string in "#hhhssvv" or "#hhhssvvaa" - format. Alpha is not included in the result if null. -ReadHSV(rgb) - Takes an HSV string like "#100FF80" and converts it to a list such as list(256,255,128). If an HSVA format is used that - includes alpha, the list will have a fourth item for the alpha value. -RGBtoHSV(rgb) - Takes an RGB or RGBA string like "#ffaa55" and converts it into an HSV or HSVA color such as "#080aaff". -HSVtoRGB(hsv) - Takes an HSV or HSVA string like "#080aaff" and converts it into an RGB or RGBA color such as "#ff55aa". -BlendRGB(rgb1, rgb2, amount) - Blends between two RGB or RGBA colors using regular RGB blending. If amount is 0, the first color is the result; - if 1, the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well. - The returned value is an RGB or RGBA color. -BlendHSV(hsv1, hsv2, amount) - Blends between two HSV or HSVA colors using HSV blending, which tends to produce nicer results than regular RGB - blending because the brightness of the color is left intact. If amount is 0, the first color is the result; if 1, - the second color is the result. 0.5 produces an average of the two. Values outside the 0 to 1 range are allowed as well. - The returned value is an HSV or HSVA color. -BlendRGBasHSV(rgb1, rgb2, amount) - Like BlendHSV(), but the colors used and the return value are RGB or RGBA colors. The blending is done in HSV form. -HueToAngle(hue) - Converts a hue to an angle range of 0 to 360. Angle 0 is red, 120 is green, and 240 is blue. -AngleToHue(hue) - Converts an angle to a hue in the valid range. -RotateHue(hsv, angle) - Takes an HSV or HSVA value and rotates the hue forward through red, green, and blue by an angle from 0 to 360. - (Rotating red by 60° produces yellow.) The result is another HSV or HSVA color with the same saturation and value - as the original, but a different hue. -GrayScale(rgb) - Takes an RGB or RGBA color and converts it to grayscale. Returns an RGB or RGBA string. -ColorTone(rgb, tone) - Similar to GrayScale(), this proc converts an RGB or RGBA color to a range of black -> tone -> white instead of - using strict shades of gray. The tone value is an RGB color; any alpha value is ignored. -*/ - -/* -Get Flat Icon DEMO by DarkCampainger - -This is a test for the get flat icon proc, modified approprietly for icons and their states. -Probably not a good idea to run this unless you want to see how the proc works in detail. -mob - icon = 'old_or_unused.dmi' - icon_state = "green" - - Login() - // Testing image underlays - underlays += image(icon='old_or_unused.dmi',icon_state="red") - underlays += image(icon='old_or_unused.dmi',icon_state="red", pixel_x = 32) - underlays += image(icon='old_or_unused.dmi',icon_state="red", pixel_x = -32) - - // Testing image overlays - overlays += image(icon='old_or_unused.dmi',icon_state="green", pixel_x = 32, pixel_y = -32) - overlays += image(icon='old_or_unused.dmi',icon_state="green", pixel_x = 32, pixel_y = 32) - overlays += image(icon='old_or_unused.dmi',icon_state="green", pixel_x = -32, pixel_y = -32) - - // Testing icon file overlays (defaults to mob's state) - overlays += '_flat_demoIcons2.dmi' - - // Testing icon_state overlays (defaults to mob's icon) - overlays += "white" - - // Testing dynamic icon overlays - var/icon/I = icon('old_or_unused.dmi', icon_state="aqua") - I.Shift(NORTH,16,1) - overlays+=I - - // Testing dynamic image overlays - I=image(icon=I,pixel_x = -32, pixel_y = 32) - overlays+=I - - // Testing object types (and layers) - overlays+=/obj/effect/overlayTest - - loc = locate (10,10,1) - verb - Browse_Icon() - set name = "1. Browse Icon" - // Give it a name for the cache - var/iconName = "[ckey(src.name)]_flattened.dmi" - // Send the icon to src's local cache - src<

") - - Output_Icon() - set name = "2. Output Icon" - src<<"Icon is: \icon[getFlatIcon(src)]" - - Label_Icon() - set name = "3. Label Icon" - // Give it a name for the cache - var/iconName = "[ckey(src.name)]_flattened.dmi" - // Copy the file to the rsc manually - var/icon/I = fcopy_rsc(getFlatIcon(src)) - // Send the icon to src's local cache - src< 5) return //Lets not let them search too greedily. for(var/datum/data/record/R in data_core.general) diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index 3cfd09b88d..bc69c11a00 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -39,7 +39,7 @@ codes = new() - var/list/entries = dd_text2list(codes_txt, ";") // entries are separated by semicolons + var/list/entries = text2list(codes_txt, ";") // entries are separated by semicolons for(var/e in entries) var/index = findtext(e, "=") // format is "key=value" diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 5d35b349b8..ed54a07731 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -13,13 +13,13 @@ /obj/machinery/vending/New() ..() spawn(4) - src.slogan_list = dd_text2list(src.product_slogans, ";") - var/list/temp_paths = dd_text2list(src.product_paths, ";") - var/list/temp_amounts = dd_text2list(src.product_amounts, ";") - var/list/temp_hidden = dd_text2list(src.product_hidden, ";") - var/list/temp_hideamt = dd_text2list(src.product_hideamt, ";") - var/list/temp_coin = dd_text2list(src.product_coin, ";") - var/list/temp_coin_amt = dd_text2list(src.product_coin_amt, ";") + src.slogan_list = text2list(src.product_slogans, ";") + var/list/temp_paths = text2list(src.product_paths, ";") + var/list/temp_amounts = text2list(src.product_amounts, ";") + var/list/temp_hidden = text2list(src.product_hidden, ";") + var/list/temp_hideamt = text2list(src.product_hideamt, ";") + var/list/temp_coin = text2list(src.product_coin, ";") + var/list/temp_coin_amt = text2list(src.product_coin_amt, ";") //Little sanity check here if ((isnull(temp_paths)) || (isnull(temp_amounts)) || (temp_paths.len != temp_amounts.len) || (temp_hidden.len != temp_hideamt.len)) stat |= BROKEN diff --git a/code/game/objects/items/devices/uplinks.dm b/code/game/objects/items/devices/uplinks.dm index 482b1d2df7..96a40901fa 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -21,7 +21,7 @@ A list of items and costs is stored under the datum of every game mode, alongsid items = dd_replacetext(ticker.mode.uplink_items, "\n", "") // Getting the text string of items else items = dd_replacetext(item_data) - ItemList = dd_text2list(src.items, ";") // Parsing the items text string + ItemList = text2list(src.items, ";") // Parsing the items text string uses = ticker.mode.uplink_uses //Let's build a menu! diff --git a/code/game/objects/items/devices/violin.dm b/code/game/objects/items/devices/violin.dm index 770cac6cc3..abc12f67ff 100644 --- a/code/game/objects/items/devices/violin.dm +++ b/code/game/objects/items/devices/violin.dm @@ -202,10 +202,10 @@ for(var/line in song.lines) //world << line - for(var/beat in dd_text2list(lowertext(line), ",")) + for(var/beat in text2list(lowertext(line), ",")) //world << "beat: [beat]" - var/list/notes = dd_text2list(beat, "/") - for(var/note in dd_text2list(notes[1], "-")) + var/list/notes = text2list(beat, "/") + for(var/note in text2list(notes[1], "-")) //world << "note: [note]" if(!playing || !isliving(loc))//If the violin is playing, or isn't held by a person playing = 0 @@ -367,7 +367,7 @@ //split into lines spawn() - var/list/lines = dd_text2list(t, "\n") + var/list/lines = text2list(t, "\n") var/tempo = 5 if(copytext(lines[1],1,6) == "BPM: ") tempo = 600 / text2num(copytext(lines[1],6)) diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm index 67c799dbcc..7e1ae50270 100644 --- a/code/game/objects/structures/musician.dm +++ b/code/game/objects/structures/musician.dm @@ -250,12 +250,12 @@ updateUsrDialog() proc/unbayify( var/text ) - var/list/partlist = dd_text2list(text, ",") + var/list/partlist = text2list(text, ",") var/i for(i=1, i<=partlist.len, i++) var/part = partlist[i] - var/list/x = dd_text2list(part, "/") + var/list/x = text2list(part, "/") var/tone = "" var/tempo = "1" @@ -334,10 +334,10 @@ strippedsourcestring = unbayify(strippedsourcestring) - for(var/part in dd_text2list(strippedsourcestring, ",")) - var/list/x = dd_text2list(part, "/") + for(var/part in text2list(strippedsourcestring, ",")) + var/list/x = text2list(part, "/") var/xlen = x.len - var/list/tones = dd_text2list(x[1], "-") + var/list/tones = text2list(x[1], "-") var/tempodiv = 1 if(xlen==2) @@ -603,7 +603,7 @@ else if(href_list["export"]) var/output = dd_replacetext(currentsong.sourcestring, "\n", "") - var/list/sourcelist = dd_text2list(output, ",") + var/list/sourcelist = text2list(output, ",") var/list/outputlist = new() @@ -684,7 +684,7 @@ var/input = html_encode(input(usr, "", "Import") as message|null) if(isnull(input)) return - var/list/inputlist = dd_text2list(input, "\n") + var/list/inputlist = text2list(input, "\n") if(copytext(inputlist[1], 1, 4) == "BPM") var/newbpm = text2num(copytext(input,5,lentext(inputlist[1])+1)) diff --git a/code/modules/admin/ToRban.dm b/code/modules/admin/ToRban.dm index 5f6dcbe460..ea70d02375 100644 --- a/code/modules/admin/ToRban.dm +++ b/code/modules/admin/ToRban.dm @@ -25,22 +25,20 @@ diary << "Downloading updated ToR data..." var/http[] = world.Export("http://exitlist.torproject.org/exit-addresses") - var/rawtext = file2text(http["CONTENT"]) - if(rawtext) - var/list/rawlist = tg_text2list(rawtext,"\n") - if(rawlist.len) - fdel(TORFILE) - var/savefile/F = new(TORFILE) - for( var/line in rawlist ) - if(!line) continue - if( copytext(line,1,12) == "ExitAddress" ) - var/cleaned = copytext(line,13,length(line)-19) - if(!cleaned) continue - F[cleaned] << 1 - F["last_update"] << world.realtime - diary << "ToR data updated!" - if(usr) usr << "ToRban updated." - return 1 + var/list/rawlist = file2list(http["CONTENT"]) + if(rawlist.len) + fdel(TORFILE) + var/savefile/F = new(TORFILE) + for( var/line in rawlist ) + if(!line) continue + if( copytext(line,1,12) == "ExitAddress" ) + var/cleaned = copytext(line,13,length(line)-19) + if(!cleaned) continue + F[cleaned] << 1 + F["last_update"] << world.realtime + diary << "ToR data updated!" + if(usr) usr << "ToRban updated." + return 1 diary << "ToR data update aborted: no data." return 0 diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 6ab7a1021c..5729a6c111 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -722,7 +722,7 @@ var/list/admin_datums = list() message_admins("\blue [key_name_admin(usr)] removed [t]", 1) jobban_remove(t) href_list["ban"] = 1 // lets it fall through and refresh - var/t_split = dd_text2list(t, " - ") + var/t_split = text2list(t, " - ") var/key = t_split[1] var/job = t_split[2] DB_ban_unban(ckey(key), BANTYPE_JOB_PERMA, job) @@ -1658,7 +1658,7 @@ var/list/admin_datums = list() else if (length(removed_paths)) alert("Removed:\n" + dd_list2text(removed_paths, "\n")) - var/list/offset = dd_text2list(href_list["offset"],",") + var/list/offset = text2list(href_list["offset"],",") var/number = dd_range(1, 100, text2num(href_list["object_count"])) var/X = offset.len > 0 ? text2num(offset[1]) : 0 var/Y = offset.len > 1 ? text2num(offset[2]) : 0 diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 235a41ae6e..ddf50d1b7e 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -29,7 +29,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali msg = dd_replacetext(msg, "HOLDERREF", "HOLDER-REF") //HOLDERREF is a key word which gets replaced with the admin's holder ref later on, so it mustn't be in the original message msg = dd_replacetext(msg, "ADMINREF", "ADMIN-REF") //ADMINREF is a key word which gets replaced with the admin's client's ref. So it mustn't be in the original message. - var/list/msglist = dd_text2list(msg, " ") + var/list/msglist = text2list(msg, " ") var/list/mob/mobs = list() @@ -64,7 +64,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an", "monkey", "ali ai_found = 1 continue for(var/mob/M in mobs) - var/list/namelist = dd_text2list("[M.name] [M.real_name] [(M.mind)?"[M.mind.name]":""] [M.ckey] [M.key]", " ") + var/list/namelist = text2list("[M.name] [M.real_name] [(M.mind)?"[M.mind.name]":""] [M.ckey] [M.key]", " ") var/word_is_match = 0 //Used to break from this mob for loop if a match is found for(var/namepart in namelist) if( lowertext(word) == lowertext(namepart) ) diff --git a/code/modules/awaymissions/zlevel.dm b/code/modules/awaymissions/zlevel.dm index f5ef80b484..e89d67cf77 100644 --- a/code/modules/awaymissions/zlevel.dm +++ b/code/modules/awaymissions/zlevel.dm @@ -3,17 +3,10 @@ proc/createRandomZlevel() return var/list/potentialRandomZlevels = list() - - var/text = file2text("maps/RandomZLevels/fileList.txt") - - if (!text) // No random Z-levels for you. - return - world << "\red \b Searching for away missions..." - - var/list/CL = dd_text2list(text, "\n") - - for (var/t in CL) + var/list/Lines = file2list("maps/RandomZLevels/fileList.txt") + if(!Lines.len) return + for (var/t in Lines) if (!t) continue diff --git a/code/modules/flufftext/TextFilters.dm b/code/modules/flufftext/TextFilters.dm index 3db3bfd52d..1447ac7662 100644 --- a/code/modules/flufftext/TextFilters.dm +++ b/code/modules/flufftext/TextFilters.dm @@ -26,7 +26,7 @@ proc/Intoxicated(phrase) proc/NewStutter(phrase,stunned) phrase = html_decode(phrase) - var/list/split_phrase = dd_text2list(phrase," ") //Split it up into words. + var/list/split_phrase = text2list(phrase," ") //Split it up into words. var/list/unstuttered_words = split_phrase.Copy() var/i = rand(1,3) @@ -67,7 +67,7 @@ proc/Ellipsis(original_msg, chance = 50) if(chance >= 100) return original_msg var/list - words = dd_text2list(original_msg," ") + words = text2list(original_msg," ") new_words = list() var/new_msg = "" diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm index f22015cfbd..9eee2bdd82 100644 --- a/code/modules/mob/living/carbon/human/say.dm +++ b/code/modules/mob/living/carbon/human/say.dm @@ -36,7 +36,7 @@ if(stat != DEAD) for(var/datum/disease/pierrot_throat/D in viruses) - var/list/temp_message = dd_text2list(message, " ") //List each word in the message + var/list/temp_message = text2list(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 @@ -74,7 +74,7 @@ //Would make it more global but it's sort of ninja specific. if(istype(src.wear_mask, /obj/item/clothing/mask/gas/voice/space_ninja)&&src.wear_mask:voice=="Unknown") if(copytext(message, 1, 2) != "*") - var/list/temp_message = dd_text2list(message, " ") + var/list/temp_message = text2list(message, " ") var/list/pick_list = list() for(var/i = 1, i <= temp_message.len, i++) pick_list += i diff --git a/code/modules/mob/living/carbon/human/whisper.dm b/code/modules/mob/living/carbon/human/whisper.dm index 6f202b50df..cda190d55d 100644 --- a/code/modules/mob/living/carbon/human/whisper.dm +++ b/code/modules/mob/living/carbon/human/whisper.dm @@ -38,7 +38,7 @@ if(istype(src.wear_mask, /obj/item/clothing/mask/gas/voice/space_ninja)&&src.wear_mask:voice=="Unknown") if(copytext(message, 1, 2) != "*") - var/list/temp_message = dd_text2list(message, " ") + var/list/temp_message = text2list(message, " ") var/list/pick_list = list() for(var/i = 1, i <= temp_message.len, i++) pick_list += i diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 697a878277..c3dd9749de 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -833,14 +833,4 @@ note dizziness decrements automatically in the mob's Life() proc. /mob/proc/AdjustResting(amount) resting = max(resting + amount,0) - return - -/* - * Sends resource files to client cache - */ -/mob/proc/getFiles() - if(!isemptylist(args)) - for(var/file in args) - src << browse_rsc(file) - return 1 - return 0 \ No newline at end of file + return \ No newline at end of file diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index 54807706a9..1b39aed9c5 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -39,12 +39,12 @@ var/list/temp_list if(!id_with_upload.len) temp_list = list() - temp_list = dd_text2list(id_with_upload_string, ";") + temp_list = text2list(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 = dd_text2list(id_with_download_string, ";") + temp_list = text2list(id_with_download_string, ";") for(var/N in temp_list) id_with_download += text2num(N) diff --git a/code/modules/scripting/Implementations/_Logic.dm b/code/modules/scripting/Implementations/_Logic.dm index bb87dc9af3..fe3174fb36 100644 --- a/code/modules/scripting/Implementations/_Logic.dm +++ b/code/modules/scripting/Implementations/_Logic.dm @@ -167,7 +167,7 @@ Just found out there was already a string explode function, did some benchmarkin */ proc/string_explode(var/string, var/separator) if(istext(string) && istext(separator)) - return dd_text2list(string, separator) + return text2list(string, separator) proc/n_repeat(var/string, var/amount) if(istext(string) && isnum(amount)) diff --git a/code/names.dm b/code/names.dm index 885669c4cc..ab101d76c6 100644 --- a/code/names.dm +++ b/code/names.dm @@ -1,15 +1,16 @@ -var/list/ai_names = dd_file2list("config/names/ai.txt") -var/list/wizard_first = dd_file2list("config/names/wizardfirst.txt") -var/list/wizard_second = dd_file2list("config/names/wizardsecond.txt") -var/list/ninja_titles = dd_file2list("config/names/ninjatitle.txt") -var/list/ninja_names = dd_file2list("config/names/ninjaname.txt") -var/list/commando_names = dd_file2list("config/names/death_commando.txt") -var/list/first_names_male = dd_file2list("config/names/first_male.txt") -var/list/first_names_female = dd_file2list("config/names/first_female.txt") -var/list/last_names = dd_file2list("config/names/last.txt") -var/list/clown_names = dd_file2list("config/names/clown.txt") +var/list/ai_names = file2list("config/names/ai.txt") +var/list/wizard_first = file2list("config/names/wizardfirst.txt") +var/list/wizard_second = file2list("config/names/wizardsecond.txt") +var/list/ninja_titles = file2list("config/names/ninjatitle.txt") +var/list/ninja_names = file2list("config/names/ninjaname.txt") +var/list/commando_names = file2list("config/names/death_commando.txt") +var/list/first_names_male = file2list("config/names/first_male.txt") +var/list/first_names_female = file2list("config/names/first_female.txt") +var/list/last_names = file2list("config/names/last.txt") +var/list/clown_names = file2list("config/names/clown.txt") -var/list/verbs = dd_file2list("config/names/verbs.txt") -var/list/adjectives = dd_file2list("config/names/adjectives.txt") + +var/list/verbs = file2list("config/names/verbs.txt") +var/list/adjectives = file2list("config/names/adjectives.txt") //loaded on startup because of " //would include in rsc if ' was used \ No newline at end of file diff --git a/code/world.dm b/code/world.dm index 7ef8e8e55c..f22e808f64 100644 --- a/code/world.dm +++ b/code/world.dm @@ -174,11 +174,10 @@ Starting up. [time2text(world.timeofday, "hh:mm.ss")] /world/proc/load_mode() - var/text = file2text("data/mode.txt") - if (text) - var/list/lines = dd_text2list(text, "\n") - if (lines[1]) - master_mode = lines[1] + var/list/Lines = file2list("data/mode.txt") + if(Lines.len) + if(Lines[1]) + master_mode = Lines[1] diary << "Saved mode is '[master_mode]'" /world/proc/save_mode(var/the_mode) @@ -191,25 +190,20 @@ Starting up. [time2text(world.timeofday, "hh:mm.ss")] /world/proc/load_admins() if(config.admin_legacy_system) - //Legacy admin system uses admins.txt - var/text = file2text("config/admins.txt") - if (!text) - diary << "Failed to load config/admins.txt\n" - else - var/list/lines = dd_text2list(text, "\n") - for(var/line in lines) - if (!line) - continue + //Legacy admin system uses admins.txt - It's not fucking legacy Erro. It's standard. I can assure you more people will be using 'legacy' than sql. SQL is lame. ~carnie + var/list/Lines = file2list("config/admins.txt") + for(var/line in Lines) + if(!line) continue - if (copytext(line, 1, 2) == ";") - continue + if(copytext(line, 1, 2) == ";") + continue - var/pos = findtext(line, " - ", 1, null) - if (pos) - var/m_key = copytext(line, 1, pos) - var/a_lev = copytext(line, pos + 3, length(line) + 1) - admins[m_key] = new /datum/admins(a_lev) - diary << ("ADMIN: [m_key] = [a_lev]") + var/pos = findtext(line, " - ", 1, null) + if(pos) + var/m_key = copytext(line, 1, pos) + var/a_lev = copytext(line, pos + 3, length(line) + 1) + admins[m_key] = new /datum/admins(a_lev) + diary << ("ADMIN: [m_key] = [a_lev]") else //The current admin system uses SQL var/user = sqlfdbklogin diff --git a/tgstation.dme b/tgstation.dme index 79eb867eba..f01d39367b 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6,267 +6,8 @@ // BEGIN_FILE_DIR #define FILE_DIR . -#define FILE_DIR ".svn" -#define FILE_DIR ".svn/pristine" -#define FILE_DIR ".svn/pristine/00" -#define FILE_DIR ".svn/pristine/01" -#define FILE_DIR ".svn/pristine/02" -#define FILE_DIR ".svn/pristine/03" -#define FILE_DIR ".svn/pristine/04" -#define FILE_DIR ".svn/pristine/05" -#define FILE_DIR ".svn/pristine/06" -#define FILE_DIR ".svn/pristine/07" -#define FILE_DIR ".svn/pristine/08" -#define FILE_DIR ".svn/pristine/09" -#define FILE_DIR ".svn/pristine/0a" -#define FILE_DIR ".svn/pristine/0b" -#define FILE_DIR ".svn/pristine/0c" -#define FILE_DIR ".svn/pristine/0d" -#define FILE_DIR ".svn/pristine/0e" -#define FILE_DIR ".svn/pristine/0f" -#define FILE_DIR ".svn/pristine/10" -#define FILE_DIR ".svn/pristine/11" -#define FILE_DIR ".svn/pristine/12" -#define FILE_DIR ".svn/pristine/13" -#define FILE_DIR ".svn/pristine/14" -#define FILE_DIR ".svn/pristine/15" -#define FILE_DIR ".svn/pristine/16" -#define FILE_DIR ".svn/pristine/17" -#define FILE_DIR ".svn/pristine/18" -#define FILE_DIR ".svn/pristine/19" -#define FILE_DIR ".svn/pristine/1a" -#define FILE_DIR ".svn/pristine/1b" -#define FILE_DIR ".svn/pristine/1c" -#define FILE_DIR ".svn/pristine/1d" -#define FILE_DIR ".svn/pristine/1e" -#define FILE_DIR ".svn/pristine/1f" -#define FILE_DIR ".svn/pristine/20" -#define FILE_DIR ".svn/pristine/21" -#define FILE_DIR ".svn/pristine/22" -#define FILE_DIR ".svn/pristine/23" -#define FILE_DIR ".svn/pristine/24" -#define FILE_DIR ".svn/pristine/25" -#define FILE_DIR ".svn/pristine/26" -#define FILE_DIR ".svn/pristine/27" -#define FILE_DIR ".svn/pristine/28" -#define FILE_DIR ".svn/pristine/29" -#define FILE_DIR ".svn/pristine/2a" -#define FILE_DIR ".svn/pristine/2b" -#define FILE_DIR ".svn/pristine/2c" -#define FILE_DIR ".svn/pristine/2d" -#define FILE_DIR ".svn/pristine/2e" -#define FILE_DIR ".svn/pristine/2f" -#define FILE_DIR ".svn/pristine/30" -#define FILE_DIR ".svn/pristine/31" -#define FILE_DIR ".svn/pristine/32" -#define FILE_DIR ".svn/pristine/33" -#define FILE_DIR ".svn/pristine/34" -#define FILE_DIR ".svn/pristine/35" -#define FILE_DIR ".svn/pristine/36" -#define FILE_DIR ".svn/pristine/37" -#define FILE_DIR ".svn/pristine/38" -#define FILE_DIR ".svn/pristine/39" -#define FILE_DIR ".svn/pristine/3a" -#define FILE_DIR ".svn/pristine/3b" -#define FILE_DIR ".svn/pristine/3c" -#define FILE_DIR ".svn/pristine/3d" -#define FILE_DIR ".svn/pristine/3e" -#define FILE_DIR ".svn/pristine/3f" -#define FILE_DIR ".svn/pristine/40" -#define FILE_DIR ".svn/pristine/41" -#define FILE_DIR ".svn/pristine/42" -#define FILE_DIR ".svn/pristine/43" -#define FILE_DIR ".svn/pristine/44" -#define FILE_DIR ".svn/pristine/45" -#define FILE_DIR ".svn/pristine/46" -#define FILE_DIR ".svn/pristine/47" -#define FILE_DIR ".svn/pristine/48" -#define FILE_DIR ".svn/pristine/49" -#define FILE_DIR ".svn/pristine/4a" -#define FILE_DIR ".svn/pristine/4b" -#define FILE_DIR ".svn/pristine/4c" -#define FILE_DIR ".svn/pristine/4d" -#define FILE_DIR ".svn/pristine/4e" -#define FILE_DIR ".svn/pristine/4f" -#define FILE_DIR ".svn/pristine/50" -#define FILE_DIR ".svn/pristine/51" -#define FILE_DIR ".svn/pristine/52" -#define FILE_DIR ".svn/pristine/53" -#define FILE_DIR ".svn/pristine/54" -#define FILE_DIR ".svn/pristine/55" -#define FILE_DIR ".svn/pristine/56" -#define FILE_DIR ".svn/pristine/57" -#define FILE_DIR ".svn/pristine/58" -#define FILE_DIR ".svn/pristine/59" -#define FILE_DIR ".svn/pristine/5a" -#define FILE_DIR ".svn/pristine/5b" -#define FILE_DIR ".svn/pristine/5c" -#define FILE_DIR ".svn/pristine/5d" -#define FILE_DIR ".svn/pristine/5e" -#define FILE_DIR ".svn/pristine/5f" -#define FILE_DIR ".svn/pristine/60" -#define FILE_DIR ".svn/pristine/61" -#define FILE_DIR ".svn/pristine/62" -#define FILE_DIR ".svn/pristine/63" -#define FILE_DIR ".svn/pristine/64" -#define FILE_DIR ".svn/pristine/65" -#define FILE_DIR ".svn/pristine/66" -#define FILE_DIR ".svn/pristine/67" -#define FILE_DIR ".svn/pristine/68" -#define FILE_DIR ".svn/pristine/69" -#define FILE_DIR ".svn/pristine/6a" -#define FILE_DIR ".svn/pristine/6b" -#define FILE_DIR ".svn/pristine/6c" -#define FILE_DIR ".svn/pristine/6d" -#define FILE_DIR ".svn/pristine/6e" -#define FILE_DIR ".svn/pristine/6f" -#define FILE_DIR ".svn/pristine/70" -#define FILE_DIR ".svn/pristine/71" -#define FILE_DIR ".svn/pristine/72" -#define FILE_DIR ".svn/pristine/73" -#define FILE_DIR ".svn/pristine/74" -#define FILE_DIR ".svn/pristine/75" -#define FILE_DIR ".svn/pristine/76" -#define FILE_DIR ".svn/pristine/77" -#define FILE_DIR ".svn/pristine/78" -#define FILE_DIR ".svn/pristine/79" -#define FILE_DIR ".svn/pristine/7a" -#define FILE_DIR ".svn/pristine/7b" -#define FILE_DIR ".svn/pristine/7c" -#define FILE_DIR ".svn/pristine/7d" -#define FILE_DIR ".svn/pristine/7e" -#define FILE_DIR ".svn/pristine/7f" -#define FILE_DIR ".svn/pristine/80" -#define FILE_DIR ".svn/pristine/81" -#define FILE_DIR ".svn/pristine/82" -#define FILE_DIR ".svn/pristine/83" -#define FILE_DIR ".svn/pristine/84" -#define FILE_DIR ".svn/pristine/85" -#define FILE_DIR ".svn/pristine/86" -#define FILE_DIR ".svn/pristine/87" -#define FILE_DIR ".svn/pristine/88" -#define FILE_DIR ".svn/pristine/89" -#define FILE_DIR ".svn/pristine/8a" -#define FILE_DIR ".svn/pristine/8b" -#define FILE_DIR ".svn/pristine/8c" -#define FILE_DIR ".svn/pristine/8d" -#define FILE_DIR ".svn/pristine/8e" -#define FILE_DIR ".svn/pristine/8f" -#define FILE_DIR ".svn/pristine/90" -#define FILE_DIR ".svn/pristine/91" -#define FILE_DIR ".svn/pristine/92" -#define FILE_DIR ".svn/pristine/93" -#define FILE_DIR ".svn/pristine/94" -#define FILE_DIR ".svn/pristine/95" -#define FILE_DIR ".svn/pristine/96" -#define FILE_DIR ".svn/pristine/97" -#define FILE_DIR ".svn/pristine/98" -#define FILE_DIR ".svn/pristine/99" -#define FILE_DIR ".svn/pristine/9a" -#define FILE_DIR ".svn/pristine/9b" -#define FILE_DIR ".svn/pristine/9c" -#define FILE_DIR ".svn/pristine/9d" -#define FILE_DIR ".svn/pristine/9e" -#define FILE_DIR ".svn/pristine/9f" -#define FILE_DIR ".svn/pristine/a0" -#define FILE_DIR ".svn/pristine/a1" -#define FILE_DIR ".svn/pristine/a2" -#define FILE_DIR ".svn/pristine/a3" -#define FILE_DIR ".svn/pristine/a4" -#define FILE_DIR ".svn/pristine/a5" -#define FILE_DIR ".svn/pristine/a6" -#define FILE_DIR ".svn/pristine/a7" -#define FILE_DIR ".svn/pristine/a8" -#define FILE_DIR ".svn/pristine/a9" -#define FILE_DIR ".svn/pristine/aa" -#define FILE_DIR ".svn/pristine/ab" -#define FILE_DIR ".svn/pristine/ac" -#define FILE_DIR ".svn/pristine/ad" -#define FILE_DIR ".svn/pristine/ae" -#define FILE_DIR ".svn/pristine/af" -#define FILE_DIR ".svn/pristine/b0" -#define FILE_DIR ".svn/pristine/b1" -#define FILE_DIR ".svn/pristine/b2" -#define FILE_DIR ".svn/pristine/b3" -#define FILE_DIR ".svn/pristine/b4" -#define FILE_DIR ".svn/pristine/b5" -#define FILE_DIR ".svn/pristine/b6" -#define FILE_DIR ".svn/pristine/b7" -#define FILE_DIR ".svn/pristine/b8" -#define FILE_DIR ".svn/pristine/b9" -#define FILE_DIR ".svn/pristine/ba" -#define FILE_DIR ".svn/pristine/bb" -#define FILE_DIR ".svn/pristine/bc" -#define FILE_DIR ".svn/pristine/bd" -#define FILE_DIR ".svn/pristine/be" -#define FILE_DIR ".svn/pristine/bf" -#define FILE_DIR ".svn/pristine/c0" -#define FILE_DIR ".svn/pristine/c1" -#define FILE_DIR ".svn/pristine/c2" -#define FILE_DIR ".svn/pristine/c3" -#define FILE_DIR ".svn/pristine/c4" -#define FILE_DIR ".svn/pristine/c5" -#define FILE_DIR ".svn/pristine/c6" -#define FILE_DIR ".svn/pristine/c7" -#define FILE_DIR ".svn/pristine/c8" -#define FILE_DIR ".svn/pristine/c9" -#define FILE_DIR ".svn/pristine/ca" -#define FILE_DIR ".svn/pristine/cb" -#define FILE_DIR ".svn/pristine/cc" -#define FILE_DIR ".svn/pristine/cd" -#define FILE_DIR ".svn/pristine/ce" -#define FILE_DIR ".svn/pristine/cf" -#define FILE_DIR ".svn/pristine/d0" -#define FILE_DIR ".svn/pristine/d1" -#define FILE_DIR ".svn/pristine/d2" -#define FILE_DIR ".svn/pristine/d3" -#define FILE_DIR ".svn/pristine/d4" -#define FILE_DIR ".svn/pristine/d5" -#define FILE_DIR ".svn/pristine/d6" -#define FILE_DIR ".svn/pristine/d7" -#define FILE_DIR ".svn/pristine/d8" -#define FILE_DIR ".svn/pristine/d9" -#define FILE_DIR ".svn/pristine/da" -#define FILE_DIR ".svn/pristine/db" -#define FILE_DIR ".svn/pristine/dc" -#define FILE_DIR ".svn/pristine/dd" -#define FILE_DIR ".svn/pristine/de" -#define FILE_DIR ".svn/pristine/df" -#define FILE_DIR ".svn/pristine/e0" -#define FILE_DIR ".svn/pristine/e1" -#define FILE_DIR ".svn/pristine/e2" -#define FILE_DIR ".svn/pristine/e3" -#define FILE_DIR ".svn/pristine/e4" -#define FILE_DIR ".svn/pristine/e5" -#define FILE_DIR ".svn/pristine/e6" -#define FILE_DIR ".svn/pristine/e7" -#define FILE_DIR ".svn/pristine/e8" -#define FILE_DIR ".svn/pristine/e9" -#define FILE_DIR ".svn/pristine/ea" -#define FILE_DIR ".svn/pristine/eb" -#define FILE_DIR ".svn/pristine/ec" -#define FILE_DIR ".svn/pristine/ed" -#define FILE_DIR ".svn/pristine/ee" -#define FILE_DIR ".svn/pristine/ef" -#define FILE_DIR ".svn/pristine/f0" -#define FILE_DIR ".svn/pristine/f1" -#define FILE_DIR ".svn/pristine/f2" -#define FILE_DIR ".svn/pristine/f3" -#define FILE_DIR ".svn/pristine/f4" -#define FILE_DIR ".svn/pristine/f5" -#define FILE_DIR ".svn/pristine/f6" -#define FILE_DIR ".svn/pristine/f7" -#define FILE_DIR ".svn/pristine/f8" -#define FILE_DIR ".svn/pristine/f9" -#define FILE_DIR ".svn/pristine/fa" -#define FILE_DIR ".svn/pristine/fb" -#define FILE_DIR ".svn/pristine/fc" -#define FILE_DIR ".svn/pristine/fd" -#define FILE_DIR ".svn/pristine/fe" -#define FILE_DIR ".svn/pristine/ff" -#define FILE_DIR "bot" -#define FILE_DIR "bot/Marakov" #define FILE_DIR "code" +#define FILE_DIR "code/__HELPERS" #define FILE_DIR "code/ATMOSPHERICS" #define FILE_DIR "code/ATMOSPHERICS/components" #define FILE_DIR "code/ATMOSPHERICS/components/binary_devices" @@ -447,15 +188,6 @@ #define FILE_DIR "code/WorkInProgress/mapload" #define FILE_DIR "code/WorkInProgress/organs" #define FILE_DIR "code/WorkInProgress/virus2" -#define FILE_DIR "config" -#define FILE_DIR "config/names" -#define FILE_DIR "data" -#define FILE_DIR "data/logs" -#define FILE_DIR "data/logs/2012" -#define FILE_DIR "data/logs/2012/10-October" -#define FILE_DIR "data/player_saves" -#define FILE_DIR "data/player_saves/g" -#define FILE_DIR "data/player_saves/g/giacomand" #define FILE_DIR "html" #define FILE_DIR "icons" #define FILE_DIR "icons/effects" @@ -470,7 +202,6 @@ #define FILE_DIR "icons/obj/machines" #define FILE_DIR "icons/obj/pipes" #define FILE_DIR "icons/pda_icons" -#define FILE_DIR "icons/PSD files" #define FILE_DIR "icons/spideros_icons" #define FILE_DIR "icons/Testing" #define FILE_DIR "icons/turf" @@ -479,7 +210,6 @@ #define FILE_DIR "interface" #define FILE_DIR "maps" #define FILE_DIR "maps/RandomZLevels" -#define FILE_DIR "music" #define FILE_DIR "sound" #define FILE_DIR "sound/AI" #define FILE_DIR "sound/ambience" @@ -493,18 +223,8 @@ #define FILE_DIR "sound/violin" #define FILE_DIR "sound/voice" #define FILE_DIR "sound/weapons" -#define FILE_DIR "SQL" #define FILE_DIR "tools" #define FILE_DIR "tools/Redirector" -#define FILE_DIR "tools/Runtime Condenser" -#define FILE_DIR "tools/UnstandardnessTestForDM" -#define FILE_DIR "tools/UnstandardnessTestForDM/UnstandardnessTestForDM" -#define FILE_DIR "tools/UnstandardnessTestForDM/UnstandardnessTestForDM/bin" -#define FILE_DIR "tools/UnstandardnessTestForDM/UnstandardnessTestForDM/bin/Debug" -#define FILE_DIR "tools/UnstandardnessTestForDM/UnstandardnessTestForDM/obj" -#define FILE_DIR "tools/UnstandardnessTestForDM/UnstandardnessTestForDM/obj/x86" -#define FILE_DIR "tools/UnstandardnessTestForDM/UnstandardnessTestForDM/obj/x86/Debug" -#define FILE_DIR "tools/UnstandardnessTestForDM/UnstandardnessTestForDM/Properties" // END_FILE_DIR // BEGIN_PREFERENCES @@ -517,6 +237,17 @@ #include "code\setup.dm" #include "code\stylesheet.dm" #include "code\world.dm" +#include "code\__HELPERS\files.dm" +#include "code\__HELPERS\game.dm" +#include "code\__HELPERS\global_lists.dm" +#include "code\__HELPERS\icons.dm" +#include "code\__HELPERS\lists.dm" +#include "code\__HELPERS\logging.dm" +#include "code\__HELPERS\names.dm" +#include "code\__HELPERS\text.dm" +#include "code\__HELPERS\time.dm" +#include "code\__HELPERS\type2type.dm" +#include "code\__HELPERS\unsorted.dm" #include "code\ATMOSPHERICS\atmospherics.dm" #include "code\ATMOSPHERICS\datum_pipe_network.dm" #include "code\ATMOSPHERICS\datum_pipeline.dm" @@ -614,25 +345,10 @@ #include "code\defines\obj\weapon.dm" #include "code\defines\procs\AStar.dm" #include "code\defines\procs\captain_announce.dm" -#include "code\defines\procs\church_name.dm" #include "code\defines\procs\command_alert.dm" -#include "code\defines\procs\command_name.dm" #include "code\defines\procs\dbcore.dm" #include "code\defines\procs\forum_activation.dm" -#include "code\defines\procs\gamehelpers.dm" -#include "code\defines\procs\global_lists.dm" -#include "code\defines\procs\helper_list.dm" -#include "code\defines\procs\helper_text.dm" -#include "code\defines\procs\helper_type2type.dm" -#include "code\defines\procs\helpers.dm" -#include "code\defines\procs\icon_procs.dm" -#include "code\defines\procs\icon_procs_readme.dm" -#include "code\defines\procs\logging.dm" -#include "code\defines\procs\religion_name.dm" -#include "code\defines\procs\station_name.dm" #include "code\defines\procs\statistics.dm" -#include "code\defines\procs\syndicate_name.dm" -#include "code\defines\procs\time_stamp.dm" #include "code\FEA\FEA_airgroup.dm" #include "code\FEA\FEA_fire.dm" #include "code\FEA\FEA_gas_mixture.dm"