mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-27 15:01:04 +01:00
Port Integrated Electronics from Polaris (#3371)
Ports Polaris' integrated electronics system, whichallows for Roboticists & Electricians/Engineers to build custom devices and machines for a variety of purposes.
This commit is contained in:
+32
-6
@@ -44,12 +44,16 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/instances_of_type_in_list(var/atom/A, var/list/L)
|
||||
var/instances = 0
|
||||
for(var/type in L)
|
||||
if(istype(A, type))
|
||||
instances++
|
||||
return instances
|
||||
/proc/instances_of_type_in_list(atom/A, list/L, strict = FALSE)
|
||||
. = 0
|
||||
if (strict)
|
||||
for (var/type in L)
|
||||
if (type == A.type)
|
||||
.++
|
||||
else
|
||||
for(var/type in L)
|
||||
if(istype(A, type))
|
||||
.++
|
||||
|
||||
//Removes any null entries from the list
|
||||
//Returns TRUE if the list had nulls, FALSE otherwise
|
||||
@@ -292,6 +296,28 @@
|
||||
L += new path()
|
||||
return L
|
||||
|
||||
//returns a new list with only atoms that are in typecache L
|
||||
/proc/typecache_filter_list(list/atoms, list/typecache)
|
||||
. = list()
|
||||
for(var/thing in atoms)
|
||||
var/atom/A = thing
|
||||
if (typecache[A.type])
|
||||
. += A
|
||||
|
||||
/proc/typecache_filter_list_reverse(list/atoms, list/typecache)
|
||||
. = list()
|
||||
for(var/thing in atoms)
|
||||
var/atom/A = thing
|
||||
if(!typecache[A.type])
|
||||
. += A
|
||||
|
||||
/proc/typecache_filter_multi_list_exclusion(list/atoms, list/typecache_include, list/typecache_exclude)
|
||||
. = list()
|
||||
for(var/thing in atoms)
|
||||
var/atom/A = thing
|
||||
if(typecache_include[A.type] && !typecache_exclude[A.type])
|
||||
. += A
|
||||
|
||||
//Like typesof() or subtypesof(), but returns a typecache instead of a list
|
||||
/proc/typecacheof(path, ignore_root_path, only_root_path = FALSE)
|
||||
if(ispath(path))
|
||||
|
||||
+16
-3
@@ -4,16 +4,24 @@
|
||||
#define MINUTE *600
|
||||
#define MINUTES *600
|
||||
|
||||
#define HOUR *36000
|
||||
#define HOURS *36000
|
||||
|
||||
#define DAY *864000
|
||||
#define DAYS *864000
|
||||
|
||||
var/roundstart_hour = 0
|
||||
var/round_start_time
|
||||
|
||||
//Returns the world time in english
|
||||
/proc/worldtime2text(time = world.time, timeshift = 1)
|
||||
if(!roundstart_hour) roundstart_hour = rand(0, 23)
|
||||
return timeshift ? time2text(time+(36000*roundstart_hour), "hh:mm") : time2text(time, "hh:mm")
|
||||
return timeshift ? time2text(time+(roundstart_hour HOURS), "hh:mm") : time2text(time, "hh:mm")
|
||||
|
||||
/proc/worldtime2hours()
|
||||
if (!roundstart_hour)
|
||||
worldtime2text()
|
||||
. = text2num(time2text(world.time + (36000 * roundstart_hour), "hh"))
|
||||
. = text2num(time2text(world.time + (roundstart_hour HOURS), "hh"))
|
||||
|
||||
/proc/worlddate2text()
|
||||
return num2text(game_year) + "-" + time2text(world.timeofday, "MM-DD")
|
||||
@@ -39,8 +47,13 @@ var/last_round_duration = 0
|
||||
if(last_round_duration && world.time < next_duration_update)
|
||||
return last_round_duration
|
||||
|
||||
var/mills = world.time // 1/10 of a second, not real milliseconds but whatever
|
||||
var/mills = round_duration_in_ticks // 1/10 of a second, not real milliseconds but whatever
|
||||
//var/secs = ((mills % 36000) % 600) / 10 //Not really needed, but I'll leave it here for refrence.. or something
|
||||
if (!mills)
|
||||
last_round_duration = "00:00"
|
||||
next_duration_update = world.time + 1 MINUTE
|
||||
return last_round_duration
|
||||
|
||||
var/mins = round((mills % 36000) / 600)
|
||||
var/hours = round(mills / 36000)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user