forked from infinitystation/Baystation12
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/Baystation12/Baystation12
# Conflicts: # code/datums/uplink/hardsuit_modules.dm # code/datums/uplink/highly_visible_and_dangerous_weapons.dm # code/game/objects/items/weapons/material/coins.dm # code/game/objects/structures/window.dm # code/game/turfs/simulated/walls.dm # code/modules/mob/living/simple_animal/hostile/hivebot.dm # maps/torch/items/clothing/solgov-suit.dm
- Loading branch information
Showing
115 changed files
with
1,131 additions
and
577 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Helpers related to /client | ||
*/ | ||
|
||
|
||
/// Duck check to see if text looks like a ckey | ||
/proc/valid_ckey(text) | ||
var/static/regex/matcher = new (@"^[a-z0-9]{1,30}$") | ||
return regex_find(matcher, text) | ||
|
||
|
||
/// Duck check to see if text looks like a key | ||
/proc/valid_key(text) | ||
var/static/regex/matcher = new (@"^[0-9A-Za-z][0-9A-Za-z_\. -]{2,29}$") | ||
return regex_find(matcher, text) | ||
|
||
|
||
/// Get the client associated with ckey text if it is currently connected | ||
/proc/ckey2client(text) | ||
if (valid_ckey(text)) | ||
FOR_BLIND(client/C, GLOB.clients) | ||
if (C.ckey == text) | ||
return C | ||
|
||
|
||
/// Get the client associated with key text if it is currently connected | ||
/proc/key2client(text) | ||
if (valid_key(text)) | ||
FOR_BLIND(client/C, GLOB.clients) | ||
if (C.key == text) | ||
return C | ||
|
||
|
||
/// Null, or a client if thing is a client, a mob with a client, a connected ckey, or null | ||
/proc/resolve_client(client/thing) | ||
if (!thing) | ||
return usr | ||
if (istype(thing)) | ||
return thing | ||
if (ismob(thing)) | ||
var/mob/M = thing | ||
return M.client | ||
return ckey2client(thing) | ||
|
||
|
||
/// Null or a client from the list of connected clients, chosen by actor if actor is valid | ||
/proc/select_client(client/actor, message = "Connected clients:", title = "Select Client") | ||
actor = resolve_client(actor) | ||
if (!actor) | ||
return | ||
return input(actor, message, title) as null | anything in GLOB.clients |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
Helpers related to /datum/species | ||
*/ | ||
|
||
|
||
/// Null, or a species if thing is a species, a species path, or a species name | ||
/proc/resolve_species(datum/species/thing) | ||
if (ispath(thing, /datum/species)) | ||
thing = initial(thing.name) | ||
if (istext(thing)) | ||
thing = all_species[thing] | ||
if (istype(thing)) | ||
return thing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.