mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-07 07:52:00 +00:00
Merge branch 'dev' of https://github.com/Baystation12/Baystation12 into dev-freeze
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "code\setup.dm"
|
||||
#include "code\stylesheet.dm"
|
||||
#include "code\world.dm"
|
||||
#include "code\__HELPERS\bygex.dm"
|
||||
#include "code\__HELPERS\files.dm"
|
||||
#include "code\__HELPERS\game.dm"
|
||||
#include "code\__HELPERS\global_lists.dm"
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
// BEGIN_INTERNALS
|
||||
/*
|
||||
MAP_ICON_TYPE: 0
|
||||
WINDOW: code\modules\research\designs.dm;code\game\objects\items\devices\PDA\PDA.dm;code\game\objects\items\weapons\implants\implantfreedom.dm;code\modules\clothing\under\chameleon.dm;code\modules\mining\abandonedcrates.dm;code\modules\mining\mine_turfs.dm
|
||||
LAST_COMPILE_VERSION: 501.1217
|
||||
DIR: code code\ATMOSPHERICS code\game code\game\objects code\game\objects\closets code\game\objects\items code\game\objects\items\devices code\game\objects\items\devices\PDA code\game\objects\items\devices\radio code\game\objects\items\weapons code\game\objects\items\weapons\implants code\modules code\modules\clothing code\modules\clothing\spacesuits code\modules\clothing\under code\modules\mining code\modules\reagents code\modules\reagents\reagent_containers code\modules\research
|
||||
FILE: code\modules\mining\abandonedcrates.dm
|
||||
LAST_COMPILE_TIME: 1384930775
|
||||
AUTO_FILE_DIR: OFF
|
||||
*/
|
||||
// END_INTERNALS
|
||||
|
||||
107
code/__HELPERS/bygex.dm
Normal file
107
code/__HELPERS/bygex.dm
Normal file
@@ -0,0 +1,107 @@
|
||||
#ifndef LIBREGEX_LIBRARY
|
||||
#define LIBREGEX_LIBRARY "bygex"
|
||||
#endif
|
||||
|
||||
proc
|
||||
regEx_compare(str, exp)
|
||||
return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_compare")(str, exp))
|
||||
|
||||
regex_compare(str, exp)
|
||||
return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_compare")(str, exp))
|
||||
|
||||
regEx_find(str, exp)
|
||||
return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_find")(str, exp))
|
||||
|
||||
regex_find(str, exp)
|
||||
return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_find")(str, exp))
|
||||
|
||||
regEx_replaceall(str, exp, fmt)
|
||||
return call(LIBREGEX_LIBRARY, "regEx_replaceall")(str, exp, fmt)
|
||||
|
||||
regex_replaceall(str, exp, fmt)
|
||||
return call(LIBREGEX_LIBRARY, "regex_replaceall")(str, exp, fmt)
|
||||
|
||||
replacetextEx(str, exp, fmt)
|
||||
return call(LIBREGEX_LIBRARY, "regEx_replaceallliteral")(str, exp, fmt)
|
||||
|
||||
replacetext(str, exp, fmt)
|
||||
return call(LIBREGEX_LIBRARY, "regex_replaceallliteral")(str, exp, fmt)
|
||||
|
||||
regEx_replace(str, exp, fmt)
|
||||
return call(LIBREGEX_LIBRARY, "regEx_replace")(str, exp, fmt)
|
||||
|
||||
regex_replace(str, exp, fmt)
|
||||
return call(LIBREGEX_LIBRARY, "regex_replace")(str, exp, fmt)
|
||||
|
||||
regEx_findall(str, exp)
|
||||
return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regEx_findall")(str, exp))
|
||||
|
||||
regex_findall(str, exp)
|
||||
return new /datum/regex(str, exp, call(LIBREGEX_LIBRARY, "regex_findall")(str, exp))
|
||||
|
||||
|
||||
//upon calling a regex match or search, a /datum/regex object is created with str(haystack) and exp(needle) variables set
|
||||
//it also contains a list(matches) of /datum/match objects, each of which holds the position and length of the match
|
||||
//matched strings are not returned from the dll, in order to save on memory allocation for large numbers of strings
|
||||
//instead, you can use regex.str(matchnum) to fetch this string as needed.
|
||||
//likewise you can also use regex.pos(matchnum) and regex.len(matchnum) as shorthands
|
||||
/datum/regex
|
||||
var/str
|
||||
var/exp
|
||||
var/error
|
||||
var/anchors = 0
|
||||
var/list/matches = list()
|
||||
|
||||
New(str, exp, results)
|
||||
src.str = str
|
||||
src.exp = exp
|
||||
|
||||
if(findtext(results, "Err", 1, 4)) //error message
|
||||
src.error = results
|
||||
else
|
||||
var/list/L = params2list(results)
|
||||
var/list/M
|
||||
var{i;j}
|
||||
for(i in L)
|
||||
M = L[i]
|
||||
for(j=2, j<=M.len, j+=2)
|
||||
matches += new /datum/match(text2num(M[j-1]),text2num(M[j]))
|
||||
anchors = (j-2)/2
|
||||
return matches
|
||||
|
||||
proc
|
||||
str(i)
|
||||
if(!i) return str
|
||||
var/datum/match/M = matches[i]
|
||||
return copytext(str, M.pos, M.pos+M.len)
|
||||
|
||||
pos(i)
|
||||
if(!i) return 1
|
||||
var/datum/match/M = matches[i]
|
||||
return M.pos
|
||||
|
||||
len(i)
|
||||
if(!i) return length(str)
|
||||
var/datum/match/M = matches[i]
|
||||
return M.len
|
||||
|
||||
end(i)
|
||||
if(!i) return length(str)
|
||||
var/datum/match/M = matches[i]
|
||||
return M.pos + M.len
|
||||
|
||||
report() //debug tool
|
||||
. = ":: RESULTS ::\n:: str :: [html_encode(str)]\n:: exp :: [html_encode(exp)]\n:: anchors :: [anchors]"
|
||||
if(error)
|
||||
. += "\n<font color='red'>[error]</font>"
|
||||
return
|
||||
for(var/i=1, i<=matches.len, ++i)
|
||||
. += "\nMatch[i]\n\t[html_encode(str(i))]\n\tpos=[pos(i)] len=[len(i)]"
|
||||
|
||||
/datum/match
|
||||
var/pos
|
||||
var/len
|
||||
|
||||
New(pos, len)
|
||||
src.pos = pos
|
||||
src.len = len
|
||||
@@ -194,35 +194,7 @@ proc/checkhtml(var/t)
|
||||
/*
|
||||
* Text modification
|
||||
*/
|
||||
/proc/replacetext(text, find, replacement)
|
||||
var/find_len = length(find)
|
||||
if(find_len < 1) return text
|
||||
. = ""
|
||||
var/last_found = 1
|
||||
while(1)
|
||||
var/found = findtext(text, find, last_found, 0)
|
||||
. += copytext(text, last_found, found)
|
||||
if(found)
|
||||
. += replacement
|
||||
last_found = found + find_len
|
||||
continue
|
||||
return .
|
||||
|
||||
/proc/replacetextEx(text, find, replacement)
|
||||
var/find_len = length(find)
|
||||
if(find_len < 1) return text
|
||||
. = ""
|
||||
var/last_found = 1
|
||||
while(1)
|
||||
var/found = findtextEx(text, find, last_found, 0)
|
||||
. += copytext(text, last_found, found)
|
||||
if(found)
|
||||
. += replacement
|
||||
last_found = found + find_len
|
||||
continue
|
||||
return .
|
||||
|
||||
//Adds 'u' number of zeros ahead of the text 't'
|
||||
//Adds 'u' number of zeros ahead of the text 't'
|
||||
/proc/add_zero(t, u)
|
||||
while (length(t) < u)
|
||||
t = "0[t]"
|
||||
|
||||
@@ -933,20 +933,19 @@
|
||||
|
||||
New()
|
||||
..()
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, "bicaridine", 14, "Bicaridine")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, "dermaline", 15, "Dermaline")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, "anti_toxin", 16, "Dylovene")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, "dexalinp", 17, "Dexalin Plus")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, "tricordrazine", 18, "Tricordrazine")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, 14, "Bicaridine")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, 15, "Dermaline")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, 16, "Dylovene")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, 17, "Dexalin Plus")
|
||||
new /obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle(src, 18, "Tricordrazine")
|
||||
new /obj/item/weapon/reagent_containers/syringe/(src)
|
||||
new /obj/item/device/healthanalyzer(src)
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/bottle/fluff/nashi_bottle
|
||||
icon = 'icons/obj/chemical.dmi'
|
||||
flags = FPRINT | TABLEPASS //Starting them with lids on them. Safety first!
|
||||
New(loc, var/stuff, var/color, var/labeled)
|
||||
New(loc, var/color, var/labeled)
|
||||
..()
|
||||
name = "[labeled] bottle"
|
||||
desc = "A small bottle. Contains [labeled]"
|
||||
icon_state = "bottle[color]"
|
||||
reagents.add_reagent(stuff, 30)
|
||||
|
||||
Reference in New Issue
Block a user