April sync (#360)

* Maps and things no code/icons

* helpers defines globalvars

* Onclick world.dm orphaned_procs

* subsystems

Round vote and shuttle autocall done here too

* datums

* Game folder

* Admin - chatter modules

* clothing - mining

* modular computers - zambies

* client

* mob level 1

* mob stage 2 + simple_animal

* silicons n brains

* mob stage 3 + Alien/Monkey

* human mobs

* icons updated

* some sounds

* emitter y u no commit

* update tgstation.dme

* compile fixes

* travis fixes

Also removes Fast digest mode, because reasons.

* tweaks for travis Mentors are broke again

Also fixes Sizeray guns

* oxygen loss fix for vore code.

* removes unused code

* some code updates

* bulk fixes

* further fixes

* outside things

* whoops.

* Maint bar ported

* GLOBs.
This commit is contained in:
Poojawa
2017-04-13 23:37:00 -05:00
committed by GitHub
parent cdc32c98fa
commit 7e9b96a00f
1322 changed files with 174827 additions and 23888 deletions
+5 -2
View File
@@ -65,7 +65,10 @@
if(!L || !L.len || !A)
return 0
return L[A.type]
if(ispath(A))
. = L[A]
else
. = L[A.type]
//Checks for a string in a list
/proc/is_string_in_list(string, list/L)
@@ -278,7 +281,7 @@
//Specifically for record datums in a list.
/proc/sortRecord(list/L, field = "name", order = 1)
cmp_field = field
GLOB.cmp_field = field
return sortTim(L, order >= 0 ? /proc/cmp_records_asc : /proc/cmp_records_dsc)
//any value in a list
+19 -19
View File
@@ -18,15 +18,15 @@
#endif
/proc/log_admin(text)
admin_log.Add(text)
GLOB.admin_log.Add(text)
if (config.log_admin)
diary << "\[[time_stamp()]]ADMIN: [text]"
GLOB.diary << "\[[time_stamp()]]ADMIN: [text]"
//Items using this proc are stripped from public logs - use with caution
/proc/log_admin_private(text)
admin_log.Add(text)
GLOB.admin_log.Add(text)
if (config.log_admin)
diary << "\[[time_stamp()]]ADMINPRIVATE: [text]"
GLOB.diary << "\[[time_stamp()]]ADMINPRIVATE: [text]"
/proc/log_adminsay(text)
if (config.log_adminchat)
@@ -38,65 +38,65 @@
/proc/log_game(text)
if (config.log_game)
diary << "\[[time_stamp()]]GAME: [text]"
GLOB.diary << "\[[time_stamp()]]GAME: [text]"
/proc/log_vote(text)
if (config.log_vote)
diary << "\[[time_stamp()]]VOTE: [text]"
GLOB.diary << "\[[time_stamp()]]VOTE: [text]"
/proc/log_access(text)
if (config.log_access)
diary << "\[[time_stamp()]]ACCESS: [text]"
GLOB.diary << "\[[time_stamp()]]ACCESS: [text]"
/proc/log_say(text)
if (config.log_say)
diary << "\[[time_stamp()]]SAY: [text]"
GLOB.diary << "\[[time_stamp()]]SAY: [text]"
/proc/log_prayer(text)
if (config.log_prayer)
diary << "\[[time_stamp()]]PRAY: [text]"
GLOB.diary << "\[[time_stamp()]]PRAY: [text]"
/proc/log_law(text)
if (config.log_law)
diary << "\[[time_stamp()]]LAW: [text]"
GLOB.diary << "\[[time_stamp()]]LAW: [text]"
/proc/log_ooc(text)
if (config.log_ooc)
diary << "\[[time_stamp()]]OOC: [text]"
GLOB.diary << "\[[time_stamp()]]OOC: [text]"
/proc/log_whisper(text)
if (config.log_whisper)
diary << "\[[time_stamp()]]WHISPER: [text]"
GLOB.diary << "\[[time_stamp()]]WHISPER: [text]"
/proc/log_emote(text)
if (config.log_emote)
diary << "\[[time_stamp()]]EMOTE: [text]"
GLOB.diary << "\[[time_stamp()]]EMOTE: [text]"
/proc/log_attack(text)
if (config.log_attack)
diaryofmeanpeople << "\[[time_stamp()]]ATTACK: [text]"
GLOB.diaryofmeanpeople << "\[[time_stamp()]]ATTACK: [text]"
/proc/log_pda(text)
if (config.log_pda)
diary << "\[[time_stamp()]]PDA: [text]"
GLOB.diary << "\[[time_stamp()]]PDA: [text]"
/proc/log_comment(text)
if (config.log_pda)
//reusing the PDA option because I really don't think news comments are worth a config option
diary << "\[[time_stamp()]]COMMENT: [text]"
GLOB.diary << "\[[time_stamp()]]COMMENT: [text]"
/proc/log_chat(text)
if (config.log_pda)
diary << "\[[time_stamp()]]CHAT: [text]"
GLOB.diary << "\[[time_stamp()]]CHAT: [text]"
/proc/log_sql(text)
if(config.sql_enabled)
diary << "\[[time_stamp()]]SQL: [text]"
GLOB.diary << "\[[time_stamp()]]SQL: [text]"
//This replaces world.log so it displays both in DD and the file
/proc/log_world(text)
if(config && config.log_runtimes)
world.log = runtime_diary
world.log = GLOB.runtime_diary
world.log << text
world.log = null
world.log << text
+12 -12
View File
@@ -2,15 +2,15 @@
#define pick_list_replacements(FILE, KEY) (strings_replacement(FILE, KEY))
#define json_load(FILE) (json_decode(file2text(FILE)))
var/global/list/string_cache
var/global/string_filename_current_key
GLOBAL_LIST(string_cache)
GLOBAL_VAR(string_filename_current_key)
/proc/strings_replacement(filename, key)
load_strings_file(filename)
if((filename in string_cache) && (key in string_cache[filename]))
var/response = pick(string_cache[filename][key])
if((filename in GLOB.string_cache) && (key in GLOB.string_cache[filename]))
var/response = pick(GLOB.string_cache[filename][key])
var/regex/r = regex("@pick\\((\\D+?)\\)", "g")
response = r.Replace(response, /proc/strings_subkey_lookup)
return response
@@ -19,23 +19,23 @@ var/global/string_filename_current_key
/proc/strings(filename as text, key as text)
load_strings_file(filename)
if((filename in string_cache) && (key in string_cache[filename]))
return string_cache[filename][key]
if((filename in GLOB.string_cache) && (key in GLOB.string_cache[filename]))
return GLOB.string_cache[filename][key]
else
CRASH("strings list not found: strings/[filename], index=[key]")
/proc/strings_subkey_lookup(match, group1)
return pick_list(string_filename_current_key, group1)
return pick_list(GLOB.string_filename_current_key, group1)
/proc/load_strings_file(filename)
string_filename_current_key = filename
if(filename in string_cache)
GLOB.string_filename_current_key = filename
if(filename in GLOB.string_cache)
return //no work to do
if(!string_cache)
string_cache = new
if(!GLOB.string_cache)
GLOB.string_cache = new
if(fexists("strings/[filename]"))
string_cache[filename] = json_load("strings/[filename]")
GLOB.string_cache[filename] = json_load("strings/[filename]")
else
CRASH("file not found: strings/[filename]")
+1 -1
View File
@@ -2,7 +2,7 @@
/client/proc/join_date_check(y,m,d)
var/DBQuery/query_datediff = dbcon.NewQuery("SELECT DATEDIFF(Now(),'[y]-[m]-[d]')")
var/DBQuery/query_datediff = GLOB.dbcon.NewQuery("SELECT DATEDIFF(Now(),'[y]-[m]-[d]')")
if(!query_datediff.Execute())
return FALSE
+3 -3
View File
@@ -16,12 +16,12 @@
/proc/cmp_name_dsc(atom/a, atom/b)
return sorttext(a.name, b.name)
var/cmp_field = "name"
GLOBAL_VAR_INIT(cmp_field, "name")
/proc/cmp_records_asc(datum/data/record/a, datum/data/record/b)
return sorttext(b.fields[cmp_field], a.fields[cmp_field])
return sorttext(b.fields[GLOB.cmp_field], a.fields[GLOB.cmp_field])
/proc/cmp_records_dsc(datum/data/record/a, datum/data/record/b)
return sorttext(a.fields[cmp_field], b.fields[cmp_field])
return sorttext(a.fields[GLOB.cmp_field], b.fields[GLOB.cmp_field])
/proc/cmp_ckey_asc(client/a, client/b)
return sorttext(b.ckey, a.ckey)
+2 -2
View File
@@ -51,11 +51,11 @@
PLEASE USE RESPONSIBLY, Some log files can reach sizes of 4MB! */
/client/proc/file_spam_check()
var/time_to_wait = fileaccess_timer - world.time
var/time_to_wait = GLOB.fileaccess_timer - world.time
if(time_to_wait > 0)
to_chat(src, "<font color='red'>Error: file_spam_check(): Spam. Please wait [round(time_to_wait/10)] seconds.</font>")
return 1
fileaccess_timer = world.time + FTPDELAY
GLOB.fileaccess_timer = world.time + FTPDELAY
return 0
#undef FTPDELAY
+1
View File
@@ -1,3 +1,4 @@
#define HAS_SECONDARY_FLAG(atom, sflag) (atom.secondary_flags ? atom.secondary_flags[sflag] : FALSE)
#define SET_SECONDARY_FLAG(atom, sflag) if(!atom.secondary_flags) { atom.secondary_flags = list(); } atom.secondary_flags[sflag] = TRUE;
#define CLEAR_SECONDARY_FLAG(atom, sflag) if(atom.secondary_flags) atom.secondary_flags[sflag] = null
#define TOGGLE_SECONDARY_FLAG(atom, sflag) if(HAS_SECONDARY_FLAG(atom, sflag)) { CLEAR_SECONDARY_FLAG(atom, sflag); } else {SET_SECONDARY_FLAG(atom, sflag) ; }
+17 -17
View File
@@ -76,7 +76,7 @@
/proc/alone_in_area(area/the_area, mob/must_be_alone, check_type = /mob/living/carbon)
var/area/our_area = get_area(the_area)
for(var/C in living_mob_list)
for(var/C in GLOB.living_mob_list)
if(!istype(C, check_type))
continue
if(C == must_be_alone)
@@ -301,12 +301,12 @@
/proc/try_move_adjacent(atom/movable/AM)
var/turf/T = get_turf(AM)
for(var/direction in cardinal)
for(var/direction in GLOB.cardinal)
if(AM.Move(get_step(T, direction)))
break
/proc/get_mob_by_key(key)
for(var/mob/M in mob_list)
for(var/mob/M in GLOB.mob_list)
if(M.ckey == lowertext(key))
return M
return null
@@ -317,7 +317,7 @@
var/list/candidates = list()
// Keep looping until we find a non-afk candidate within the time bracket (we limit the bracket to 10 minutes (6000))
while(!candidates.len && afk_bracket < 6000)
for(var/mob/dead/observer/G in player_list)
for(var/mob/dead/observer/G in GLOB.player_list)
if(G.client != null)
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
if(!G.client.is_afk(afk_bracket) && (be_special_type in G.client.prefs.be_special))
@@ -358,8 +358,8 @@
/proc/get_active_player_count(var/alive_check = 0, var/afk_check = 0, var/human_check = 0)
// Get active players who are playing in the round
var/active_players = 0
for(var/i = 1; i <= player_list.len; i++)
var/mob/M = player_list[i]
for(var/i = 1; i <= GLOB.player_list.len; i++)
var/mob/M = GLOB.player_list[i]
if(M && M.client)
if(alive_check && M.stat)
continue
@@ -431,10 +431,10 @@
if(2)
to_chat(G, "<span class='danger'>Choice registered: No.</span>")
if(3)
var/list/L = poll_ignore[ignore_category]
var/list/L = GLOB.poll_ignore[ignore_category]
if(!L)
poll_ignore[ignore_category] = list()
poll_ignore[ignore_category] += G.ckey
GLOB.poll_ignore[ignore_category] = list()
GLOB.poll_ignore[ignore_category] += G.ckey
to_chat(G, "<span class='danger'>Choice registered: Never for this round.</span>")
/proc/pollCandidates(var/Question, var/jobbanType, var/datum/game_mode/gametypeCheck, var/be_special_flag = 0, var/poll_time = 300, var/ignore_category = null, flashwindow = TRUE)
@@ -443,8 +443,8 @@
if (!Question)
Question = "Would you like to be a special role?"
for(var/mob/dead/observer/G in player_list)
if(!G.key || !G.client || (ignore_category && poll_ignore[ignore_category] && G.ckey in poll_ignore[ignore_category]))
for(var/mob/dead/observer/G in GLOB.player_list)
if(!G.key || !G.client || (ignore_category && GLOB.poll_ignore[ignore_category] && G.ckey in GLOB.poll_ignore[ignore_category]))
continue
if(be_special_flag)
if(!(G.client.prefs) || !(be_special_flag in G.client.prefs.be_special))
@@ -490,7 +490,7 @@
return
//First we spawn a dude.
var/mob/living/carbon/human/new_character = new(pick(latejoin))//The mob being spawned.
var/mob/living/carbon/human/new_character = new(pick(GLOB.latejoin))//The mob being spawned.
G_found.client.prefs.copy_to(new_character)
new_character.dna.update_dna_identity()
@@ -499,7 +499,7 @@
return new_character
/proc/send_to_playing_players(thing) //sends a whatever to all playing players; use instead of to_chat(world, where needed)
for(var/M in player_list)
for(var/M in GLOB.player_list)
if(M && !isnewplayer(M))
to_chat(M, thing)
@@ -513,19 +513,19 @@
winset(C, "mainwindow", "flash=5")
/proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank)
if(ticker.current_state != GAME_STATE_PLAYING || !character)
if(SSticker.current_state != GAME_STATE_PLAYING || !character)
return
var/area/A = get_area(character)
var/message = "<span class='game deadsay'><span class='name'>\
[character.real_name]</span> ([rank]) has arrived at the station at \
<span class='name'>[A.name]</span>.</span>"
deadchat_broadcast(message, follow_target = character, message_type=DEADCHAT_ARRIVALRATTLE)
if((!announcement_systems.len) || (!character.mind))
if((!GLOB.announcement_systems.len) || (!character.mind))
return
if((character.mind.assigned_role == "Cyborg") || (character.mind.assigned_role == character.mind.special_role))
return
var/obj/machinery/announcement_system/announcer = pick(announcement_systems)
var/obj/machinery/announcement_system/announcer = pick(GLOB.announcement_systems)
announcer.announce("ARRIVAL", character.real_name, rank, list()) //make the list empty to make it announce it in common
/proc/GetRedPart(const/hexa)
@@ -535,4 +535,4 @@
return hex2num(copytext(hexa, 4, 6))
/proc/GetBluePart(const/hexa)
return hex2num(copytext(hexa, 6, 8))
return hex2num(copytext(hexa, 6, 8))
+41 -48
View File
@@ -4,86 +4,79 @@
/proc/make_datum_references_lists()
//hair
init_sprite_accessory_subtypes(/datum/sprite_accessory/hair, hair_styles_list, hair_styles_male_list, hair_styles_female_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/hair, GLOB.hair_styles_list, GLOB.hair_styles_male_list, GLOB.hair_styles_female_list)
//facial hair
init_sprite_accessory_subtypes(/datum/sprite_accessory/facial_hair, facial_hair_styles_list, facial_hair_styles_male_list, facial_hair_styles_female_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/facial_hair, GLOB.facial_hair_styles_list, GLOB.facial_hair_styles_male_list, GLOB.facial_hair_styles_female_list)
//underwear
init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear, underwear_list, underwear_m, underwear_f)
init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear, GLOB.underwear_list, GLOB.underwear_m, GLOB.underwear_f)
//undershirt
init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, undershirt_list, undershirt_m, undershirt_f)
init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, GLOB.undershirt_list, GLOB.undershirt_m, GLOB.undershirt_f)
//socks
init_sprite_accessory_subtypes(/datum/sprite_accessory/socks, socks_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/socks, GLOB.socks_list)
//lizard bodyparts (blizzard intensifies)
init_sprite_accessory_subtypes(/datum/sprite_accessory/body_markings, body_markings_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/lizard, tails_list_lizard)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails_animated/lizard, animated_tails_list_lizard)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/human, tails_list_human)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails_animated/human, animated_tails_list_human)
init_sprite_accessory_subtypes(/datum/sprite_accessory/snouts, snouts_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/horns, horns_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/ears, ears_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, wings_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings_open, wings_open_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/frills, frills_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines, spines_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines_animated, animated_spines_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/legs, legs_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, r_wings_list,roundstart = TRUE)
//human mutant bodyparts
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/human, tails_list_human)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails_animated/human, animated_tails_list_human)
init_sprite_accessory_subtypes(/datum/sprite_accessory/ears, ears_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, wings_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings_open, wings_open_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/body_markings, GLOB.body_markings_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/lizard, GLOB.tails_list_lizard)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails_animated/lizard, GLOB.animated_tails_list_lizard)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/human, GLOB.tails_list_human)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails_animated/human, GLOB.animated_tails_list_human)
init_sprite_accessory_subtypes(/datum/sprite_accessory/snouts, GLOB.snouts_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/horns,GLOB.horns_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/ears, GLOB.ears_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, GLOB.wings_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings_open, GLOB.wings_open_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/frills, GLOB.frills_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines, GLOB.spines_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines_animated, GLOB.animated_spines_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/legs, GLOB.legs_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, GLOB.r_wings_list,roundstart = TRUE)
//citadel code
//mammal bodyparts (fucking furries)
init_sprite_accessory_subtypes(/datum/sprite_accessory/mam_body_markings, mam_body_markings_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/mam_tails, mam_tails_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/mam_ears, mam_ears_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/mam_tails_animated, mam_tails_animated_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/taur, taur_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/mam_body_markings, GLOB.mam_body_markings_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/mam_tails, GLOB.mam_tails_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/mam_ears, GLOB.mam_ears_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/mam_tails_animated, GLOB.mam_tails_animated_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/taur, GLOB.taur_list)
//avian bodyparts (i swear this isn't starbound)
// init_sprite_accessory_subtypes(/datum/sprite_accessory/beaks/avian, avian_beaks_list)
// init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/avian, avian_tails_list)
// init_sprite_accessory_subtypes(/datum/sprite_accessory/avian_wings, avian_wings_list)
// init_sprite_accessory_subtypes(/datum/sprite_accessory/avian_open_wings, avian_open_wings_list)
// init_sprite_accessory_subtypes(/datum/sprite_accessory/beaks/avian, GLOB.avian_beaks_list)
// init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/avian, GLOB.avian_tails_list)
// init_sprite_accessory_subtypes(/datum/sprite_accessory/avian_wings, GLOB.avian_wings_list)
// init_sprite_accessory_subtypes(/datum/sprite_accessory/avian_open_wings, GLOB.avian_open_wings_list)
//xeno parts (hiss?)
init_sprite_accessory_subtypes(/datum/sprite_accessory/xeno_head, xeno_head_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/xeno_tail, xeno_tail_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/xeno_dorsal, xeno_dorsal_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/xeno_head, GLOB.xeno_head_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/xeno_tail, GLOB.xeno_tail_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/xeno_dorsal, GLOB.xeno_dorsal_list)
//genitals
init_sprite_accessory_subtypes(/datum/sprite_accessory/penis, cock_shapes_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/breasts, breasts_size_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/penis, GLOB.cock_shapes_list)
init_sprite_accessory_subtypes(/datum/sprite_accessory/breasts, GLOB.breasts_size_list)
//Species
for(var/spath in subtypesof(/datum/species))
var/datum/species/S = new spath()
if(S.roundstart)
roundstart_species[S.id] = S.type
species_list[S.id] = S.type
GLOB.roundstart_species[S.id] = S.type
GLOB.species_list[S.id] = S.type
//Surgeries
for(var/path in subtypesof(/datum/surgery))
surgeries_list += new path()
GLOB.surgeries_list += new path()
//Materials
for(var/path in subtypesof(/datum/material))
var/datum/material/D = new path()
materials_list[D.id] = D
GLOB.materials_list[D.id] = D
//Techs
for(var/path in subtypesof(/datum/tech))
var/datum/tech/D = new path()
tech_list[D.id] = D
GLOB.tech_list[D.id] = D
//Emotes
for(var/path in subtypesof(/datum/emote))
var/datum/emote/E = new path()
emote_list[E.key] = E
E.emote_list[E.key] = E
init_subtypes(/datum/crafting_recipe, crafting_recipes)
init_subtypes(/datum/crafting_recipe, GLOB.crafting_recipes)
/* // Uncomment to debug chemical reaction list.
/client/verb/debug_chemical_list()
+2 -2
View File
@@ -67,7 +67,7 @@
if(AM.can_be_unanchored && !AM.anchored)
return 0
for(var/direction in cardinal)
for(var/direction in GLOB.cardinal)
AM = find_type_in_direction(A, direction)
if(AM == NULLTURF_BORDER)
if((A.smooth & SMOOTH_BORDER))
@@ -259,7 +259,7 @@
A.cut_overlay(A.bottom_left_corner)
A.bottom_left_corner = se
LAZYADD(New, se)
if(New)
A.add_overlay(New)
+11 -12
View File
@@ -15,7 +15,7 @@ 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')
GLOBAL_DATUM_INIT(my_icon, /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
@@ -872,18 +872,18 @@ The _flatIcons list is a cache for generated icon files.
qdel(atom_icon)
return text_image
var/global/list/friendly_animal_types = list()
GLOBAL_LIST_EMPTY(friendly_animal_types)
// Pick a random animal instead of the icon, and use that instead
/proc/getRandomAnimalImage(atom/A)
if(!friendly_animal_types.len)
if(!GLOB.friendly_animal_types.len)
for(var/T in typesof(/mob/living/simple_animal))
var/mob/living/simple_animal/SA = T
if(initial(SA.gold_core_spawnable) == 2)
friendly_animal_types += SA
GLOB.friendly_animal_types += SA
var/mob/living/simple_animal/SA = pick(friendly_animal_types)
var/mob/living/simple_animal/SA = pick(GLOB.friendly_animal_types)
var/icon = initial(SA.icon)
var/icon_state = initial(SA.icon_state)
@@ -943,16 +943,16 @@ var/global/list/friendly_animal_types = list()
return J
return 0
var/global/list/humanoid_icon_cache = list()
//For creating consistent icons for human looking simple animals
/proc/get_flat_human_icon(var/icon_id,var/outfit,var/datum/preferences/prefs)
/proc/get_flat_human_icon(icon_id, datum/job/J, datum/preferences/prefs)
var/static/list/humanoid_icon_cache = list()
if(!icon_id || !humanoid_icon_cache[icon_id])
var/mob/living/carbon/human/dummy/body = new()
if(prefs)
prefs.copy_to(body)
if(outfit)
body.equipOutfit(outfit, TRUE)
if(J)
J.equip(body, TRUE, FALSE)
SSoverlays.Flush()
@@ -988,13 +988,12 @@ var/global/list/humanoid_icon_cache = list()
/image/proc/setDir(newdir)
dir = newdir
// Used to make the frozen item visuals for Freon.
var/list/freeze_item_icons = list()
/atom/proc/freeze_icon_index()
return "\ref[initial(icon)]-[initial(icon_state)]"
/obj/proc/make_frozen_visual()
// Used to make the frozen item visuals for Freon.
var/static/list/freeze_item_icons = list()
if(!HAS_SECONDARY_FLAG(src, FROZEN) && (initial(icon) && initial(icon_state)))
var/index = freeze_icon_index()
var/icon/IC
+5 -5
View File
@@ -1,13 +1,13 @@
// Credits to Nickr5 for the useful procs I've taken from his library resource.
var/const/E = 2.71828183
var/const/Sqrt2 = 1.41421356
GLOBAL_VAR_INIT(E, 2.71828183)
GLOBAL_VAR_INIT(Sqrt2, 1.41421356)
// List of square roots for the numbers 1-100.
var/list/sqrtTable = list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10)
8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10))
/proc/sign(x)
return x!=0?x/abs(x):0
@@ -150,9 +150,9 @@ var/list/sqrtTable = list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
//68% chance that the number is within 1stddev
//95% chance that the number is within 2stddev
//98% chance that the number is within 3stddev...etc
var/gaussian_next
#define ACCURACY 10000
/proc/gaussian(mean, stddev)
var/static/gaussian_next
var/R1;var/R2;var/working
if(gaussian_next != null)
R1 = gaussian_next
+100 -75
View File
@@ -21,58 +21,59 @@
return "000"
/proc/random_underwear(gender)
if(!underwear_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear, underwear_list, underwear_m, underwear_f)
if(!GLOB.underwear_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear, GLOB.underwear_list, GLOB.underwear_m, GLOB.underwear_f)
switch(gender)
if(MALE)
return pick(underwear_m)
return pick(GLOB.underwear_m)
if(FEMALE)
return pick(underwear_f)
return pick(GLOB.underwear_f)
else
return pick(underwear_list)
return pick(GLOB.underwear_list)
/proc/random_undershirt(gender)
if(!undershirt_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, undershirt_list, undershirt_m, undershirt_f)
if(!GLOB.undershirt_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, GLOB.undershirt_list, GLOB.undershirt_m, GLOB.undershirt_f)
switch(gender)
if(MALE)
return pick(undershirt_m)
return pick(GLOB.undershirt_m)
if(FEMALE)
return pick(undershirt_f)
return pick(GLOB.undershirt_f)
else
return pick(undershirt_list)
return pick(GLOB.undershirt_list)
/proc/random_socks()
if(!socks_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/socks, socks_list)
return pick(socks_list)
if(!GLOB.socks_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/socks, GLOB.socks_list)
return pick(GLOB.socks_list)
/proc/random_features(penis=0,balls=0,vagina=0,womb=0,breasts=0)
if(!tails_list_human.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/human, tails_list_human)
if(!tails_list_lizard.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/lizard, tails_list_lizard)
if(!snouts_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/snouts, snouts_list)
if(!horns_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/horns, horns_list)
if(!ears_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/ears, horns_list)
if(!frills_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/frills, frills_list)
if(!spines_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines, spines_list)
if(!legs_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/legs, legs_list)
if(!body_markings_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/body_markings, body_markings_list)
if(!wings_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, wings_list)
if(!cock_shapes_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/penis, cock_shapes_list)
if(ishuman(src))
var/mob/living/carbon/human/H = src
if(H.gender == MALE)
/proc/random_features()
if(!GLOB.tails_list_human.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/human, GLOB.tails_list_human)
if(!GLOB.tails_list_lizard.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/lizard, GLOB.tails_list_lizard)
if(!GLOB.snouts_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/snouts, GLOB.snouts_list)
if(!GLOB.horns_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/horns, GLOB.horns_list)
if(!GLOB.ears_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/ears, GLOB.horns_list)
if(!GLOB.frills_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/frills, GLOB.frills_list)
if(!GLOB.spines_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines, GLOB.spines_list)
if(!GLOB.legs_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/legs, GLOB.legs_list)
if(!GLOB.body_markings_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/body_markings, GLOB.body_markings_list)
if(!GLOB.wings_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, GLOB.wings_list)
if(!GLOB.cock_shapes_list.len)
init_sprite_accessory_subtypes(/datum/sprite_accessory/penis, GLOB.cock_shapes_list)
// if(ishuman(src))
// var/mob/living/carbon/human/H = src
/* if(H.gender == MALE) Fuck if I know how to fix this.
penis = 1
balls = 1
vagina = 0
@@ -83,21 +84,21 @@
balls = 0
vagina = 1
womb = 1
breasts = 1
breasts = 1 */
return(list(
"mcolor" = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F"),
"mcolor2" = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F"),
"mcolor3" = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F"),
"tail_lizard" = pick(tails_list_lizard),
"tail_lizard" = pick(GLOB.tails_list_lizard),
"tail_human" = "None",
"wings" = "None",
"snout" = pick(snouts_list),
"horns" = pick(horns_list),
"snout" = pick(GLOB.snouts_list),
"horns" = pick(GLOB.horns_list),
"ears" = "None",
"frills" = pick(frills_list),
"spines" = pick(spines_list),
"body_markings" = pick(body_markings_list),
"frills" = pick(GLOB.frills_list),
"spines" = pick(GLOB.spines_list),
"body_markings" = pick(GLOB.body_markings_list),
"legs" = "Normal Legs",
"taur" = "None",
"mam_body_markings" = "None",
@@ -137,7 +138,7 @@
"eggsack_egg_size" = EGG_GIRTH_DEF,
"has_breasts" = FALSE,
"breasts_color" = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F"),
"breasts_size" = pick(breasts_size_list),
"breasts_size" = pick(GLOB.breasts_size_list),
"breasts_fluid" = "milk",
"has_vag" = FALSE,
"vag_color" = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F"),
@@ -153,27 +154,27 @@
/proc/random_hair_style(gender)
switch(gender)
if(MALE)
return pick(hair_styles_male_list)
return pick(GLOB.hair_styles_male_list)
if(FEMALE)
return pick(hair_styles_female_list)
return pick(GLOB.hair_styles_female_list)
else
return pick(hair_styles_list)
return pick(GLOB.hair_styles_list)
/proc/random_facial_hair_style(gender)
switch(gender)
if(MALE)
return pick(facial_hair_styles_male_list)
return pick(GLOB.facial_hair_styles_male_list)
if(FEMALE)
return pick(facial_hair_styles_female_list)
return pick(GLOB.facial_hair_styles_female_list)
else
return pick(facial_hair_styles_list)
return pick(GLOB.facial_hair_styles_list)
/proc/random_unique_name(gender, attempts_to_find_unique_name=10)
for(var/i=1, i<=attempts_to_find_unique_name, i++)
if(gender==FEMALE)
. = capitalize(pick(first_names_female)) + " " + capitalize(pick(last_names))
. = capitalize(pick(GLOB.first_names_female)) + " " + capitalize(pick(GLOB.last_names))
else
. = capitalize(pick(first_names_male)) + " " + capitalize(pick(last_names))
. = capitalize(pick(GLOB.first_names_male)) + " " + capitalize(pick(GLOB.last_names))
if(i != attempts_to_find_unique_name && !findname(.))
break
@@ -193,9 +194,9 @@
break
/proc/random_skin_tone()
return pick(skin_tones)
return pick(GLOB.skin_tones)
var/list/skin_tones = list(
GLOBAL_LIST_INIT(skin_tones, list(
"albino",
"caucasian1",
"caucasian2",
@@ -208,10 +209,10 @@ var/list/skin_tones = list(
"indian",
"african1",
"african2"
)
))
var/global/list/species_list[0]
var/global/list/roundstart_species[0]
GLOBAL_LIST_EMPTY(species_list)
GLOBAL_LIST_EMPTY(roundstart_species)
/proc/age2agedescription(age)
switch(age)
@@ -241,32 +242,56 @@ Proc for attack log creation, because really why not
1 argument is the actor
2 argument is the target of action
3 is the description of action(like punched, throwed, or any other verb)
4 should it make adminlog note or not
5 is the tool with which the action was made(usually item) 5 and 6 are very similar(5 have "by " before it, that it) and are separated just to keep things in a bit more in order
6 is additional information, anything that needs to be added
4 is the tool with which the action was made(usually item) 4 and 5 are very similar(5 have "by " before it, that it) and are separated just to keep things in a bit more in order
5 is additional information, anything that needs to be added
*/
/proc/add_logs(mob/user, mob/target, what_done, object=null, addition=null)
var/turf/attack_location = get_turf(target)
var/is_mob_user = user && typecache_mob[user.type]
var/is_mob_target = target && typecache_mob[target.type]
var/is_mob_user = user && GLOB.typecache_mob[user.type]
var/is_mob_target = target && GLOB.typecache_mob[target.type]
var/mob/living/living_target
if(target && isliving(target))
living_target = target
var/hp =" "
if(living_target)
hp = "(NEWHP: [living_target.health])"
var/starget = "NON-EXISTENT SUBJECT"
if(target)
if(is_mob_target && target.ckey)
starget = "[target.name]([target.ckey])"
else
starget = "[target.name]"
var/ssource = "NON-EXISTENT USER" //How!?
if(user)
if(is_mob_user && user.ckey)
ssource = "[user.name]([user.ckey])"
else
ssource = "[user.name]"
var/sobject = ""
if(object)
sobject = "[object]"
var/sattackloc = ""
if(attack_location)
sattackloc = "([attack_location.x],[attack_location.y],[attack_location.z])"
if(is_mob_user)
var/message = "<font color='red'>has [what_done] [target ? "[target.name][(is_mob_target && target.ckey) ? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][(living_target) ? " (NEWHP: [living_target.health])" : ""][(attack_location) ? "([attack_location.x],[attack_location.y],[attack_location.z])" : ""]</font>"
var/message = "<font color='red'>has [what_done] [starget] with [sobject][addition] [hp] [sattackloc]</font>"
user.log_message(message, INDIVIDUAL_ATTACK_LOG)
if(is_mob_target)
var/message = "<font color='orange'>has been [what_done] by [user ? "[user.name][(is_mob_user && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][(living_target) ? " (NEWHP: [living_target.health])" : ""][(attack_location) ? "([attack_location.x],[attack_location.y],[attack_location.z])" : ""]</font>"
var/message = "<font color='orange'>has been [what_done] by [ssource] with [sobject][addition] [hp] [sattackloc]</font>"
target.log_message(message, INDIVIDUAL_ATTACK_LOG)
log_attack("[user ? "[user.name][(is_mob_user && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"] [what_done] [target ? "[target.name][(is_mob_target && target.ckey)? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][(living_target) ? " (NEWHP: [living_target.health])" : ""][(attack_location) ? "([attack_location.x],[attack_location.y],[attack_location.z])" : ""]")
log_attack("[ssource] [what_done] [starget] with [sobject][addition] [hp] [sattackloc]")
/proc/do_mob(mob/user , mob/target, time = 30, uninterruptible = 0, progress = 1, datum/callback/extra_checks = null)
@@ -292,7 +317,7 @@ Proc for attack log creation, because really why not
stoplag()
if (progress)
progbar.update(world.time - starttime)
if(!user || !target)
if(QDELETED(user) || QDELETED(target))
. = 0
break
if(uninterruptible)
@@ -344,11 +369,11 @@ Proc for attack log creation, because really why not
drifting = 0
Uloc = user.loc
if(!user || user.stat || user.weakened || user.stunned || (!drifting && user.loc != Uloc) || (extra_checks && !extra_checks.Invoke()))
if(QDELETED(user) || user.stat || user.weakened || user.stunned || (!drifting && user.loc != Uloc) || (extra_checks && !extra_checks.Invoke()))
. = 0
break
if(Tloc && (!target || Tloc != target.loc))
if(!QDELETED(Tloc) && (QDELETED(target) || Tloc != target.loc))
if((Uloc != Tloc || Tloc != user) && !drifting)
. = 0
break
@@ -394,7 +419,7 @@ Proc for attack log creation, because really why not
sleep(1)
if(progress)
progbar.update(world.time - starttime)
if(!user || !targets)
if(QDELETED(user) || !targets)
. = 0
break
if(uninterruptible)
@@ -405,7 +430,7 @@ Proc for attack log creation, because really why not
user_loc = user.loc
for(var/atom/target in targets)
if((!drifting && user_loc != user.loc) || originalloc[target] != target.loc || user.get_active_held_item() != holding || user.incapacitated() || user.lying || (extra_checks && !extra_checks.Invoke()))
if((!drifting && user_loc != user.loc) || QDELETED(target) || originalloc[target] != target.loc || user.get_active_held_item() != holding || user.incapacitated() || user.lying || (extra_checks && !extra_checks.Invoke()))
. = 0
break mainloop
if(progbar)
@@ -447,7 +472,7 @@ Proc for attack log creation, because really why not
step(X, pick(NORTH, SOUTH, EAST, WEST))
/proc/deadchat_broadcast(message, mob/follow_target=null, turf/turf_target=null, speaker_key=null, message_type=DEADCHAT_REGULAR)
for(var/mob/M in player_list)
for(var/mob/M in GLOB.player_list)
var/datum/preferences/prefs
if(M.client && M.client.prefs)
prefs = M.client.prefs
+34 -34
View File
@@ -2,15 +2,15 @@
/proc/lizard_name(gender)
if(gender == MALE)
return "[pick(lizard_names_male)]-[pick(lizard_names_male)]"
return "[pick(GLOB.lizard_names_male)]-[pick(GLOB.lizard_names_male)]"
else
return "[pick(lizard_names_female)]-[pick(lizard_names_female)]"
return "[pick(GLOB.lizard_names_female)]-[pick(GLOB.lizard_names_female)]"
/proc/plasmaman_name()
return "[pick(plasmaman_names)] \Roman[rand(1,99)]"
return "[pick(GLOB.plasmaman_names)] \Roman[rand(1,99)]"
var/church_name = null
/proc/church_name()
var/static/church_name
if (church_name)
return church_name
@@ -26,24 +26,24 @@ var/church_name = null
return name
var/command_name = null
GLOBAL_VAR(command_name)
/proc/command_name()
if (command_name)
return command_name
if (GLOB.command_name)
return GLOB.command_name
var/name = "Central Command"
command_name = name
GLOB.command_name = name
return name
/proc/change_command_name(name)
command_name = name
GLOB.command_name = name
return name
var/religion_name = null
/proc/religion_name()
var/static/religion_name
if (religion_name)
return religion_name
@@ -55,20 +55,20 @@ var/religion_name = null
return capitalize(name)
/proc/station_name()
if(station_name)
return station_name
if(GLOB.station_name)
return GLOB.station_name
if(config && config.station_name)
station_name = config.station_name
GLOB.station_name = config.station_name
else
station_name = new_station_name()
GLOB.station_name = new_station_name()
if(config && config.server_name)
world.name = "[config.server_name][config.server_name==station_name ? "" : ": [station_name]"]"
world.name = "[config.server_name][config.server_name==GLOB.station_name ? "" : ": [GLOB.station_name]"]"
else
world.name = station_name
world.name = GLOB.station_name
return station_name
return GLOB.station_name
/proc/new_station_name()
var/random = rand(1,5)
@@ -77,24 +77,24 @@ var/religion_name = null
//Rare: Pre-Prefix
if (prob(10))
name = pick(station_prefixes)
name = pick(GLOB.station_prefixes)
new_station_name = name + " "
name = ""
// Prefix
for(var/holiday_name in SSevent.holidays)
for(var/holiday_name in SSevents.holidays)
if(holiday_name == "Friday the 13th")
random = 13
var/datum/holiday/holiday = SSevent.holidays[holiday_name]
var/datum/holiday/holiday = SSevents.holidays[holiday_name]
name = holiday.getStationPrefix()
//get normal name
if(!name)
name = pick(station_names)
name = pick(GLOB.station_names)
if(name)
new_station_name += name + " "
// Suffix
name = pick(station_suffixes)
name = pick(GLOB.station_suffixes)
new_station_name += name + " "
// ID Number
@@ -102,19 +102,19 @@ var/religion_name = null
if(1)
new_station_name += "[rand(1, 99)]"
if(2)
new_station_name += pick(greek_letters)
new_station_name += pick(GLOB.greek_letters)
if(3)
new_station_name += "\Roman[rand(1,99)]"
if(4)
new_station_name += pick(phonetic_alphabet)
new_station_name += pick(GLOB.phonetic_alphabet)
if(5)
new_station_name += pick(numbers_as_words)
new_station_name += pick(GLOB.numbers_as_words)
if(13)
new_station_name += pick("13","XIII","Thirteen")
return new_station_name
var/syndicate_name = null
/proc/syndicate_name()
var/static/syndicate_name
if (syndicate_name)
return syndicate_name
@@ -145,8 +145,8 @@ var/syndicate_name = null
//Traitors and traitor silicons will get these. Revs will not.
var/syndicate_code_phrase//Code phrase for traitors.
var/syndicate_code_response//Code response for traitors.
GLOBAL_VAR(syndicate_code_phrase) //Code phrase for traitors.
GLOBAL_VAR(syndicate_code_response) //Code response for traitors.
/*
Should be expanded.
@@ -179,10 +179,10 @@ var/syndicate_code_response//Code response for traitors.
var/threats = strings(ION_FILE, "ionthreats")
var/foods = strings(ION_FILE, "ionfood")
var/drinks = strings(ION_FILE, "iondrinks")
var/list/locations = teleportlocs.len ? teleportlocs : drinks //if null, defaults to drinks instead.
var/list/locations = GLOB.teleportlocs.len ? GLOB.teleportlocs : drinks //if null, defaults to drinks instead.
var/list/names = list()
for(var/datum/data/record/t in data_core.general)//Picks from crew manifest.
for(var/datum/data/record/t in GLOB.data_core.general)//Picks from crew manifest.
names += t.fields["name"]
var/maxwords = words//Extra var to check for duplicates.
@@ -204,9 +204,9 @@ var/syndicate_code_response//Code response for traitors.
if(prob(10))
code_phrase += pick(lizard_name(MALE),lizard_name(FEMALE))
else
code_phrase += pick(pick(first_names_male,first_names_female))
code_phrase += pick(pick(GLOB.first_names_male,GLOB.first_names_female))
code_phrase += " "
code_phrase += pick(last_names)
code_phrase += pick(GLOB.last_names)
if(2)
code_phrase += pick(get_all_jobs())//Returns a job.
safety -= 1
@@ -217,7 +217,7 @@ var/syndicate_code_response//Code response for traitors.
if(2)
code_phrase += lowertext(pick(foods))
if(3)
code_phrase += pick(locations)
code_phrase += lowertext(pick(locations))
safety -= 2
if(3)
switch(rand(1,4))//Abstract nouns, objects, adjectives, threats. Can be selected more than once.
@@ -241,4 +241,4 @@ var/syndicate_code_response//Code response for traitors.
world.name = "[config.server_name]: [designation]"
else
world.name = designation
station_name = designation
GLOB.station_name = designation
+4 -4
View File
@@ -8,9 +8,9 @@
if(toIndex <= 0)
toIndex += L.len + 1
sortInstance.L = L
sortInstance.cmp = cmp
sortInstance.associative = associative
GLOB.sortInstance.L = L
GLOB.sortInstance.cmp = cmp
GLOB.sortInstance.associative = associative
sortInstance.binarySort(fromIndex, toIndex, fromIndex)
GLOB.sortInstance.binarySort(fromIndex, toIndex, fromIndex)
return L
+4 -4
View File
@@ -8,9 +8,9 @@
if(toIndex <= 0)
toIndex += L.len + 1
sortInstance.L = L
sortInstance.cmp = cmp
sortInstance.associative = associative
sortInstance.mergeSort(fromIndex, toIndex)
GLOB.sortInstance.L = L
GLOB.sortInstance.cmp = cmp
GLOB.sortInstance.associative = associative
GLOB.sortInstance.mergeSort(fromIndex, toIndex)
return L
+4 -4
View File
@@ -8,10 +8,10 @@
if(toIndex <= 0)
toIndex += L.len + 1
sortInstance.L = L
sortInstance.cmp = cmp
sortInstance.associative = associative
GLOB.sortInstance.L = L
GLOB.sortInstance.cmp = cmp
GLOB.sortInstance.associative = associative
sortInstance.timSort(fromIndex, toIndex)
GLOB.sortInstance.timSort(fromIndex, toIndex)
return L
+1 -1
View File
@@ -9,7 +9,7 @@
#define MIN_GALLOP 7
//This is a global instance to allow much of this code to be reused. The interfaces are kept seperately
var/datum/sortInstance/sortInstance = new()
GLOBAL_DATUM_INIT(sortInstance, /datum/sortInstance, new())
/datum/sortInstance
//The array being sorted.
var/list/L
+8 -8
View File
@@ -15,11 +15,11 @@
// Run all strings to be used in an SQL query through this proc first to properly escape out injection attempts.
/proc/sanitizeSQL(t)
var/sqltext = dbcon.Quote("[t]");
var/sqltext = GLOB.dbcon.Quote("[t]");
return copytext(sqltext, 2, lentext(sqltext));//Quote() adds quotes around input, we already do that
/proc/format_table_name(table as text)
return sqlfdbktableprefix + table
return GLOB.sqlfdbktableprefix + table
/*
* Text sanitization
@@ -334,10 +334,10 @@
new_text += copytext(text, i, i+1)
return new_text
var/list/zero_character_only = list("0")
var/list/hex_characters = list("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f")
var/list/alphabet = list("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
var/list/binary = list("0","1")
GLOBAL_LIST_INIT(zero_character_only, list("0"))
GLOBAL_LIST_INIT(hex_characters, list("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"))
GLOBAL_LIST_INIT(alphabet, list("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"))
GLOBAL_LIST_INIT(binary, list("0","1"))
/proc/random_string(length, list/characters)
. = ""
for(var/i=1, i<=length, i++)
@@ -349,10 +349,10 @@ var/list/binary = list("0","1")
. += string
/proc/random_short_color()
return random_string(3, hex_characters)
return random_string(3, GLOB.hex_characters)
/proc/random_color()
return random_string(6, hex_characters)
return random_string(6, GLOB.hex_characters)
/proc/add_zero2(t, u)
var/temp1
+7 -5
View File
@@ -17,9 +17,11 @@ proc/TextPreview(var/string,var/len=40)
else
return "[copytext(string, 1, 37)]..."
var/list/mentor_log = list ( )
//var/list/admintickets = list()
var/global/list/whitelisted_species_list[0]
GLOBAL_LIST_EMPTY(mentor_log)
GLOBAL_PROTECT(mentor_log)
GLOBAL_LIST_EMPTY(whitelisted_species_list)
/proc/log_mentor(text)
mentor_log.Add(text)
diary << "\[[time_stamp()]]MENTOR: [text]"
GLOB.mentor_log.Add(text)
GLOB.diary << "\[[time_stamp()]]MENTOR: [text]"
+10 -8
View File
@@ -1,13 +1,15 @@
//Returns the world time in english
/proc/worldtime2text()
return gameTimestamp("hh:mm:ss")
return gameTimestamp("hh:mm:ss", world.time)
/proc/time_stamp(format = "hh:mm:ss", show_ds)
var/time_string = time2text(world.timeofday, format)
return show_ds ? "[time_string]:[world.timeofday % 10]" : time_string
/proc/gameTimestamp(format = "hh:mm:ss") // Get the game time in text
return time2text(world.time - timezoneOffset + 432000 - round_start_time, format)
/proc/gameTimestamp(format = "hh:mm:ss", wtime=null)
if(!wtime)
wtime = world.time
return time2text(wtime - GLOB.timezoneOffset + SSticker.gametime_offset - SSticker.round_start_time, format)
/* Returns 1 if it is the selected month and day */
/proc/isDay(month, day)
@@ -28,10 +30,10 @@
return time2text(timevar, "YYYY-MM-DD hh:mm:ss")
/var/midnight_rollovers = 0
/var/rollovercheck_last_timeofday = 0
GLOBAL_VAR_INIT(midnight_rollovers, 0)
GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
/proc/update_midnight_rollover()
if (world.timeofday < rollovercheck_last_timeofday) //TIME IS GOING BACKWARDS!
return midnight_rollovers++
return midnight_rollovers
if (world.timeofday < GLOB.rollovercheck_last_timeofday) //TIME IS GOING BACKWARDS!
return GLOB.midnight_rollovers++
return GLOB.midnight_rollovers
-9
View File
@@ -337,15 +337,6 @@
return "[year][seperator][((month < 10) ? "0[month]" : month)][seperator][((day < 10) ? "0[day]" : day)]"
/*
var/list/test_times = list("December" = 1323522004, "August" = 1123522004, "January" = 1011522004,
"Jan Leap" = 946684800, "Jan Normal" = 978307200, "New Years Eve" = 1009670400,
"New Years" = 1009836000, "New Years 2" = 1041372000, "New Years 3" = 1104530400,
"July Month End" = 744161003, "July Month End 12" = 1343777003, "End July" = 1091311200)
for(var/t in test_times)
world.log << "TEST: [t] is [unix2date(test_times[t])]"
*/
/proc/isLeap(y)
return ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
+70 -64
View File
@@ -200,17 +200,17 @@ Turf and target are seperate in case you want to teleport some distance from a t
else
switch(role)
if("clown")
newname = pick(clown_names)
newname = pick(GLOB.clown_names)
if("mime")
newname = pick(mime_names)
newname = pick(GLOB.mime_names)
if("ai")
newname = pick(ai_names)
newname = pick(GLOB.ai_names)
if("deity")
newname = pick(clown_names|ai_names|mime_names) //pick any old name
newname = pick(GLOB.clown_names|GLOB.ai_names|GLOB.mime_names) //pick any old name
else
return
for(var/mob/living/M in player_list)
for(var/mob/living/M in GLOB.player_list)
if(M == src)
continue
if(!newname || M.real_name == newname)
@@ -231,8 +231,8 @@ Turf and target are seperate in case you want to teleport some distance from a t
//Returns a list of unslaved cyborgs
/proc/active_free_borgs()
. = list()
for(var/mob/living/silicon/robot/R in living_mob_list)
if(R.connected_ai)
for(var/mob/living/silicon/robot/R in GLOB.living_mob_list)
if(R.connected_ai || R.shell)
continue
if(R.stat == DEAD)
continue
@@ -243,7 +243,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
//Returns a list of AI's
/proc/active_ais(check_mind=0)
. = list()
for(var/mob/living/silicon/ai/A in living_mob_list)
for(var/mob/living/silicon/ai/A in GLOB.living_mob_list)
if(A.stat == DEAD)
continue
if(A.control_disabled == 1)
@@ -305,7 +305,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
pois[name] = M
if(!mobs_only)
for(var/atom/A in poi_list)
for(var/atom/A in GLOB.poi_list)
if(!A || !A.loc)
continue
pois[avoid_assoc_duplicate_keys(A.name, namecounts)] = A
@@ -314,7 +314,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
//Orders mobs by type then by name
/proc/sortmobs()
var/list/moblist = list()
var/list/sortmob = sortNames(mob_list)
var/list/sortmob = sortNames(GLOB.mob_list)
for(var/mob/living/silicon/ai/M in sortmob)
moblist.Add(M)
for(var/mob/camera/M in sortmob)
@@ -378,7 +378,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
else if(istext(whom))
key = whom
ckey = ckey(whom)
C = directory[ckey]
C = GLOB.directory[ckey]
if(C)
M = C.mob
else
@@ -583,16 +583,16 @@ Turf and target are seperate in case you want to teleport some distance from a t
//Repopulates sortedAreas list
/proc/SortAreas()
sortedAreas = list()
GLOB.sortedAreas = list()
for(var/area/A in world)
sortedAreas.Add(A)
GLOB.sortedAreas.Add(A)
sortTim(sortedAreas, /proc/cmp_name_asc)
sortTim(GLOB.sortedAreas, /proc/cmp_name_asc)
/area/proc/addSorted()
sortedAreas.Add(src)
sortTim(sortedAreas, /proc/cmp_name_asc)
GLOB.sortedAreas.Add(src)
sortTim(GLOB.sortedAreas, /proc/cmp_name_asc)
//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all areas of that type in the world.
@@ -608,12 +608,12 @@ Turf and target are seperate in case you want to teleport some distance from a t
var/list/areas = list()
if(subtypes)
var/list/cache = typecacheof(areatype)
for(var/V in sortedAreas)
for(var/V in GLOB.sortedAreas)
var/area/A = V
if(cache[A.type])
areas += V
else
for(var/V in sortedAreas)
for(var/V in GLOB.sortedAreas)
var/area/A = V
if(A.type == areatype)
areas += V
@@ -633,7 +633,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
var/list/turfs = list()
if(subtypes)
var/list/cache = typecacheof(areatype)
for(var/V in sortedAreas)
for(var/V in GLOB.sortedAreas)
var/area/A = V
if(!cache[A.type])
continue
@@ -641,7 +641,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
if(target_z == 0 || target_z == T.z)
turfs += T
else
for(var/V in sortedAreas)
for(var/V in GLOB.sortedAreas)
var/area/A = V
if(A.type != areatype)
continue
@@ -763,9 +763,9 @@ Turf and target are seperate in case you want to teleport some distance from a t
//For objects that should embed, but make no sense being is_sharp or is_pointed()
//e.g: rods
var/list/can_embed_types = typecacheof(list(
GLOBAL_LIST_INIT(can_embed_types, typecacheof(list(
/obj/item/stack/rods,
/obj/item/pipe))
/obj/item/pipe)))
/proc/can_embed(obj/item/W)
if(W.is_sharp())
@@ -773,14 +773,14 @@ var/list/can_embed_types = typecacheof(list(
if(is_pointed(W))
return 1
if(is_type_in_typecache(W, can_embed_types))
if(is_type_in_typecache(W, GLOB.can_embed_types))
return 1
/*
Checks if that loc and dir has a item on the wall
*/
var/list/WALLITEMS = typecacheof(list(
GLOBAL_LIST_INIT(WALLITEMS, typecacheof(list(
/obj/machinery/power/apc, /obj/machinery/airalarm, /obj/item/device/radio/intercom,
/obj/structure/extinguisher_cabinet, /obj/structure/reagent_dispensers/peppertank,
/obj/machinery/status_display, /obj/machinery/requests_console, /obj/machinery/light_switch, /obj/structure/sign,
@@ -788,22 +788,22 @@ var/list/WALLITEMS = typecacheof(list(
/obj/machinery/computer/security/telescreen, /obj/machinery/embedded_controller/radio/simple_vent_controller,
/obj/item/weapon/storage/secure/safe, /obj/machinery/door_timer, /obj/machinery/flasher, /obj/machinery/keycard_auth,
/obj/structure/mirror, /obj/structure/fireaxecabinet, /obj/machinery/computer/security/telescreen/entertainment
))
)))
var/list/WALLITEMS_EXTERNAL = typecacheof(list(
GLOBAL_LIST_INIT(WALLITEMS_EXTERNAL, typecacheof(list(
/obj/machinery/camera, /obj/structure/camera_assembly,
/obj/structure/light_construct, /obj/machinery/light))
/obj/structure/light_construct, /obj/machinery/light)))
var/list/WALLITEMS_INVERSE = typecacheof(list(
/obj/structure/light_construct, /obj/machinery/light))
GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
/obj/structure/light_construct, /obj/machinery/light)))
/proc/gotwallitem(loc, dir, var/check_external = 0)
var/locdir = get_step(loc, dir)
for(var/obj/O in loc)
if(is_type_in_typecache(O, WALLITEMS) && check_external != 2)
if(is_type_in_typecache(O, GLOB.WALLITEMS) && check_external != 2)
//Direction works sometimes
if(is_type_in_typecache(O, WALLITEMS_INVERSE))
if(is_type_in_typecache(O, GLOB.WALLITEMS_INVERSE))
if(O.dir == turn(dir, 180))
return 1
else if(O.dir == dir)
@@ -814,8 +814,8 @@ var/list/WALLITEMS_INVERSE = typecacheof(list(
if(get_turf_pixel(O) == locdir)
return 1
if(is_type_in_typecache(O, WALLITEMS_EXTERNAL) && check_external)
if(is_type_in_typecache(O, WALLITEMS_INVERSE))
if(is_type_in_typecache(O, GLOB.WALLITEMS_EXTERNAL) && check_external)
if(is_type_in_typecache(O, GLOB.WALLITEMS_INVERSE))
if(O.dir == turn(dir, 180))
return 1
else if(O.dir == dir)
@@ -823,7 +823,7 @@ var/list/WALLITEMS_INVERSE = typecacheof(list(
//Some stuff is placed directly on the wallturf (signs)
for(var/obj/O in locdir)
if(is_type_in_typecache(O, WALLITEMS) && check_external != 2)
if(is_type_in_typecache(O, GLOB.WALLITEMS) && check_external != 2)
if(O.pixel_x == 0 && O.pixel_y == 0)
return 1
return 0
@@ -845,7 +845,7 @@ var/list/WALLITEMS_INVERSE = typecacheof(list(
for(var/id in cached_gases)
var/gas_concentration = cached_gases[id][MOLES]/total_moles
if(id in hardcoded_gases || gas_concentration > 0.001) //ensures the four primary gases are always shown.
if((id in GLOB.hardcoded_gases) || gas_concentration > 0.001) //ensures the four primary gases are always shown.
to_chat(user, "<span class='notice'>[cached_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] %</span>")
to_chat(user, "<span class='notice'>Temperature: [round(air_contents.temperature-T0C)] &deg;C</span>")
@@ -871,14 +871,14 @@ var/list/WALLITEMS_INVERSE = typecacheof(list(
var/initial_chance = chance
while(steps > 0)
if(prob(chance))
step(AM, pick(alldirs))
step(AM, pick(GLOB.alldirs))
chance = max(chance - (initial_chance / steps), 0)
steps--
/proc/living_player_count()
var/living_player_count = 0
for(var/mob in player_list)
if(mob in living_mob_list)
for(var/mob in GLOB.player_list)
if(mob in GLOB.living_mob_list)
living_player_count += 1
return living_player_count
@@ -1188,7 +1188,7 @@ B --><-- A
/proc/get_areas_in_z(zlevel)
. = list()
var/validarea = FALSE
for(var/V in sortedAreas)
for(var/V in GLOB.sortedAreas)
var/area/A = V
validarea = TRUE
for(var/turf/T in A)
@@ -1254,7 +1254,7 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
. += round(i*DELTA_CALC)
sleep(i*world.tick_lag*DELTA_CALC)
i *= 2
while (world.tick_usage > min(TICK_LIMIT_TO_RUN, CURRENT_TICKLIMIT))
while (world.tick_usage > min(TICK_LIMIT_TO_RUN, GLOB.CURRENT_TICKLIMIT))
#undef DELTA_CALC
@@ -1313,41 +1313,44 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
else
. = ""
/var/mob/dview/dview_mob = new
GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
//Version of view() which ignores darkness, because BYOND doesn't have it (I actually suggested it but it was tagged redundant, BUT HEARERS IS A T- /rant).
/proc/dview(var/range = world.view, var/center, var/invis_flags = 0)
if(!center)
return
dview_mob.loc = center
GLOB.dview_mob.loc = center
dview_mob.see_invisible = invis_flags
GLOB.dview_mob.see_invisible = invis_flags
. = view(range, dview_mob)
dview_mob.loc = null
. = view(range, GLOB.dview_mob)
GLOB.dview_mob.loc = null
/mob/dview
name = "INTERNAL DVIEW MOB"
invisibility = 101
density = 0
density = FALSE
see_in_dark = 1e6
anchored = 1
anchored = TRUE
var/ready_to_die = FALSE
/mob/dview/Destroy(force=0)
stack_trace("ALRIGHT WHICH FUCKER TRIED TO DELETE *MY* DVIEW?")
/mob/dview/Destroy(force = FALSE)
if(!ready_to_die)
stack_trace("ALRIGHT WHICH FUCKER TRIED TO DELETE *MY* DVIEW?")
if (!force)
return QDEL_HINT_LETMELIVE
if (!force)
return QDEL_HINT_LETMELIVE
world.log << "EVACUATE THE SHITCODE IS TRYING TO STEAL MUH JOBS"
global.dview_mob = new
return QDEL_HINT_QUEUE
log_world("EVACUATE THE SHITCODE IS TRYING TO STEAL MUH JOBS")
GLOB.dview_mob = new
return ..()
#define FOR_DVIEW(type, range, center, invis_flags) \
dview_mob.loc = center; \
dview_mob.see_invisible = invis_flags; \
for(type in view(range, dview_mob))
GLOB.dview_mob.loc = center; \
GLOB.dview_mob.see_invisible = invis_flags; \
for(type in view(range, GLOB.dview_mob))
//can a window be here, or is there a window blocking it?
/proc/valid_window_location(turf/T, dir_to_check)
@@ -1372,17 +1375,17 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
//Set this to TRUE before calling
//This prevents RCEs from badmins
//kevinz000 if you touch this I will hunt you down
var/valid_HTTPSGet = FALSE
GLOBAL_VAR_INIT(valid_HTTPSGet, FALSE)
/proc/HTTPSGet(url)
if(findtext(url, "\""))
valid_HTTPSGet = FALSE
GLOB.valid_HTTPSGet = FALSE
if(!valid_HTTPSGet)
if(!GLOB.valid_HTTPSGet)
if(usr)
CRASH("[usr.ckey]([usr]) just attempted an invalid HTTPSGet on: [url]!")
else
CRASH("Invalid HTTPSGet call on: [url]")
valid_HTTPSGet = FALSE
GLOB.valid_HTTPSGet = FALSE
//"This has got to be the ugliest hack I have ever done"
//warning, here be dragons
@@ -1407,15 +1410,15 @@ var/valid_HTTPSGet = FALSE
else
CRASH("Invalid world.system_type ([world.system_type])? Yell at Lummox.")
world.log << "HTTPSGet: [url]"
log_world("HTTPSGet: [url]")
var/result = shell(command)
if(result != 0)
world.log << "Download failed: shell exited with code: [result]"
log_world("Download failed: shell exited with code: [result]")
return
var/f = file(temp_file)
if(!f)
world.log << "Download failed: Temp file not found"
log_world("Download failed: Temp file not found")
return
. = file2text(f)
@@ -1426,3 +1429,6 @@ var/valid_HTTPSGet = FALSE
/proc/to_chat(target, message)
target << message
/proc/pass()
return