Revert "12/21 modernizations from TG live"
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
/proc/log_adminsay(text)
|
||||
if (config.log_adminchat)
|
||||
log_admin("ASAY: [text]")
|
||||
|
||||
|
||||
/proc/log_dsay(text)
|
||||
if (config.log_adminchat)
|
||||
log_admin("DSAY: [text]")
|
||||
@@ -76,6 +76,3 @@
|
||||
//reusing the PDA option because I really don't think news comments are worth a config option
|
||||
diary << "\[[time_stamp()]]COMMENT: [text]"
|
||||
|
||||
/proc/log_chat(text)
|
||||
if (config.log_pda)
|
||||
diary << "\[[time_stamp()]]CHAT: [text]"
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
if(query.NextRow())
|
||||
var/diff = text2num(query.item[1])
|
||||
if(config.use_account_age_for_jobs)
|
||||
player_age = max(0,diff) //So job code soesn't freak out if they are time traveling.
|
||||
if(diff < YOUNG)
|
||||
var/msg = "(IP: [address], ID: [computer_id]) is a new BYOND account made on [y]-[m]-[d]."
|
||||
if(diff < 0)
|
||||
|
||||
@@ -41,7 +41,4 @@ var/cmp_field = "name"
|
||||
return a.priority - b.priority
|
||||
|
||||
/proc/cmp_clientcolour_priority(datum/client_colour/A, datum/client_colour/B)
|
||||
return B.priority - A.priority
|
||||
|
||||
/proc/cmp_clockscripture_priority(datum/clockwork_scripture/A, datum/clockwork_scripture/B)
|
||||
return initial(A.sort_priority) - initial(B.sort_priority)
|
||||
return B.priority - A.priority
|
||||
+6
-43
@@ -13,17 +13,13 @@
|
||||
for(A, A && !isarea(A), A=A.loc); //semicolon is for the empty statement
|
||||
return A
|
||||
|
||||
/proc/get_area_name(atom/X)
|
||||
var/area/Y = get_area(X)
|
||||
return Y.name
|
||||
|
||||
/proc/get_area_master(O)
|
||||
var/area/A = get_area(O)
|
||||
if(A && A.master)
|
||||
A = A.master
|
||||
return A
|
||||
|
||||
/proc/get_area_by_name(N) //get area by its name
|
||||
/proc/get_area_name(N) //get area by its name
|
||||
for(var/area/A in world)
|
||||
if(A.name == N)
|
||||
return A
|
||||
@@ -348,9 +344,9 @@
|
||||
continue
|
||||
else if(afk_check && M.client.is_afk())
|
||||
continue
|
||||
else if(human_check && !ishuman(M))
|
||||
else if(human_check && !istype(M, /mob/living/carbon/human))
|
||||
continue
|
||||
else if(isnewplayer(M)) // exclude people in the lobby
|
||||
else if(istype(M, /mob/new_player)) // exclude people in the lobby
|
||||
continue
|
||||
else if(isobserver(M)) // Ghosts are fine if they were playing once (didn't start as observers)
|
||||
var/mob/dead/observer/O = M
|
||||
@@ -397,14 +393,14 @@
|
||||
|
||||
return new /datum/projectile_data(src_x, src_y, time, distance, power_x, power_y, dest_x, dest_y)
|
||||
|
||||
/proc/pollCandidates(var/Question, var/jobbanType, var/datum/game_mode/gametypeCheck, var/be_special_flag = 0, var/poll_time = 300, var/ignore_category = null)
|
||||
/proc/pollCandidates(var/Question, var/jobbanType, var/datum/game_mode/gametypeCheck, var/be_special_flag = 0, var/poll_time = 300)
|
||||
var/list/mob/dead/observer/candidates = list()
|
||||
var/time_passed = world.time
|
||||
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]))
|
||||
if(!G.key || !G.client)
|
||||
continue
|
||||
if(be_special_flag)
|
||||
if(!(G.client.prefs) || !(be_special_flag in G.client.prefs.be_special))
|
||||
@@ -417,7 +413,7 @@
|
||||
continue
|
||||
spawn(0)
|
||||
G << 'sound/misc/notice2.ogg' //Alerting them to their consideration
|
||||
switch(ignore_category ? askuser(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No","Never for this round", StealFocus=0, Timeout=poll_time) : askuser(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No", StealFocus=0, Timeout=poll_time))
|
||||
switch(askuser(G,Question,"Please answer in [poll_time/10] seconds!","Yes","No", StealFocus=0, Timeout=poll_time))
|
||||
if(1)
|
||||
G << "<span class='notice'>Choice registered: Yes.</span>"
|
||||
if((world.time-time_passed)>poll_time)
|
||||
@@ -427,12 +423,6 @@
|
||||
candidates += G
|
||||
if(2)
|
||||
G << "<span class='danger'>Choice registered: No.</span>"
|
||||
if(3)
|
||||
var/list/L = poll_ignore[ignore_category]
|
||||
if(!L)
|
||||
poll_ignore[ignore_category] = list()
|
||||
poll_ignore[ignore_category] += G.ckey
|
||||
G << "<span class='danger'>Choice registered: Never for this round.</span>"
|
||||
sleep(poll_time)
|
||||
|
||||
//Check all our candidates, to make sure they didn't log off during the wait period.
|
||||
@@ -442,23 +432,6 @@
|
||||
|
||||
return candidates
|
||||
|
||||
/proc/pollCandidatesForMob(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, mob/M, ignore_category = null)
|
||||
var/list/L = pollCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category)
|
||||
if(!M || qdeleted(M) || !M.loc)
|
||||
return list()
|
||||
return L
|
||||
|
||||
/proc/pollCandidatesForMobs(Question, jobbanType, datum/game_mode/gametypeCheck, be_special_flag = 0, poll_time = 300, list/mobs, ignore_category = null)
|
||||
var/list/L = pollCandidates(Question, jobbanType, gametypeCheck, be_special_flag, poll_time, ignore_category)
|
||||
var/i=1
|
||||
for(var/v in mobs)
|
||||
var/atom/A = v
|
||||
if(!A || qdeleted(A) || !A.loc)
|
||||
mobs.Cut(i,i+1)
|
||||
else
|
||||
++i
|
||||
return L
|
||||
|
||||
/proc/makeBody(mob/dead/observer/G_found) // Uses stripped down and bastardized code from respawn character
|
||||
if(!G_found || !G_found.key)
|
||||
return
|
||||
@@ -471,13 +444,3 @@
|
||||
new_character.key = G_found.key
|
||||
|
||||
return new_character
|
||||
|
||||
/proc/send_to_playing_players(thing) //sends a whatever to all playing players; use instead of world << where needed
|
||||
for(var/M in player_list)
|
||||
if(M && !isnewplayer(M))
|
||||
M << thing
|
||||
|
||||
/proc/window_flash(var/client_or_usr)
|
||||
if (!client_or_usr)
|
||||
return
|
||||
winset(client_or_usr, "mainwindow", "flash=5")
|
||||
|
||||
@@ -13,23 +13,22 @@
|
||||
init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, undershirt_list, undershirt_m, undershirt_f)
|
||||
//socks
|
||||
init_sprite_accessory_subtypes(/datum/sprite_accessory/socks, socks_list)
|
||||
//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)
|
||||
//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)
|
||||
|
||||
//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)
|
||||
@@ -45,7 +44,6 @@
|
||||
init_sprite_accessory_subtypes(/datum/sprite_accessory/xeno_tail, xeno_tail_list)
|
||||
init_sprite_accessory_subtypes(/datum/sprite_accessory/xeno_dorsal, xeno_dorsal_list)
|
||||
|
||||
|
||||
//Species
|
||||
for(var/spath in subtypesof(/datum/species))
|
||||
var/datum/species/S = new spath()
|
||||
|
||||
@@ -108,39 +108,39 @@
|
||||
|
||||
return adjacencies
|
||||
|
||||
//do not use, use queue_smooth(atom)
|
||||
/proc/smooth_icon(atom/A)
|
||||
if(!A || !A.smooth || !A.z)
|
||||
return
|
||||
if(qdeleted(A))
|
||||
return
|
||||
if((A.smooth & SMOOTH_TRUE) || (A.smooth & SMOOTH_MORE))
|
||||
var/adjacencies = calculate_adjacencies(A)
|
||||
if(!A || !A.smooth)
|
||||
return
|
||||
spawn(0)
|
||||
if((A.smooth & SMOOTH_TRUE) || (A.smooth & SMOOTH_MORE))
|
||||
var/adjacencies = calculate_adjacencies(A)
|
||||
|
||||
if(A.smooth & SMOOTH_DIAGONAL)
|
||||
A.diagonal_smooth(adjacencies)
|
||||
else
|
||||
cardinal_smooth(A, adjacencies)
|
||||
if(A.smooth & SMOOTH_DIAGONAL)
|
||||
A.diagonal_smooth(adjacencies)
|
||||
else
|
||||
cardinal_smooth(A, adjacencies)
|
||||
|
||||
/atom/proc/diagonal_smooth(adjacencies)
|
||||
switch(adjacencies)
|
||||
if(N_NORTH|N_WEST)
|
||||
replace_smooth_overlays("d-se","d-se-0")
|
||||
replace_smooth_overlays("d1-se-0","d2-se","d3-se","d4-se")
|
||||
if(N_NORTH|N_EAST)
|
||||
replace_smooth_overlays("d-sw","d-sw-0")
|
||||
replace_smooth_overlays("d1-sw","d2-sw-0","d3-sw","d4-sw")
|
||||
if(N_SOUTH|N_WEST)
|
||||
replace_smooth_overlays("d-ne","d-ne-0")
|
||||
replace_smooth_overlays("d1-ne","d2-ne","d3-ne-0","d4-ne")
|
||||
if(N_SOUTH|N_EAST)
|
||||
replace_smooth_overlays("d-nw","d-nw-0")
|
||||
replace_smooth_overlays("d1-nw","d2-nw","d3-nw","d4-nw-0")
|
||||
|
||||
if(N_NORTH|N_WEST|N_NORTHWEST)
|
||||
replace_smooth_overlays("d-se","d-se-1")
|
||||
replace_smooth_overlays("d1-se-1","d2-se","d3-se","d4-se")
|
||||
if(N_NORTH|N_EAST|N_NORTHEAST)
|
||||
replace_smooth_overlays("d-sw","d-sw-1")
|
||||
replace_smooth_overlays("d1-sw","d2-sw-1","d3-sw","d4-sw")
|
||||
if(N_SOUTH|N_WEST|N_SOUTHWEST)
|
||||
replace_smooth_overlays("d-ne","d-ne-1")
|
||||
replace_smooth_overlays("d1-ne","d2-ne","d3-ne-1","d4-ne")
|
||||
if(N_SOUTH|N_EAST|N_SOUTHEAST)
|
||||
replace_smooth_overlays("d-nw","d-nw-1")
|
||||
replace_smooth_overlays("d1-nw","d2-nw","d3-nw","d4-nw-1")
|
||||
|
||||
else
|
||||
cardinal_smooth(src, adjacencies)
|
||||
@@ -153,33 +153,25 @@
|
||||
/turf/closed/wall/diagonal_smooth(adjacencies)
|
||||
adjacencies = reverse_ndir(..())
|
||||
if(adjacencies)
|
||||
var/list/U = list()
|
||||
underlays.Cut()
|
||||
if(fixed_underlay)
|
||||
if(fixed_underlay["space"])
|
||||
var/image/I = image('icons/turf/space.dmi', SPACE_ICON_STATE, layer=TURF_LAYER)
|
||||
I.plane = PLANE_SPACE
|
||||
U += I
|
||||
underlays += image('icons/turf/space.dmi', SPACE_ICON_STATE, layer=src.layer)
|
||||
else
|
||||
U += image(fixed_underlay["icon"], fixed_underlay["icon_state"], layer=TURF_LAYER)
|
||||
underlays += image(fixed_underlay["icon"], fixed_underlay["icon_state"], layer=src.layer)
|
||||
else
|
||||
var/turf/T = get_step(src, turn(adjacencies, 180))
|
||||
if(T && (T.density || T.smooth))
|
||||
if(T && T.density)
|
||||
T = get_step(src, turn(adjacencies, 135))
|
||||
if(T && (T.density || T.smooth))
|
||||
if(T && T.density)
|
||||
T = get_step(src, turn(adjacencies, 225))
|
||||
|
||||
if(isspaceturf(T) && !istype(T, /turf/open/space/transit))
|
||||
var/image/I = image('icons/turf/space.dmi', SPACE_ICON_STATE, layer=TURF_LAYER)
|
||||
I.plane = PLANE_SPACE
|
||||
U += I
|
||||
if(istype(T, /turf/open/space))
|
||||
underlays += image('icons/turf/space.dmi', SPACE_ICON_STATE, layer=src.layer)
|
||||
else if(T && !T.density && !T.smooth)
|
||||
U += T
|
||||
else if(baseturf && !initial(baseturf.density) && !initial(baseturf.smooth))
|
||||
U += image(initial(baseturf.icon), initial(baseturf.icon_state), layer=TURF_LAYER)
|
||||
underlays += T
|
||||
else
|
||||
U += DEFAULT_UNDERLAY_IMAGE
|
||||
underlays = U
|
||||
|
||||
underlays += DEFAULT_UNDERLAY_IMAGE
|
||||
|
||||
/proc/cardinal_smooth(atom/A, adjacencies)
|
||||
//NW CORNER
|
||||
@@ -234,31 +226,25 @@
|
||||
else if(adjacencies & N_EAST)
|
||||
se = "4-e"
|
||||
|
||||
var/list/New = list()
|
||||
|
||||
if(A.top_left_corner != nw)
|
||||
A.overlays -= A.top_left_corner
|
||||
A.top_left_corner = nw
|
||||
New += nw
|
||||
A.add_overlay(nw)
|
||||
|
||||
if(A.top_right_corner != ne)
|
||||
A.overlays -= A.top_right_corner
|
||||
A.top_right_corner = ne
|
||||
New += ne
|
||||
A.add_overlay(ne)
|
||||
|
||||
if(A.bottom_right_corner != sw)
|
||||
A.overlays -= A.bottom_right_corner
|
||||
A.bottom_right_corner = sw
|
||||
New += sw
|
||||
A.add_overlay(sw)
|
||||
|
||||
if(A.bottom_left_corner != se)
|
||||
A.overlays -= A.bottom_left_corner
|
||||
A.bottom_left_corner = se
|
||||
New += se
|
||||
|
||||
if(New.len)
|
||||
A.add_overlay(New)
|
||||
|
||||
A.add_overlay(se)
|
||||
|
||||
/proc/find_type_in_direction(atom/source, direction)
|
||||
var/turf/target_turf = get_step(source, direction)
|
||||
@@ -319,16 +305,14 @@
|
||||
|
||||
/atom/proc/replace_smooth_overlays(nw, ne, sw, se)
|
||||
clear_smooth_overlays()
|
||||
var/list/O = list()
|
||||
top_left_corner = nw
|
||||
O += nw
|
||||
add_overlay(nw)
|
||||
top_right_corner = ne
|
||||
O += ne
|
||||
add_overlay(ne)
|
||||
bottom_left_corner = sw
|
||||
O += sw
|
||||
add_overlay(sw)
|
||||
bottom_right_corner = se
|
||||
O += se
|
||||
add_overlay(O)
|
||||
add_overlay(se)
|
||||
|
||||
/proc/reverse_ndir(ndir)
|
||||
switch(ndir)
|
||||
@@ -367,6 +351,19 @@
|
||||
else
|
||||
return 0
|
||||
|
||||
//SSicon_smooth
|
||||
/proc/ss_smooth_icon(atom/A)
|
||||
if(qdeleted(A))
|
||||
return
|
||||
if(!istype(A) || (A && !A.smooth))
|
||||
return
|
||||
if((A.smooth & SMOOTH_TRUE) || (A.smooth & SMOOTH_MORE))
|
||||
var/adjacencies = calculate_adjacencies(A)
|
||||
if(A.smooth & SMOOTH_DIAGONAL)
|
||||
A.diagonal_smooth(adjacencies)
|
||||
else
|
||||
cardinal_smooth(A, adjacencies)
|
||||
|
||||
//SSicon_smooth
|
||||
/proc/queue_smooth_neighbors(atom/A)
|
||||
for(var/V in orange(1,A))
|
||||
@@ -387,5 +384,6 @@
|
||||
name = "smooth wall"
|
||||
icon = 'icons/turf/smooth_wall.dmi'
|
||||
icon_state = "smooth"
|
||||
walltype = "shuttle"
|
||||
smooth = SMOOTH_TRUE|SMOOTH_DIAGONAL|SMOOTH_BORDER
|
||||
canSmoothWith = null
|
||||
|
||||
+3
-31
@@ -199,7 +199,7 @@ mob
|
||||
getFlatIcon(src)
|
||||
Browse_Icon()
|
||||
|
||||
/obj/effect/overlayTest
|
||||
obj/effect/overlayTest
|
||||
icon = 'old_or_unused.dmi'
|
||||
icon_state = "blue"
|
||||
pixel_x = -24
|
||||
@@ -948,8 +948,9 @@ var/global/list/friendly_animal_types = list()
|
||||
overlays += priority_overlays
|
||||
|
||||
/atom/proc/add_overlay(image, priority = 0)
|
||||
if(image in overlays)
|
||||
return
|
||||
var/list/new_overlays = overlays.Copy()
|
||||
new_overlays -= image
|
||||
if(priority)
|
||||
if(!priority_overlays)
|
||||
priority_overlays = list()
|
||||
@@ -1006,32 +1007,3 @@ var/global/list/humanoid_icon_cache = list()
|
||||
//Lame.
|
||||
/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()
|
||||
if(!is_frozen && (initial(icon) && initial(icon_state)))
|
||||
var/index = freeze_icon_index()
|
||||
var/icon/IC
|
||||
var/icon/P = freeze_item_icons[index]
|
||||
if(!P)
|
||||
P = new /icon
|
||||
for(var/iconstate in icon_states(icon))
|
||||
var/icon/O = new('icons/effects/freeze.dmi', "ice_cube")
|
||||
IC = new(icon, iconstate)
|
||||
O.Blend(IC, ICON_ADD)
|
||||
P.Insert(O, iconstate)
|
||||
freeze_item_icons[index] = P
|
||||
icon = P
|
||||
name = "frozen [name]"
|
||||
is_frozen = TRUE
|
||||
|
||||
//Assumes already frozed
|
||||
obj/proc/make_unfrozen()
|
||||
icon = initial(icon)
|
||||
name = replacetext(name, "frozen ", "")
|
||||
is_frozen = FALSE
|
||||
|
||||
+7
-41
@@ -104,8 +104,13 @@
|
||||
|
||||
//Removes any null entries from the list
|
||||
/proc/listclearnulls(list/L)
|
||||
var/list/N = new(L.len)
|
||||
L -= N
|
||||
if(istype(L))
|
||||
var/i=1
|
||||
for(var/thing in L)
|
||||
if(thing != null)
|
||||
++i
|
||||
continue
|
||||
L.Cut(i,i+1)
|
||||
|
||||
/*
|
||||
* Returns list containing all the entries from first list that are not present in second.
|
||||
@@ -223,30 +228,12 @@
|
||||
|
||||
return L
|
||||
|
||||
//same, but returns nothing and acts on list in place
|
||||
/proc/shuffle_inplace(list/L)
|
||||
if(!L)
|
||||
return
|
||||
|
||||
for(var/i=1, i<L.len, ++i)
|
||||
L.Swap(i,rand(i,L.len))
|
||||
|
||||
//Return a list with no duplicate entries
|
||||
/proc/uniqueList(list/L)
|
||||
. = list()
|
||||
for(var/i in L)
|
||||
. |= i
|
||||
|
||||
//same, but returns nothing and acts on list in place (also handles associated values properly)
|
||||
/proc/uniqueList_inplace(list/L)
|
||||
var/temp = L.Copy()
|
||||
L.len = 0
|
||||
for(var/key in temp)
|
||||
if (isnum(key))
|
||||
L |= key
|
||||
else
|
||||
L[key] = temp[key]
|
||||
|
||||
//for sorting clients or mobs by ckey
|
||||
/proc/sortKey(list/L, order=1)
|
||||
return sortTim(L, order >= 0 ? /proc/cmp_ckey_asc : /proc/cmp_ckey_dsc)
|
||||
@@ -405,26 +392,5 @@
|
||||
if(islist(.[i]))
|
||||
.[i] = .(.[i])
|
||||
|
||||
#if DM_VERSION > 512
|
||||
#error Remie said that lummox was adding a way to get a lists
|
||||
#error contents via list.values, if that is true remove this
|
||||
#error otherwise, update the version and bug lummox
|
||||
#elseif
|
||||
//Flattens a keyed list into a list of it's contents
|
||||
/proc/flatten_list(list/key_list)
|
||||
if(!islist(key_list))
|
||||
return null
|
||||
. = list()
|
||||
for(var/key in key_list)
|
||||
. |= key_list[key]
|
||||
|
||||
//Picks from the list, with some safeties, and returns the "default" arg if it fails
|
||||
#define DEFAULTPICK(L, default) ((istype(L, /list) && L:len) ? pick(L) : default)
|
||||
|
||||
#define LAZYINITLIST(L) if (!L) L = list()
|
||||
|
||||
#define UNSETEMPTY(L) if (L && !L.len) L = null
|
||||
#define LAZYREMOVE(L, I) if(L) { L -= I; if(!L.len) { L = null; } }
|
||||
#define LAZYADD(L, I) if(!L) { L = list(); } L += I;
|
||||
#define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= L.len ? L[I] : null) : L[I]) : null)
|
||||
#define LAZYLEN(L) length(L)
|
||||
|
||||
@@ -21,6 +21,7 @@ var/list/sqrtTable = list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
|
||||
return -round(-x / y) * y
|
||||
|
||||
#define Clamp(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) )
|
||||
#define CLAMP01(x) (Clamp(x,0,1))
|
||||
|
||||
// cotangent
|
||||
/proc/Cot(x)
|
||||
|
||||
+77
-82
@@ -63,96 +63,91 @@
|
||||
|
||||
// Color matrices:
|
||||
|
||||
/* Documenting a couple of potentially useful color matrices here to inspire ideas
|
||||
// Greyscale - indentical to saturation @ 0
|
||||
list(LUMA_R,LUMA_R,LUMA_R,0, LUMA_G,LUMA_G,LUMA_G,0, LUMA_B,LUMA_B,LUMA_B,0, 0,0,0,1, 0,0,0,0)
|
||||
//Luma coefficients suggested for HDTVs. If you change these, make sure they add up to 1.
|
||||
#define LUMR 0.2126
|
||||
#define LUMG 0.7152
|
||||
#define LUMB 0.0722
|
||||
|
||||
// Color inversion
|
||||
list(-1,0,0,0, 0,-1,0,0, 0,0,-1,0, 0,0,0,1, 1,1,1,0)
|
||||
//Still need color matrix addition, negation, and multiplication.
|
||||
|
||||
// Sepiatone
|
||||
list(0.393,0.349,0.272,0, 0.769,0.686,0.534,0, 0.189,0.168,0.131,0, 0,0,0,1, 0,0,0,0)
|
||||
*/
|
||||
//Returns an identity color matrix which does nothing
|
||||
/proc/color_identity()
|
||||
return list(1,0,0, 0,1,0, 0,0,1)
|
||||
|
||||
//Does nothing
|
||||
/proc/color_matrix_identity()
|
||||
return list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,0)
|
||||
|
||||
//Adds/subtracts overall lightness
|
||||
//0 is identity, 1 makes everything white, -1 makes everything black
|
||||
/proc/color_matrix_lightness(power)
|
||||
return list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, power,power,power,0)
|
||||
|
||||
//Changes distance hues have from grey while maintaining the overall lightness. Greys are unaffected.
|
||||
//1 is identity, 0 is greyscale, >1 oversaturates colors
|
||||
/proc/color_matrix_saturation(value)
|
||||
var/inv = 1 - value
|
||||
var/R = round(LUMA_R * inv, 0.001)
|
||||
var/G = round(LUMA_G * inv, 0.001)
|
||||
var/B = round(LUMA_B * inv, 0.001)
|
||||
|
||||
return list(R + value,R,R,0, G,G + value,G,0, B,B,B + value,0, 0,0,0,1, 0,0,0,0)
|
||||
|
||||
//Changes distance colors have from rgb(127,127,127) grey
|
||||
//1 is identity. 0 makes everything grey >1 blows out colors and greys
|
||||
/proc/color_matrix_contrast(value)
|
||||
var/add = (1 - value) / 2
|
||||
return list(value,0,0,0, 0,value,0,0, 0,0,value,0, 0,0,0,1, add,add,add,0)
|
||||
|
||||
//Moves all colors angle degrees around the color wheel while maintaining intensity of the color and not affecting greys
|
||||
//0 is identity, 120 moves reds to greens, 240 moves reds to blues
|
||||
/proc/color_matrix_rotate_hue(angle)
|
||||
var/sin = sin(angle)
|
||||
//Moves all colors angle degrees around the color wheel while maintaining intensity of the color and not affecting whites
|
||||
//TODO: Need a version that only affects one color (ie shift red to blue but leave greens and blues alone)
|
||||
/proc/color_rotation(angle)
|
||||
if(angle == 0)
|
||||
return color_identity()
|
||||
angle = Clamp(angle, -180, 180)
|
||||
var/cos = cos(angle)
|
||||
var/cos_inv_third = 0.333*(1-cos)
|
||||
var/sqrt3_sin = sqrt(3)*sin
|
||||
var/sin = sin(angle)
|
||||
|
||||
var/constA = 0.143
|
||||
var/constB = 0.140
|
||||
var/constC = -0.283
|
||||
return list(
|
||||
round(cos+cos_inv_third, 0.001), round(cos_inv_third+sqrt3_sin, 0.001), round(cos_inv_third-sqrt3_sin, 0.001), 0,
|
||||
round(cos_inv_third-sqrt3_sin, 0.001), round(cos+cos_inv_third, 0.001), round(cos_inv_third+sqrt3_sin, 0.001), 0,
|
||||
round(cos_inv_third+sqrt3_sin, 0.001), round(cos_inv_third-sqrt3_sin, 0.001), round(cos+cos_inv_third, 0.001), 0,
|
||||
0,0,0,1,
|
||||
0,0,0,0)
|
||||
LUMR + cos * (1-LUMR) + sin * -LUMR, LUMR + cos * -LUMR + sin * constA, LUMR + cos * -LUMR + sin * -(1-LUMR),
|
||||
LUMG + cos * -LUMG + sin * -LUMG, LUMG + cos * (1-LUMG) + sin * constB, LUMG + cos * -LUMG + sin * LUMG,
|
||||
LUMB + cos * -LUMB + sin * (1-LUMB), LUMB + cos * -LUMB + sin * constC, LUMB + cos * (1-LUMB) + sin * LUMB
|
||||
)
|
||||
|
||||
//These next three rotate values about one axis only
|
||||
//x is the red axis, y is the green axis, z is the blue axis.
|
||||
/proc/color_matrix_rotate_x(angle)
|
||||
var/sinval = round(sin(angle), 0.001); var/cosval = round(cos(angle), 0.001)
|
||||
return list(1,0,0,0, 0,cosval,sinval,0, 0,-sinval,cosval,0, 0,0,0,1, 0,0,0,0)
|
||||
//Makes everything brighter or darker without regard to existing color or brightness
|
||||
/proc/color_brightness(power)
|
||||
power = Clamp(power, -255, 255)
|
||||
power = power/255
|
||||
|
||||
/proc/color_matrix_rotate_y(angle)
|
||||
var/sinval = round(sin(angle), 0.001); var/cosval = round(cos(angle), 0.001)
|
||||
return list(cosval,0,-sinval,0, 0,1,0,0, sinval,0,cosval,0, 0,0,0,1, 0,0,0,0)
|
||||
return list(1,0,0, 0,1,0, 0,0,1, power,power,power)
|
||||
|
||||
/proc/color_matrix_rotate_z(angle)
|
||||
var/sinval = round(sin(angle), 0.001); var/cosval = round(cos(angle), 0.001)
|
||||
return list(cosval,sinval,0,0, -sinval,cosval,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,0)
|
||||
/var/list/delta_index = list(
|
||||
0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11,
|
||||
0.12, 0.14, 0.15, 0.16, 0.17, 0.18, 0.20, 0.21, 0.22, 0.24,
|
||||
0.25, 0.27, 0.28, 0.30, 0.32, 0.34, 0.36, 0.38, 0.40, 0.42,
|
||||
0.44, 0.46, 0.48, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68,
|
||||
0.71, 0.74, 0.77, 0.80, 0.83, 0.86, 0.89, 0.92, 0.95, 0.98,
|
||||
1.0, 1.06, 1.12, 1.18, 1.24, 1.30, 1.36, 1.42, 1.48, 1.54,
|
||||
1.60, 1.66, 1.72, 1.78, 1.84, 1.90, 1.96, 2.0, 2.12, 2.25,
|
||||
2.37, 2.50, 2.62, 2.75, 2.87, 3.0, 3.2, 3.4, 3.6, 3.8,
|
||||
4.0, 4.3, 4.7, 4.9, 5.0, 5.5, 6.0, 6.5, 6.8, 7.0,
|
||||
7.3, 7.5, 7.8, 8.0, 8.4, 8.7, 9.0, 9.4, 9.6, 9.8,
|
||||
10.0)
|
||||
|
||||
//Exxagerates or removes brightness
|
||||
/proc/color_contrast(value)
|
||||
value = Clamp(value, -100, 100)
|
||||
if(value == 0)
|
||||
return color_identity()
|
||||
|
||||
//Returns a matrix addition of A with B
|
||||
/proc/color_matrix_add(list/A, list/B)
|
||||
if(!istype(A) || !istype(B))
|
||||
return color_matrix_identity()
|
||||
if(A.len != 20 || B.len != 20)
|
||||
return color_matrix_identity()
|
||||
var/list/output = list()
|
||||
output.len = 20
|
||||
for(var/value in 1 to 20)
|
||||
output[value] = A[value] + B[value]
|
||||
return output
|
||||
var/x = 0
|
||||
if (value < 0)
|
||||
x = 127 + value / 100 * 127;
|
||||
else
|
||||
x = value % 1
|
||||
if(x == 0)
|
||||
x = delta_index[value]
|
||||
else
|
||||
x = delta_index[value] * (1-x) + delta_index[value+1] * x//use linear interpolation for more granularity.
|
||||
x = x * 127 + 127
|
||||
|
||||
//Returns a matrix multiplication of A with B
|
||||
/proc/color_matrix_multiply(list/A, list/B)
|
||||
if(!istype(A) || !istype(B))
|
||||
return color_matrix_identity()
|
||||
if(A.len != 20 || B.len != 20)
|
||||
return color_matrix_identity()
|
||||
var/list/output = list()
|
||||
output.len = 20
|
||||
var/x = 1
|
||||
var/y = 1
|
||||
var/offset = 0
|
||||
for(y in 1 to 5)
|
||||
offset = (y-1)*4
|
||||
for(x in 1 to 4)
|
||||
output[offset+x] = round(A[offset+1]*B[x] + A[offset+2]*B[x+4] + A[offset+3]*B[x+8] + A[offset+4]*B[x+12]+(y==5?B[x+16]:0), 0.001)
|
||||
return output
|
||||
var/mult = x / 127
|
||||
var/add = 0.5 * (127-x) / 255
|
||||
return list(mult,0,0, 0,mult,0, 0,0,mult, add,add,add)
|
||||
|
||||
//Exxagerates or removes colors
|
||||
/proc/color_saturation(value as num)
|
||||
if(value == 0)
|
||||
return color_identity()
|
||||
value = Clamp(value, -100, 100)
|
||||
if(value > 0)
|
||||
value *= 3
|
||||
var/x = 1 + value / 100
|
||||
var/inv = 1 - x
|
||||
var/R = LUMR * inv
|
||||
var/G = LUMG * inv
|
||||
var/B = LUMB * inv
|
||||
|
||||
return list(R + x,R,R, G,G + x,G, B,B,B + x)
|
||||
|
||||
#undef LUMR
|
||||
#undef LUMG
|
||||
#undef LUMB
|
||||
|
||||
+23
-64
@@ -62,15 +62,13 @@
|
||||
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)
|
||||
|
||||
//For now we will always return none for tail_human and ears.
|
||||
return(list("mcolor" = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F"), "tail_lizard" = pick(tails_list_lizard), "tail_human" = "None", "wings" = "None", "snout" = pick(snouts_list), "horns" = pick(horns_list), "ears" = "None", "frills" = pick(frills_list), "spines" = pick(spines_list), "body_markings" = pick(body_markings_list), "legs" = "Normal Legs"))
|
||||
return(list("mcolor" = pick("FFFFFF","7F7F7F", "7FFF7F", "7F7FFF", "FF7F7F", "7FFFFF", "FF7FFF", "FFFF7F"), "tail_lizard" = pick(tails_list_lizard), "tail_human" = "None", "wings" = "None", "snout" = pick(snouts_list), "horns" = pick(horns_list), "ears" = "None", "frills" = pick(frills_list), "spines" = pick(spines_list), "body_markings" = pick(body_markings_list)))
|
||||
|
||||
/proc/random_hair_style(gender)
|
||||
switch(gender)
|
||||
@@ -107,13 +105,6 @@
|
||||
if(i != attempts_to_find_unique_name && !findname(.))
|
||||
break
|
||||
|
||||
/proc/random_unique_plasmaman_name(attempts_to_find_unique_name=10)
|
||||
for(var/i=1, i<=attempts_to_find_unique_name, i++)
|
||||
. = capitalize(plasmaman_name())
|
||||
|
||||
if(i != attempts_to_find_unique_name && !findname(.))
|
||||
break
|
||||
|
||||
/proc/random_skin_tone()
|
||||
return pick(skin_tones)
|
||||
|
||||
@@ -133,6 +124,7 @@ var/list/skin_tones = list(
|
||||
)
|
||||
|
||||
var/global/list/species_list[0]
|
||||
var/global/list/whitelisted_species_list[0]
|
||||
var/global/list/roundstart_species[0]
|
||||
|
||||
/proc/age2agedescription(age)
|
||||
@@ -169,30 +161,24 @@ Proc for attack log creation, because really why not
|
||||
*/
|
||||
|
||||
/proc/add_logs(mob/user, mob/target, what_done, object=null, addition=null)
|
||||
var/newhealthtxt = ""
|
||||
var/coordinates = ""
|
||||
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/mob/living/living_target
|
||||
|
||||
|
||||
if(attack_location)
|
||||
coordinates = "([attack_location.x],[attack_location.y],[attack_location.z])"
|
||||
if(target && isliving(target))
|
||||
living_target = target
|
||||
|
||||
if(is_mob_user)
|
||||
var/message = "\[[time_stamp()]\] <font color='red'>[user ? "[user.name][(user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"] 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>"
|
||||
user.attack_log += message
|
||||
var/mob/living/L = target
|
||||
newhealthtxt = " (NEWHP: [L.health])"
|
||||
if(user && ismob(user))
|
||||
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Has [what_done] [target ? "[target.name][(ismob(target) && target.ckey) ? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt][coordinates]</font>")
|
||||
if(user.mind)
|
||||
user.mind.attack_log += message
|
||||
|
||||
if(is_mob_target)
|
||||
var/message = "\[[time_stamp()]\] <font color='orange'>[target ? "[target.name][(target.ckey) ? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"] 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>"
|
||||
target.attack_log += message
|
||||
user.mind.attack_log += text("\[[time_stamp()]\] <font color='red'>[user ? "[user.name][(ismob(user) && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"] has [what_done] [target ? "[target.name][(ismob(target) && target.ckey) ? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt][coordinates]</font>")
|
||||
if(target && ismob(target))
|
||||
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been [what_done] by [user ? "[user.name][(ismob(user) && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt][coordinates]</font>")
|
||||
if(target.mind)
|
||||
target.mind.attack_log += message
|
||||
target.mind.attack_log += text("\[[time_stamp()]\] <font color='orange'>[target ? "[target.name][(ismob(target) && target.ckey) ? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"] has been [what_done] by [user ? "[user.name][(ismob(user) && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt][coordinates]</font>")
|
||||
log_attack("[user ? "[user.name][(ismob(user) && user.ckey) ? "([user.ckey])" : ""]" : "NON-EXISTANT SUBJECT"] [what_done] [target ? "[target.name][(ismob(target) && target.ckey)? "([target.ckey])" : ""]" : "NON-EXISTANT SUBJECT"][object ? " with [object]" : " "][addition][newhealthtxt][coordinates]")
|
||||
|
||||
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])" : ""]")
|
||||
|
||||
|
||||
/proc/do_mob(mob/user , mob/target, time = 30, uninterruptible = 0, progress = 1)
|
||||
@@ -206,7 +192,7 @@ Proc for attack log creation, because really why not
|
||||
|
||||
var/target_loc = target.loc
|
||||
|
||||
var/holding = user.get_active_held_item()
|
||||
var/holding = user.get_active_hand()
|
||||
var/datum/progressbar/progbar
|
||||
if (progress)
|
||||
progbar = new(user, time, target)
|
||||
@@ -228,7 +214,7 @@ Proc for attack log creation, because really why not
|
||||
drifting = 0
|
||||
user_loc = user.loc
|
||||
|
||||
if((!drifting && user.loc != user_loc) || target.loc != target_loc || user.get_active_held_item() != holding || user.incapacitated() || user.lying )
|
||||
if((!drifting && user.loc != user_loc) || target.loc != target_loc || user.get_active_hand() != holding || user.incapacitated() || user.lying )
|
||||
. = 0
|
||||
break
|
||||
if (progress)
|
||||
@@ -248,7 +234,7 @@ Proc for attack log creation, because really why not
|
||||
if(!user.Process_Spacemove(0) && user.inertia_dir)
|
||||
drifting = 1
|
||||
|
||||
var/holding = user.get_active_held_item()
|
||||
var/holding = user.get_active_hand()
|
||||
|
||||
var/holdingnull = 1 //User's hand started out empty, check for an empty hand
|
||||
if(holding)
|
||||
@@ -285,7 +271,7 @@ Proc for attack log creation, because really why not
|
||||
if(!holding)
|
||||
. = 0
|
||||
break
|
||||
if(user.get_active_held_item() != holding)
|
||||
if(user.get_active_hand() != holding)
|
||||
. = 0
|
||||
break
|
||||
if (progress)
|
||||
@@ -306,7 +292,7 @@ Proc for attack log creation, because really why not
|
||||
for(var/atom/target in targets)
|
||||
originalloc[target] = target.loc
|
||||
|
||||
var/holding = user.get_active_held_item()
|
||||
var/holding = user.get_active_hand()
|
||||
var/datum/progressbar/progbar
|
||||
if(progress)
|
||||
progbar = new(user, time, targets[1])
|
||||
@@ -330,7 +316,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 )
|
||||
if((!drifting && user_loc != user.loc) || originalloc[target] != target.loc || user.get_active_hand() != holding || user.incapacitated() || user.lying )
|
||||
. = 0
|
||||
break mainloop
|
||||
if(progbar)
|
||||
@@ -343,33 +329,6 @@ Proc for attack log creation, because really why not
|
||||
if(H.dna && istype(H.dna.species, species_datum))
|
||||
. = TRUE
|
||||
|
||||
/proc/spawn_atom_to_turf(spawn_type, target, amount, admin_spawn=FALSE)
|
||||
var/turf/T = get_turf(target)
|
||||
if(!T)
|
||||
throw EXCEPTION("attempt to spawn atom type: [spawn_type] in nullspace")
|
||||
|
||||
for(var/j in 1 to amount)
|
||||
var/atom/X = new spawn_type(T)
|
||||
X.admin_spawned = admin_spawn
|
||||
|
||||
/proc/spawn_and_random_walk(spawn_type, target, amount, walk_chance=100, max_walk=3, always_max_walk=FALSE, admin_spawn=FALSE)
|
||||
var/turf/T = get_turf(target)
|
||||
var/step_count = 0
|
||||
if(!T)
|
||||
throw EXCEPTION("attempt to spawn atom type: [spawn_type] in nullspace")
|
||||
|
||||
for(var/j in 1 to amount)
|
||||
var/atom/movable/X = new spawn_type(T)
|
||||
X.admin_spawned = admin_spawn
|
||||
|
||||
if(always_max_walk || prob(walk_chance))
|
||||
if(always_max_walk)
|
||||
step_count = max_walk
|
||||
else
|
||||
step_count = rand(1, max_walk)
|
||||
|
||||
for(var/i in 1 to step_count)
|
||||
step(X, pick(NORTH, SOUTH, EAST, WEST))
|
||||
|
||||
/proc/deadchat_broadcast(message, mob/follow_target=null, speaker_key=null, message_type=DEADCHAT_REGULAR)
|
||||
for(var/mob/M in player_list)
|
||||
@@ -382,7 +341,7 @@ Proc for attack log creation, because really why not
|
||||
var/adminoverride = 0
|
||||
if(M.client && M.client.holder && (prefs.chat_toggles & CHAT_DEAD))
|
||||
adminoverride = 1
|
||||
if(isnewplayer(M) && !adminoverride)
|
||||
if(istype(M, /mob/new_player) && !adminoverride)
|
||||
continue
|
||||
if(M.stat != DEAD && !adminoverride)
|
||||
continue
|
||||
@@ -397,7 +356,7 @@ Proc for attack log creation, because really why not
|
||||
if(prefs.toggles & DISABLE_ARRIVALRATTLE)
|
||||
continue
|
||||
|
||||
if(isobserver(M) && follow_target)
|
||||
if(istype(M, /mob/dead/observer) && follow_target)
|
||||
var/link = FOLLOW_LINK(M, follow_target)
|
||||
M << "[link] [message]"
|
||||
else
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
else
|
||||
return "[pick(lizard_names_female)]-[pick(lizard_names_female)]"
|
||||
|
||||
/proc/plasmaman_name()
|
||||
return "[pick(plasmaman_names)] \Roman[rand(1,99)]"
|
||||
|
||||
var/church_name = null
|
||||
/proc/church_name()
|
||||
@@ -102,7 +100,7 @@ var/religion_name = null
|
||||
if(2)
|
||||
new_station_name += pick(greek_letters)
|
||||
if(3)
|
||||
new_station_name += "\Roman[rand(1,99)]"
|
||||
new_station_name += pick(roman_numerals)
|
||||
if(4)
|
||||
new_station_name += pick(phonetic_alphabet)
|
||||
if(5)
|
||||
@@ -172,7 +170,7 @@ var/syndicate_code_response//Code response for traitors.
|
||||
|
||||
var/safety[] = list(1,2,3)//Tells the proc which options to remove later on.
|
||||
var/nouns[] = list("love","hate","anger","peace","pride","sympathy","bravery","loyalty","honesty","integrity","compassion","charity","success","courage","deceit","skill","beauty","brilliance","pain","misery","beliefs","dreams","justice","truth","faith","liberty","knowledge","thought","information","culture","trust","dedication","progress","education","hospitality","leisure","trouble","friendships", "relaxation")
|
||||
var/drinks[] = list("vodka and tonic","gin fizz","bahama mama","manhattan","black Russian","whiskey soda","long island iced tea","margarita","Irish coffee"," manly dwarf","Irish cream","doctor's delight","Beepksy Smash","tequila sunrise","brave bull","gargle blaster","bloody mary","whiskey cola","white Russian","vodka martini","martini","Cuba libre","kahlua","vodka","wine","moonshine")
|
||||
var/drinks[] = list("vodka and tonic","gin fizz","bahama mama","manhattan","black Russian","whiskey soda","long island tea","margarita","Irish coffee"," manly dwarf","Irish cream","doctor's delight","Beepksy Smash","tequila sunrise","brave bull","gargle blaster","bloody mary","whiskey cola","white Russian","vodka martini","martini","Cuba libre","kahlua","vodka","wine","moonshine")
|
||||
var/locations[] = teleportlocs.len ? teleportlocs : drinks//if null, defaults to drinks instead.
|
||||
|
||||
var/names[] = list()
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
//pronoun procs, for getting pronouns without using the text macros that only work in certain positions
|
||||
//datums don't have gender, but most of their subtypes do!
|
||||
/datum/proc/p_they(capitalized, temp_gender)
|
||||
. = "it"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/datum/proc/p_their(capitalized, temp_gender)
|
||||
. = "its"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/datum/proc/p_them(capitalized, temp_gender)
|
||||
. = "it"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/datum/proc/p_have(temp_gender)
|
||||
. = "has"
|
||||
|
||||
/datum/proc/p_are(temp_gender)
|
||||
. = "is"
|
||||
|
||||
/datum/proc/p_were(temp_gender)
|
||||
. = "was"
|
||||
|
||||
/datum/proc/p_do(temp_gender)
|
||||
. = "does"
|
||||
|
||||
/datum/proc/p_theyve(capitalized, temp_gender)
|
||||
. = p_they(capitalized, temp_gender) + "'" + copytext(p_have(temp_gender), 3)
|
||||
|
||||
/datum/proc/p_theyre(capitalized, temp_gender)
|
||||
. = p_they(capitalized, temp_gender) + "'" + copytext(p_are(temp_gender), 2)
|
||||
|
||||
/datum/proc/p_s(temp_gender) //is this a descriptive proc name, or what?
|
||||
. = "s"
|
||||
|
||||
//like clients, which do have gender.
|
||||
/client/p_they(capitalized, temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "they"
|
||||
switch(temp_gender)
|
||||
if(FEMALE)
|
||||
. = "she"
|
||||
if(MALE)
|
||||
. = "he"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/client/p_their(capitalized, temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "their"
|
||||
switch(temp_gender)
|
||||
if(FEMALE)
|
||||
. = "her"
|
||||
if(MALE)
|
||||
. = "his"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/client/p_them(capitalized, temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "them"
|
||||
switch(temp_gender)
|
||||
if(FEMALE)
|
||||
. = "her"
|
||||
if(MALE)
|
||||
. = "him"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/client/p_have(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "has"
|
||||
if(temp_gender == PLURAL || temp_gender == NEUTER)
|
||||
. = "have"
|
||||
|
||||
/client/p_are(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "is"
|
||||
if(temp_gender == PLURAL || temp_gender == NEUTER)
|
||||
. = "are"
|
||||
|
||||
/client/p_were(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "was"
|
||||
if(temp_gender == PLURAL || temp_gender == NEUTER)
|
||||
. = "were"
|
||||
|
||||
/client/p_do(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "does"
|
||||
if(temp_gender == PLURAL || temp_gender == NEUTER)
|
||||
. = "do"
|
||||
|
||||
/client/p_s(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
if(temp_gender != PLURAL && temp_gender != NEUTER)
|
||||
. = "s"
|
||||
|
||||
//mobs(and atoms but atoms don't really matter write your own proc overrides) also have gender!
|
||||
/mob/p_they(capitalized, temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "it"
|
||||
switch(temp_gender)
|
||||
if(FEMALE)
|
||||
. = "she"
|
||||
if(MALE)
|
||||
. = "he"
|
||||
if(PLURAL)
|
||||
. = "they"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/mob/p_their(capitalized, temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "its"
|
||||
switch(temp_gender)
|
||||
if(FEMALE)
|
||||
. = "her"
|
||||
if(MALE)
|
||||
. = "his"
|
||||
if(PLURAL)
|
||||
. = "their"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/mob/p_them(capitalized, temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "it"
|
||||
switch(temp_gender)
|
||||
if(FEMALE)
|
||||
. = "her"
|
||||
if(MALE)
|
||||
. = "him"
|
||||
if(PLURAL)
|
||||
. = "them"
|
||||
if(capitalized)
|
||||
. = capitalize(.)
|
||||
|
||||
/mob/p_have(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "has"
|
||||
if(temp_gender == PLURAL)
|
||||
. = "have"
|
||||
|
||||
/mob/p_are(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "is"
|
||||
if(temp_gender == PLURAL)
|
||||
. = "are"
|
||||
|
||||
/mob/p_were(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "was"
|
||||
if(temp_gender == PLURAL)
|
||||
. = "were"
|
||||
|
||||
/mob/p_do(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
. = "does"
|
||||
if(temp_gender == PLURAL)
|
||||
. = "do"
|
||||
|
||||
/mob/p_s(temp_gender)
|
||||
if(!temp_gender)
|
||||
temp_gender = gender
|
||||
if(temp_gender != PLURAL)
|
||||
. = "s"
|
||||
|
||||
//humans need special handling, because they can have their gender hidden
|
||||
/mob/living/carbon/human/p_they(capitalized, temp_gender)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
if((slot_w_uniform in obscured) && skipface)
|
||||
temp_gender = PLURAL
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/p_their(capitalized, temp_gender)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
if((slot_w_uniform in obscured) && skipface)
|
||||
temp_gender = PLURAL
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/p_them(capitalized, temp_gender)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
if((slot_w_uniform in obscured) && skipface)
|
||||
temp_gender = PLURAL
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/p_have(temp_gender)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
if((slot_w_uniform in obscured) && skipface)
|
||||
temp_gender = PLURAL
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/p_are(temp_gender)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
if((slot_w_uniform in obscured) && skipface)
|
||||
temp_gender = PLURAL
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/p_were(temp_gender)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
if((slot_w_uniform in obscured) && skipface)
|
||||
temp_gender = PLURAL
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/p_do(temp_gender)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
if((slot_w_uniform in obscured) && skipface)
|
||||
temp_gender = PLURAL
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/p_s(temp_gender)
|
||||
var/list/obscured = check_obscured_slots()
|
||||
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
|
||||
if((slot_w_uniform in obscured) && skipface)
|
||||
temp_gender = PLURAL
|
||||
return ..()
|
||||
+54
-98
@@ -421,110 +421,66 @@ var/list/binary = list("0","1")
|
||||
|
||||
return t
|
||||
|
||||
#define string2charlist(string) (splittext(string, regex("(.)")) - splittext(string, ""))
|
||||
/proc/char_split(t)
|
||||
. = list()
|
||||
for(var/x in 1 to length(t))
|
||||
. += copytext(t,x,x+1)
|
||||
|
||||
/proc/rot13(text = "")
|
||||
var/list/textlist = string2charlist(text)
|
||||
var/list/result = list()
|
||||
for(var/c in textlist)
|
||||
var/ca = text2ascii(c)
|
||||
if(ca >= text2ascii("a") && ca <= text2ascii("m"))
|
||||
ca += 13
|
||||
else if(ca >= text2ascii("n") && ca <= text2ascii("z"))
|
||||
ca -= 13
|
||||
else if(ca >= text2ascii("A") && ca <= text2ascii("M"))
|
||||
ca += 13
|
||||
else if(ca >= text2ascii("N") && ca <= text2ascii("Z"))
|
||||
ca -= 13
|
||||
result += ascii2text(ca)
|
||||
return jointext(result, "")
|
||||
var/list/rot13_lookup = list()
|
||||
|
||||
//Takes a list of values, sanitizes it down for readability and character count,
|
||||
//then exports it as a json file at data/npc_saves/[filename].json.
|
||||
//As far as SS13 is concerned this is write only data. You can't change something
|
||||
//in the json file and have it be reflected in the in game item/mob it came from.
|
||||
//(That's what things like savefiles are for) Note that this list is not shuffled.
|
||||
/proc/twitterize(list/proposed, filename, cullshort = 0, storemax = 1000)
|
||||
if(!islist(proposed) || !filename || !config.log_twitter)
|
||||
return
|
||||
/proc/generate_rot13_lookup()
|
||||
var/letters = alphabet.Copy()
|
||||
for(var/c in alphabet)
|
||||
letters += uppertext(c)
|
||||
|
||||
//Regular expressions are, as usual, absolute magic
|
||||
var/regex/is_website = new("http|www.|\[a-z0-9_-]+.(com|org|net|mil|edu)+", "i")
|
||||
var/regex/is_email = new("\[a-z0-9_-]+@\[a-z0-9_-]+.\[a-z0-9_-]+", "i")
|
||||
var/regex/alphanumeric = new("\[a-z0-9]+", "i")
|
||||
var/regex/punctuation = new("\[.!?]+", "i")
|
||||
var/regex/all_invalid_symbols = new("\[^ -~]+")
|
||||
for(var/char in letters)
|
||||
var/ascii_char = text2ascii(char, 1)
|
||||
|
||||
var/list/accepted = list()
|
||||
for(var/string in proposed)
|
||||
if(findtext(string,is_website) || findtext(string,is_email) || findtext(string,all_invalid_symbols))
|
||||
continue
|
||||
var/buffer = ""
|
||||
var/early_culling = TRUE
|
||||
for(var/pos = 1, pos != lentext(string), pos++)
|
||||
var/let = copytext(string, pos, (pos + 1) % lentext(string))
|
||||
if(early_culling && !findtext(let,alphanumeric))
|
||||
continue
|
||||
early_culling = FALSE
|
||||
buffer += let
|
||||
var/punctbuffer = ""
|
||||
var/cutoff = lentext(buffer)
|
||||
for(var/pos = lentext(buffer), pos != 0, pos--)
|
||||
var/let = copytext(buffer, pos, (pos + 1) % lentext(buffer))
|
||||
if(findtext(let,alphanumeric))
|
||||
break
|
||||
if(findtext(let,punctuation))
|
||||
punctbuffer = let + punctbuffer //Note this isn't the same thing as using +=
|
||||
cutoff = pos
|
||||
if(punctbuffer) //We clip down excessive punctuation to get the letter count lower and reduce repeats. It's not perfect but it helps.
|
||||
var/exclaim = FALSE
|
||||
var/question = FALSE
|
||||
var/periods = 0
|
||||
for(var/pos = lentext(punctbuffer), pos != 0, pos--)
|
||||
var/punct = copytext(buffer, pos, (pos + 1) % lentext(buffer))
|
||||
if(!exclaim && punct == "!")
|
||||
exclaim = TRUE
|
||||
if(!question && punct == "?")
|
||||
question = TRUE
|
||||
if(!exclaim && !question && punct == ".")
|
||||
periods += 1
|
||||
if(exclaim)
|
||||
if(question)
|
||||
punctbuffer = "?!"
|
||||
else
|
||||
punctbuffer = "!"
|
||||
else if(question)
|
||||
punctbuffer = "?"
|
||||
else if(periods)
|
||||
if(periods >= 3)
|
||||
punctbuffer = "..."
|
||||
else
|
||||
punctbuffer = "" //Grammer nazis be damned
|
||||
buffer = copytext(buffer, 1, cutoff) + punctbuffer
|
||||
var/index
|
||||
|
||||
if(!buffer || lentext(buffer) > 140 || lentext(buffer) <= cullshort || buffer in accepted)
|
||||
continue
|
||||
switch(ascii_char)
|
||||
// A - Z
|
||||
if(65 to 90)
|
||||
index = 65
|
||||
// a - z
|
||||
if(97 to 122)
|
||||
index = 97
|
||||
|
||||
accepted += buffer
|
||||
var/d = ascii_char - index
|
||||
d += 13
|
||||
if(d >= 26)
|
||||
d -= 26
|
||||
ascii_char = index + d
|
||||
var/translated_char = ascii2text(ascii_char)
|
||||
|
||||
var/log = file("data/npc_saves/[filename].json") //If this line ever shows up as changed in a PR be very careful you aren't being memed on
|
||||
var/list/oldjson = list()
|
||||
var/list/oldentries = list()
|
||||
if(fexists(log))
|
||||
oldjson = json_decode(file2text(log))
|
||||
oldentries = oldjson["data"]
|
||||
if(!isemptylist(oldentries))
|
||||
for(var/string in accepted)
|
||||
for(var/old in oldentries)
|
||||
if(string == old)
|
||||
oldentries.Remove(old) //Line's position in line is "refreshed" until it falls off the in game radar
|
||||
break
|
||||
rot13_lookup[char] = translated_char
|
||||
|
||||
var/list/finalized = list()
|
||||
finalized["data"] = accepted.Copy() + oldentries.Copy() //we keep old and unreferenced phrases near the bottom for culling
|
||||
listclearnulls(finalized)
|
||||
if(!isemptylist(finalized) && finalized.len > storemax)
|
||||
finalized.Cut(storemax + 1)
|
||||
fdel(log)
|
||||
/proc/rot13(t_in)
|
||||
if(!rot13_lookup.len)
|
||||
generate_rot13_lookup()
|
||||
|
||||
log << json_encode(finalized)
|
||||
var/t_out = ""
|
||||
|
||||
for(var/i in 1 to length(t_in))
|
||||
var/char = copytext(t_in, i, i + 1)
|
||||
if(char in rot13_lookup)
|
||||
t_out += rot13_lookup[char]
|
||||
else
|
||||
t_out += char
|
||||
|
||||
return t_out
|
||||
|
||||
//Used in preferences' SetFlavorText and human's set_flavor verb
|
||||
//Previews a string of len or less length
|
||||
|
||||
/proc/copytext_preserve_html(var/text, var/first, var/last)
|
||||
return html_encode(copytext(html_decode(text), first, last))
|
||||
|
||||
proc/TextPreview(var/string,var/len=40)
|
||||
if(lentext(string) <= len)
|
||||
if(!lentext(string))
|
||||
return "\[...\]"
|
||||
else
|
||||
return string
|
||||
else
|
||||
return "[copytext(string, 1, 37)]..."
|
||||
@@ -7,12 +7,3 @@
|
||||
t = copytext(t, 1, index) + repl_chars[char] + copytext(t, index+5)
|
||||
index = findtext(t, char)
|
||||
return t
|
||||
|
||||
proc/TextPreview(var/string,var/len=40)
|
||||
if(lentext(string) <= len)
|
||||
if(!lentext(string))
|
||||
return "\[...\]"
|
||||
else
|
||||
return string
|
||||
else
|
||||
return "[copytext(string, 1, 37)]..."
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
return time2text(world.timeofday, format)
|
||||
|
||||
/proc/gameTimestamp(format = "hh:mm:ss") // Get the game time in text
|
||||
return time2text(world.time - timezoneOffset + 432000 - round_start_time, format)
|
||||
return time2text(world.time - timezoneOffset + 432000, format)
|
||||
|
||||
/* Returns 1 if it is the selected month and day */
|
||||
/proc/isDay(month, day)
|
||||
|
||||
+71
-21
@@ -225,8 +225,6 @@
|
||||
return 'icons/mob/screen_slimecore.dmi'
|
||||
if("Operative")
|
||||
return 'icons/mob/screen_operative.dmi'
|
||||
if("Clockwork")
|
||||
return 'icons/mob/screen_clockwork.dmi'
|
||||
else
|
||||
return 'icons/mob/screen_midnight.dmi'
|
||||
|
||||
@@ -349,6 +347,55 @@ for(var/t in test_times)
|
||||
/proc/isLeap(y)
|
||||
return ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
|
||||
|
||||
// A copy of text2dir, extended to accept one and two letter
|
||||
// directions, and to clearly return 0 otherwise.
|
||||
/proc/text2dir_extended(direction)
|
||||
switch(uppertext(direction))
|
||||
if("NORTH", "N")
|
||||
return 1
|
||||
if("SOUTH", "S")
|
||||
return 2
|
||||
if("EAST", "E")
|
||||
return 4
|
||||
if("WEST", "W")
|
||||
return 8
|
||||
if("NORTHEAST", "NE")
|
||||
return 5
|
||||
if("NORTHWEST", "NW")
|
||||
return 9
|
||||
if("SOUTHEAST", "SE")
|
||||
return 6
|
||||
if("SOUTHWEST", "SW")
|
||||
return 10
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
// A copy of dir2text, which returns the short one or two letter
|
||||
// directions used in tube icon states.
|
||||
/proc/dir2text_short(direction)
|
||||
switch(direction)
|
||||
if(1)
|
||||
return "N"
|
||||
if(2)
|
||||
return "S"
|
||||
if(4)
|
||||
return "E"
|
||||
if(8)
|
||||
return "W"
|
||||
if(5)
|
||||
return "NE"
|
||||
if(6)
|
||||
return "SE"
|
||||
if(9)
|
||||
return "NW"
|
||||
if(10)
|
||||
return "SW"
|
||||
else
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
//Turns a Body_parts_covered bitfield into a list of organ/limb names.
|
||||
@@ -527,23 +574,26 @@ for(var/t in test_times)
|
||||
var/B = hex2num(copytext(A,6,0))
|
||||
return R+G+B
|
||||
|
||||
//word of warning: using a matrix like this as a color value will simplify it back to a string after being set
|
||||
/proc/color_hex2color_matrix(string)
|
||||
var/length = length(string)
|
||||
if(length != 7 && length != 9)
|
||||
return color_matrix_identity()
|
||||
var/r = hex2num(copytext(string, 2, 4))/255
|
||||
var/g = hex2num(copytext(string, 4, 6))/255
|
||||
var/b = hex2num(copytext(string, 6, 8))/255
|
||||
var/a = 1
|
||||
if(length == 9)
|
||||
a = hex2num(copytext(string, 8, 10))/255
|
||||
if(!isnum(r) || !isnum(g) || !isnum(b) || !isnum(a))
|
||||
return color_matrix_identity()
|
||||
return list(r,0,0,0, 0,g,0,0, 0,0,b,0, 0,0,0,a, 0,0,0,0)
|
||||
//get just one color
|
||||
/proc/GetRedPart(A)
|
||||
return hex2num(copytext(A,2,4))
|
||||
|
||||
//will drop all values not on the diagonal
|
||||
/proc/color_matrix2color_hex(list/the_matrix)
|
||||
if(!istype(the_matrix) || the_matrix.len != 20)
|
||||
return "#ffffffff"
|
||||
return rgb(the_matrix[1]*255, the_matrix[6]*255, the_matrix[11]*255, the_matrix[16]*255)
|
||||
/proc/GetGreenPart(A)
|
||||
return hex2num(copytext(A,4,6))
|
||||
|
||||
/proc/GetBluePart(A)
|
||||
return hex2num(copytext(A,6,0))
|
||||
|
||||
|
||||
//Converts a positive interger to its roman numeral equivilent. Ignores any decimals.
|
||||
//Numbers over 3999 will display with extra "M"s (don't tell the Romans) and can get comically long, so be careful.
|
||||
/proc/num2roman(A)
|
||||
var/list/values = list("M" = 1000, "CM" = 900, "D" = 500, "CD" = 400, "C" = 100, "XC" = 90, "L" = 50, "XL" = 40, "X" = 10, "IX" = 9, "V" = 5, "IV" = 4, "I" = 1)
|
||||
if(!A || !isnum(A))
|
||||
return 0
|
||||
while(A >= 1)
|
||||
for(var/i in values)
|
||||
if(A >= values[i])
|
||||
. += i
|
||||
A -= values[i]
|
||||
break
|
||||
+204
-125
@@ -1,4 +1,4 @@
|
||||
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
|
||||
|
||||
/*
|
||||
* A large number of misc global procs.
|
||||
@@ -337,7 +337,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
moblist.Add(M)
|
||||
for(var/mob/living/carbon/human/M in sortmob)
|
||||
moblist.Add(M)
|
||||
for(var/mob/living/brain/M in sortmob)
|
||||
for(var/mob/living/carbon/brain/M in sortmob)
|
||||
moblist.Add(M)
|
||||
for(var/mob/living/carbon/alien/M in sortmob)
|
||||
moblist.Add(M)
|
||||
@@ -359,6 +359,41 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
moblist.Add(M)
|
||||
return moblist
|
||||
|
||||
/var/mob/dview/dview_mob = 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.forceMove(center)
|
||||
|
||||
dview_mob.see_invisible = invis_flags
|
||||
|
||||
. = view(range, dview_mob)
|
||||
dview_mob.forceMove(null)
|
||||
|
||||
/mob/dview
|
||||
invisibility = 101
|
||||
density = 0
|
||||
see_in_dark = 1e6
|
||||
anchored = 1
|
||||
|
||||
// Finds ALL mobs on turfs in line of sight. Similar to "in dview", but catches mobs that are not on a turf (e.g. inside a locker or such).
|
||||
/proc/get_all_mobs_in_dview(var/turf/T, var/range = world.view, var/list/ignore_types = list())
|
||||
. = list()
|
||||
var/list/can_see = dview(range, T)
|
||||
for(var/mob/M in can_see)
|
||||
if(is_type_in_list(M, ignore_types))
|
||||
continue
|
||||
. += M
|
||||
for(var/mob/M in mob_list) //Got the ones in vision, now let's go for the ones not on a turf.
|
||||
if(M.z == 0) //Mobs not on a turf will have XYZ = 0,0,0. They also won't show up in dview() so we're not checking anything twice.
|
||||
if(is_type_in_list(M, ignore_types))
|
||||
continue
|
||||
if(get_turf(M) in can_see) //Checking the mob's turf now, since those are it's "true" coordinates (plus dview() did pick up on turfs, so we can check using that).
|
||||
. += M
|
||||
|
||||
//E = MC^2
|
||||
/proc/convert2energy(M)
|
||||
var/E = M*(SPEED_OF_LIGHT_SQ)
|
||||
@@ -437,15 +472,12 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
if(M.ckey == key)
|
||||
return M
|
||||
|
||||
//Returns the atom sitting on the turf.
|
||||
//For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf.
|
||||
//Optional arg 'type' to stop once it reaches a specific type instead of a turf.
|
||||
/proc/get_atom_on_turf(atom/movable/M, stop_type)
|
||||
// Returns the atom sitting on the turf.
|
||||
// For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf.
|
||||
/proc/get_atom_on_turf(atom/movable/M)
|
||||
var/atom/loc = M
|
||||
while(loc && loc.loc && !isturf(loc.loc))
|
||||
while(loc && loc.loc && !istype(loc.loc, /turf/))
|
||||
loc = loc.loc
|
||||
if(stop_type && istype(loc, stop_type))
|
||||
break
|
||||
return loc
|
||||
|
||||
// returns the turf located at the map edge in the specified direction relative to A
|
||||
@@ -499,6 +531,25 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
var/y=arcsin(x/sqrt(1+x*x))
|
||||
return y
|
||||
|
||||
|
||||
/proc/anim(turf/location,target as mob|obj,a_icon,a_icon_state as text,flick_anim as text,sleeptime = 0,direction as num)
|
||||
//This proc throws up either an icon or an animation for a specified amount of time.
|
||||
//The variables should be apparent enough.
|
||||
var/atom/movable/overlay/animation = new(location)
|
||||
if(direction)
|
||||
animation.setDir(direction)
|
||||
animation.icon = a_icon
|
||||
animation.layer = target:layer+1
|
||||
if(a_icon_state)
|
||||
animation.icon_state = a_icon_state
|
||||
else
|
||||
animation.icon_state = "blank"
|
||||
animation.master = target
|
||||
flick(flick_anim, animation)
|
||||
sleep(max(sleeptime, 15))
|
||||
qdel(animation)
|
||||
|
||||
|
||||
/atom/proc/GetAllContents()
|
||||
var/list/processing_list = list(src)
|
||||
var/list/assembled = list()
|
||||
@@ -608,60 +659,58 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
|
||||
//Takes: Area type as text string or as typepath OR an instance of the area.
|
||||
//Returns: A list of all areas of that type in the world.
|
||||
/proc/get_areas(areatype, subtypes=TRUE)
|
||||
/proc/get_areas(areatype)
|
||||
if(!areatype)
|
||||
return null
|
||||
if(istext(areatype))
|
||||
areatype = text2path(areatype)
|
||||
else if(isarea(areatype))
|
||||
if(isarea(areatype))
|
||||
var/area/areatemp = areatype
|
||||
areatype = areatemp.type
|
||||
else if(!ispath(areatype))
|
||||
return null
|
||||
|
||||
var/list/areas = list()
|
||||
if(subtypes)
|
||||
var/list/cache = typecacheof(areatype)
|
||||
for(var/V in sortedAreas)
|
||||
var/area/A = V
|
||||
if(cache[A.type])
|
||||
areas += V
|
||||
else
|
||||
for(var/V in sortedAreas)
|
||||
var/area/A = V
|
||||
if(A.type == areatype)
|
||||
areas += V
|
||||
var/list/areas = new/list()
|
||||
for(var/area/N in world)
|
||||
if(istype(N, areatype))
|
||||
areas += N
|
||||
return areas
|
||||
|
||||
//Takes: Area type as text string or as typepath OR an instance of the area.
|
||||
//Returns: A list of all turfs in areas of that type of that type in the world.
|
||||
/proc/get_area_turfs(areatype, target_z = 0, subtypes=FALSE)
|
||||
/proc/get_area_turfs(areatype, target_z = 0)
|
||||
if(!areatype)
|
||||
return null
|
||||
if(istext(areatype))
|
||||
areatype = text2path(areatype)
|
||||
else if(isarea(areatype))
|
||||
if(isarea(areatype))
|
||||
var/area/areatemp = areatype
|
||||
areatype = areatemp.type
|
||||
else if(!ispath(areatype))
|
||||
return null
|
||||
|
||||
var/list/turfs = list()
|
||||
if(subtypes)
|
||||
var/list/cache = typecacheof(areatype)
|
||||
for(var/V in sortedAreas)
|
||||
var/area/A = V
|
||||
if(!cache[A.type])
|
||||
continue
|
||||
for(var/turf/T in A)
|
||||
if(target_z == 0 || target_z == T.z)
|
||||
turfs += T
|
||||
else
|
||||
for(var/V in sortedAreas)
|
||||
var/area/A = V
|
||||
if(A.type != areatype)
|
||||
continue
|
||||
for(var/turf/T in A)
|
||||
var/list/turfs = new/list()
|
||||
for(var/area/N in world)
|
||||
if(istype(N, areatype))
|
||||
for(var/turf/T in N)
|
||||
if(target_z == 0 || target_z == T.z)
|
||||
turfs += T
|
||||
return turfs
|
||||
|
||||
//Takes: Area type as text string or as typepath OR an instance of the area.
|
||||
//Returns: A list of all atoms (objs, turfs, mobs) in areas of that type of that type in the world.
|
||||
/proc/get_area_all_atoms(areatype)
|
||||
if(!areatype)
|
||||
return null
|
||||
if(istext(areatype))
|
||||
areatype = text2path(areatype)
|
||||
if(isarea(areatype))
|
||||
var/area/areatemp = areatype
|
||||
areatype = areatemp.type
|
||||
|
||||
var/list/atoms = new/list()
|
||||
for(var/area/N in world)
|
||||
if(istype(N, areatype))
|
||||
for(var/atom/A in N)
|
||||
atoms += A
|
||||
return atoms
|
||||
|
||||
/proc/get_cardinal_dir(atom/A, atom/B)
|
||||
var/dx = abs(B.x - A.x)
|
||||
var/dy = abs(B.y - A.y)
|
||||
@@ -708,18 +757,15 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
return zone
|
||||
|
||||
/*
|
||||
|
||||
Gets the turf this atom's *ICON* appears to inhabit
|
||||
It takes into account:
|
||||
* Pixel_x/y
|
||||
* Matrix x/y
|
||||
|
||||
NOTE: if your atom has non-standard bounds then this proc
|
||||
will handle it, but:
|
||||
* if the bounds are even, then there are an even amount of "middle" turfs, the one to the EAST, NORTH, or BOTH is picked
|
||||
(this may seem bad, but you're atleast as close to the center of the atom as possible, better than byond's default loc being all the way off)
|
||||
* if the bounds are odd, the true middle turf of the atom is returned
|
||||
|
||||
*/
|
||||
|
||||
/proc/get_turf_pixel(atom/movable/AM)
|
||||
@@ -798,24 +844,24 @@ var/global/list/common_tools = list(
|
||||
|
||||
//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(
|
||||
/obj/item/stack/rods,
|
||||
/obj/item/pipe))
|
||||
|
||||
/proc/can_embed(obj/item/W)
|
||||
if(W.is_sharp())
|
||||
return 1
|
||||
if(is_pointed(W))
|
||||
return 1
|
||||
|
||||
if(is_type_in_typecache(W, can_embed_types))
|
||||
var/list/embed_items = list(\
|
||||
/obj/item/stack/rods,\
|
||||
)
|
||||
|
||||
if(is_type_in_list(W, embed_items))
|
||||
return 1
|
||||
|
||||
|
||||
/*
|
||||
Checks if that loc and dir has a item on the wall
|
||||
*/
|
||||
var/list/WALLITEMS = typecacheof(list(
|
||||
var/list/WALLITEMS = 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,
|
||||
@@ -823,22 +869,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(
|
||||
/obj/machinery/camera, /obj/structure/camera_assembly,
|
||||
/obj/structure/light_construct, /obj/machinery/light))
|
||||
var/list/WALLITEMS_EXTERNAL = list(
|
||||
/obj/machinery/camera, /obj/machinery/camera_assembly,
|
||||
/obj/machinery/light_construct, /obj/machinery/light)
|
||||
|
||||
var/list/WALLITEMS_INVERSE = typecacheof(list(
|
||||
/obj/structure/light_construct, /obj/machinery/light))
|
||||
var/list/WALLITEMS_INVERSE = list(
|
||||
/obj/machinery/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_list(O, WALLITEMS) && check_external != 2)
|
||||
//Direction works sometimes
|
||||
if(is_type_in_typecache(O, WALLITEMS_INVERSE))
|
||||
if(is_type_in_list(O, WALLITEMS_INVERSE))
|
||||
if(O.dir == turn(dir, 180))
|
||||
return 1
|
||||
else if(O.dir == dir)
|
||||
@@ -849,8 +895,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_list(O, WALLITEMS_EXTERNAL) && check_external)
|
||||
if(is_type_in_list(O, WALLITEMS_INVERSE))
|
||||
if(O.dir == turn(dir, 180))
|
||||
return 1
|
||||
else if(O.dir == dir)
|
||||
@@ -858,7 +904,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_list(O, WALLITEMS) && check_external != 2)
|
||||
if(O.pixel_x == 0 && O.pixel_y == 0)
|
||||
return 1
|
||||
return 0
|
||||
@@ -929,34 +975,33 @@ var/list/WALLITEMS_INVERSE = typecacheof(list(
|
||||
return "white"
|
||||
|
||||
/proc/params2turf(scr_loc, turf/origin)
|
||||
if(!scr_loc)
|
||||
return null
|
||||
var/tX = splittext(scr_loc, ",")
|
||||
var/tY = splittext(tX[2], ":")
|
||||
var/tZ = origin.z
|
||||
tY = tY[1]
|
||||
tX = splittext(tX[1], ":")
|
||||
tX = tX[1]
|
||||
tX = Clamp(origin.x + text2num(tX) - world.view - 1, 1, world.maxx)
|
||||
tY = Clamp(origin.y + text2num(tY) - world.view - 1, 1, world.maxy)
|
||||
tX = max(1, min(world.maxx, origin.x + (text2num(tX) - (world.view + 1))))
|
||||
tY = max(1, min(world.maxy, origin.y + (text2num(tY) - (world.view + 1))))
|
||||
return locate(tX, tY, tZ)
|
||||
|
||||
/proc/screen_loc2turf(text, turf/origin)
|
||||
if(!text)
|
||||
return null
|
||||
var/tZ = splittext(text, ",")
|
||||
var/tX = splittext(tZ[1], "-")
|
||||
var/tY = text2num(tX[2])
|
||||
tX = splittext(tZ[2], "-")
|
||||
tX = text2num(tX[2])
|
||||
tZ = origin.z
|
||||
tX = Clamp(origin.x + 7 - tX, 1, world.maxx)
|
||||
tY = Clamp(origin.y + 7 - tY, 1, world.maxy)
|
||||
tX = max(1, min(origin.x + 7 - tX, world.maxx))
|
||||
tY = max(1, min(origin.y + 7 - tY, world.maxy))
|
||||
return locate(tX, tY, tZ)
|
||||
|
||||
/proc/IsValidSrc(datum/D)
|
||||
if(istype(D))
|
||||
return !qdeleted(D)
|
||||
/proc/IsValidSrc(A)
|
||||
if(istype(A, /datum))
|
||||
var/datum/B = A
|
||||
return !qdeleted(B)
|
||||
if(istype(A, /client))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
@@ -978,7 +1023,7 @@ var/list/WALLITEMS_INVERSE = typecacheof(list(
|
||||
/proc/is_A_facing_B(atom/A,atom/B)
|
||||
if(!istype(A) || !istype(B))
|
||||
return 0
|
||||
if(isliving(A))
|
||||
if(istype(A, /mob/living))
|
||||
var/mob/living/LA = A
|
||||
if(LA.lying)
|
||||
return 0
|
||||
@@ -993,7 +1038,6 @@ var/list/WALLITEMS_INVERSE = typecacheof(list(
|
||||
|
||||
/*
|
||||
rough example of the "cone" made by the 3 dirs checked
|
||||
|
||||
B
|
||||
\
|
||||
\
|
||||
@@ -1009,10 +1053,68 @@ B --><-- A
|
||||
/
|
||||
/
|
||||
B
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//This is just so you can stop an orbit.
|
||||
//orbit() can run without it (swap orbiting for A)
|
||||
//but then you can never stop it and that's just silly.
|
||||
/atom/movable/var/atom/orbiting = null
|
||||
|
||||
//A: atom to orbit
|
||||
//radius: range to orbit at, radius of the circle formed by orbiting
|
||||
//clockwise: whether you orbit clockwise or anti clockwise
|
||||
//rotation_speed: how fast to rotate
|
||||
//rotation_segments: the resolution of the orbit circle, less = a more block circle, this can be used to produce hexagons (6 segments) triangles (3 segments), and so on, 36 is the best default.
|
||||
//pre_rotation: Chooses to rotate src 90 degress towards the orbit dir (clockwise/anticlockwise), useful for things to go "head first" like ghosts
|
||||
//lockinorbit: Forces src to always be on A's turf, otherwise the orbit cancels when src gets too far away (eg: ghosts)
|
||||
|
||||
/atom/movable/proc/orbit(atom/A, radius = 10, clockwise = FALSE, rotation_speed = 20, rotation_segments = 36, pre_rotation = TRUE, lockinorbit = FALSE)
|
||||
if(!istype(A))
|
||||
return
|
||||
|
||||
if(orbiting)
|
||||
stop_orbit()
|
||||
|
||||
orbiting = A
|
||||
var/matrix/initial_transform = matrix(transform)
|
||||
var/lastloc = loc
|
||||
|
||||
//Head first!
|
||||
if(pre_rotation)
|
||||
var/matrix/M = matrix(transform)
|
||||
var/pre_rot = 90
|
||||
if(!clockwise)
|
||||
pre_rot = -90
|
||||
M.Turn(pre_rot)
|
||||
transform = M
|
||||
|
||||
var/matrix/shift = matrix(transform)
|
||||
shift.Translate(0,radius)
|
||||
transform = shift
|
||||
|
||||
SpinAnimation(rotation_speed, -1, clockwise, rotation_segments)
|
||||
|
||||
//we stack the orbits up client side, so we can assign this back to normal server side without it breaking the orbit
|
||||
transform = initial_transform
|
||||
while(orbiting && orbiting == A && A.loc)
|
||||
var/targetloc = get_turf(A)
|
||||
if(!lockinorbit && loc != lastloc && loc != targetloc)
|
||||
break
|
||||
loc = targetloc
|
||||
lastloc = loc
|
||||
stoplag()
|
||||
|
||||
if (orbiting == A) //make sure we haven't started orbiting something else.
|
||||
orbiting = null
|
||||
SpinAnimation(0,0)
|
||||
|
||||
|
||||
|
||||
/atom/movable/proc/stop_orbit()
|
||||
orbiting = null
|
||||
|
||||
|
||||
//Center's an image.
|
||||
//Requires:
|
||||
//The Image
|
||||
@@ -1187,13 +1289,10 @@ B --><-- A
|
||||
|
||||
/proc/add_to_proximity_list(atom/A, range)
|
||||
var/turf/T = get_turf(A)
|
||||
if(!T || !A.loc)
|
||||
throw EXCEPTION("Someone adding a prox sensor in nullspace")
|
||||
var/list/L = block(locate(T.x - range, T.y - range, T.z), locate(T.x + range, T.y + range, T.z))
|
||||
for(var/B in L)
|
||||
var/turf/C = B
|
||||
LAZYINITLIST(C.proximity_checkers)
|
||||
C.proximity_checkers[A] = TRUE
|
||||
C.proximity_checkers |= A
|
||||
return L
|
||||
|
||||
/proc/remove_from_proximity_list(atom/A, range)
|
||||
@@ -1201,11 +1300,7 @@ B --><-- A
|
||||
var/list/L = block(locate(T.x - range, T.y - range, T.z), locate(T.x + range, T.y + range, T.z))
|
||||
for(var/B in L)
|
||||
var/turf/C = B
|
||||
if (!C.proximity_checkers)
|
||||
continue
|
||||
C.proximity_checkers.Remove(A)
|
||||
UNSETEMPTY(C.proximity_checkers)
|
||||
|
||||
|
||||
/proc/shift_proximity(atom/checker, atom/A, range, atom/B, newrange)
|
||||
var/turf/T = get_turf(A)
|
||||
@@ -1218,14 +1313,10 @@ B --><-- A
|
||||
var/list/O = M - L
|
||||
for(var/C in N)
|
||||
var/turf/D = C
|
||||
if (!D.proximity_checkers)
|
||||
continue
|
||||
D.proximity_checkers.Remove(checker)
|
||||
UNSETEMPTY(D.proximity_checkers)
|
||||
for(var/E in O)
|
||||
var/turf/F = E
|
||||
LAZYINITLIST(F.proximity_checkers)
|
||||
F.proximity_checkers[checker] = TRUE
|
||||
F.proximity_checkers |= checker
|
||||
return 1
|
||||
|
||||
/proc/flick_overlay_static(image/I, atom/A, duration)
|
||||
@@ -1238,13 +1329,13 @@ B --><-- A
|
||||
|
||||
/proc/get_areas_in_z(zlevel)
|
||||
. = list()
|
||||
var/validarea = FALSE
|
||||
var/validarea = 0
|
||||
for(var/V in sortedAreas)
|
||||
var/area/A = V
|
||||
validarea = TRUE
|
||||
validarea = 1
|
||||
for(var/turf/T in A)
|
||||
if(T.z != zlevel)
|
||||
validarea = FALSE
|
||||
validarea = 0
|
||||
break
|
||||
if(validarea)
|
||||
. += A
|
||||
@@ -1256,7 +1347,7 @@ B --><-- A
|
||||
if(!istype(A, type))
|
||||
continue
|
||||
var/distance = get_dist(source, A)
|
||||
if(!closest_atom)
|
||||
if(!closest_distance)
|
||||
closest_distance = distance
|
||||
closest_atom = A
|
||||
else
|
||||
@@ -1265,14 +1356,9 @@ B --><-- A
|
||||
closest_atom = A
|
||||
return closest_atom
|
||||
|
||||
|
||||
proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
|
||||
if (value == FALSE) //nothing should be calling us with a number, so this is safe
|
||||
value = input("Enter type to find (blank for all, cancel to cancel)", "Search for type") as null|text
|
||||
if (isnull(value))
|
||||
return
|
||||
value = trim(value)
|
||||
if(!isnull(value) && value != "")
|
||||
proc/pick_closest_path(value)
|
||||
var/list/matches = get_fancy_list_of_types()
|
||||
if (!isnull(value) && value!="")
|
||||
matches = filter_fancy_list(matches, value)
|
||||
|
||||
if(matches.len==0)
|
||||
@@ -1282,7 +1368,7 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
|
||||
if(matches.len==1)
|
||||
chosen = matches[1]
|
||||
else
|
||||
chosen = input("Select a type", "Pick Type", matches[1]) as null|anything in matches
|
||||
chosen = input("Select an atom type", "Spawn Atom", matches[1]) as null|anything in matches
|
||||
if(!chosen)
|
||||
return
|
||||
chosen = matches[chosen]
|
||||
@@ -1293,23 +1379,17 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
|
||||
CRASH(msg)
|
||||
|
||||
//Key thing that stops lag. Cornerstone of performance in ss13, Just sitting here, in unsorted.dm.
|
||||
|
||||
//Increases delay as the server gets more overloaded,
|
||||
//as sleeps aren't cheap and sleeping only to wake up and sleep again is wasteful
|
||||
#define DELTA_CALC max(((max(world.tick_usage, world.cpu) / 100) * max(Master.sleep_delta,1)), 1)
|
||||
|
||||
/proc/stoplag()
|
||||
. = round(1*DELTA_CALC)
|
||||
. = 1
|
||||
sleep(world.tick_lag)
|
||||
if (world.tick_usage > TICK_LIMIT_TO_RUN) //woke up, still not enough tick, sleep for more.
|
||||
. += round(2*DELTA_CALC)
|
||||
sleep(world.tick_lag*2*DELTA_CALC)
|
||||
. += 2
|
||||
sleep(world.tick_lag*2)
|
||||
if (world.tick_usage > TICK_LIMIT_TO_RUN) //woke up, STILL not enough tick, sleep for more.
|
||||
. += round(4*DELTA_CALC)
|
||||
sleep(world.tick_lag*4*DELTA_CALC)
|
||||
. += 4
|
||||
sleep(world.tick_lag*4)
|
||||
//you might be thinking of adding more steps to this, or making it use a loop and a counter var
|
||||
// not worth it.
|
||||
#undef DELTA_CALC
|
||||
|
||||
/proc/flash_color(mob_or_client, flash_color="#960000", flash_time=20)
|
||||
var/client/C
|
||||
@@ -1331,7 +1411,7 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
|
||||
|
||||
#define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255)))
|
||||
|
||||
#define QDEL_IN(item, time) addtimer(GLOBAL_PROC, "qdel", time, TIMER_NORMAL, item)
|
||||
#define QDEL_IN(item, time) addtimer(GLOBAL_PROC, "qdel", time, FALSE, item)
|
||||
|
||||
/proc/check_for_cleanbot_bug()
|
||||
var/static/admins_warned //bet you didn't know you could do this!
|
||||
@@ -1359,11 +1439,10 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
|
||||
str = "0" + str
|
||||
. = str
|
||||
|
||||
/atom/proc/Shake(pixelshiftx = 15, pixelshifty = 15, duration = 250)
|
||||
var/initialpixelx = pixel_x
|
||||
var/initialpixely = pixel_y
|
||||
var/shiftx = rand(-pixelshiftx,pixelshiftx)
|
||||
var/shifty = rand(-pixelshifty,pixelshifty)
|
||||
animate(src, pixel_x = pixel_x + shiftx, pixel_y = pixel_y + shifty, time = 0.2, loop = duration)
|
||||
pixel_x = initialpixelx
|
||||
pixel_y = initialpixely
|
||||
/proc/trange(var/Dist = 0, var/turf/Center = null)
|
||||
if (isnull(Center))
|
||||
return
|
||||
|
||||
var/turf/x1y1 = locate(((Center.x - Dist) < 1 ? 1 : Center.x - Dist), ((Center.y - Dist) < 1 ? 1 : Center.y - Dist), Center.z)
|
||||
var/turf/x2y2 = locate(((Center.x + Dist) > world.maxx ? world.maxx : Center.x + Dist), ((Center.y + Dist) > world.maxy ? world.maxy : Center.y + Dist), Center.z)
|
||||
return block(x1y1, x2y2)
|
||||
|
||||
Reference in New Issue
Block a user