diff --git a/code/__DEFINES/botany.dm b/code/__DEFINES/botany.dm index 20371614bdb..01e3803150b 100644 --- a/code/__DEFINES/botany.dm +++ b/code/__DEFINES/botany.dm @@ -64,3 +64,7 @@ #define REAGENT_TRANSFER_ID (1<<5) /// Plants that have a unique effect on attack_self. #define ATTACK_SELF_ID (1<<6) + +#define GLOWSHROOM_SPREAD_BASE_DIMINISH_FACTOR 10 +#define GLOWSHROOM_SPREAD_DIMINISH_FACTOR_PER_GLOWSHROOM 0.2 +#define GLOWSHROOM_BASE_INTEGRITY 60 diff --git a/code/__DEFINES/drone.dm b/code/__DEFINES/drone.dm new file mode 100644 index 00000000000..46c19fdbaf4 --- /dev/null +++ b/code/__DEFINES/drone.dm @@ -0,0 +1,28 @@ + +/// If drones are blacklisted from certain sensitive machines +GLOBAL_VAR_INIT(drone_machine_blacklist_enabled, TRUE) + +#define DRONE_HANDS_LAYER 1 +#define DRONE_HEAD_LAYER 2 +#define DRONE_TOTAL_LAYERS 2 + +/// Message displayed when new drone spawns in drone network +#define DRONE_NET_CONNECT span_notice("DRONE NETWORK: [name] connected.") +/// Message displayed when drone in network dies +#define DRONE_NET_DISCONNECT span_danger("DRONE NETWORK: [name] is not responding.") + +/// Maintenance Drone icon_state (multiple colors) +#define MAINTDRONE "drone_maint" +/// Repair Drone icon_state +#define REPAIRDRONE "drone_repair" +/// Scout Drone icon_state +#define SCOUTDRONE "drone_scout" +/// Clockwork Drone icon_state +#define CLOCKDRONE "drone_clock" + +/// [MAINTDRONE] hacked icon_state +#define MAINTDRONE_HACKED "drone_maint_red" +/// [REPAIRDRONE] hacked icon_state +#define REPAIRDRONE_HACKED "drone_repair_hacked" +/// [SCOUTDRONE] hacked icon_state +#define SCOUTDRONE_HACKED "drone_scout_hacked" diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index bd901509360..50fa8e13b8e 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -180,15 +180,6 @@ GLOBAL_LIST_EMPTY(bloody_footprints_cache) //Maximum amount of time, (in deciseconds) a tile can be wet for. #define MAXIMUM_WET_TIME 5 MINUTES -//unmagic-strings for types of polls -#define POLLTYPE_OPTION "OPTION" -#define POLLTYPE_TEXT "TEXT" -#define POLLTYPE_RATING "NUMVAL" -#define POLLTYPE_MULTI "MULTICHOICE" -#define POLLTYPE_IRV "IRV" - - - //subtypesof(), typesof() without the parent path #define subtypesof(typepath) ( typesof(typepath) - typepath ) diff --git a/code/__DEFINES/polls.dm b/code/__DEFINES/polls.dm new file mode 100644 index 00000000000..a5a0616d8d4 --- /dev/null +++ b/code/__DEFINES/polls.dm @@ -0,0 +1,7 @@ + +//unmagic-strings for types of polls +#define POLLTYPE_OPTION "OPTION" +#define POLLTYPE_TEXT "TEXT" +#define POLLTYPE_RATING "NUMVAL" +#define POLLTYPE_MULTI "MULTICHOICE" +#define POLLTYPE_IRV "IRV" diff --git a/code/__DEFINES/power.dm b/code/__DEFINES/power.dm index 7c5c2d0a82d..ec8888c43a0 100644 --- a/code/__DEFINES/power.dm +++ b/code/__DEFINES/power.dm @@ -7,3 +7,12 @@ #define SOLAR_TRACK_OFF 0 #define SOLAR_TRACK_TIMED 1 #define SOLAR_TRACK_AUTO 2 + +///conversion ratio from joules to watts +#define WATTS / 0.002 +///conversion ratio from watts to joules +#define JOULES * 0.002 + +GLOBAL_VAR_INIT(CHARGELEVEL, 0.001) // Cap for how fast cells charge, as a percentage-per-tick (.001 means cellcharge is capped to 1% per second) + +GLOBAL_LIST_EMPTY(powernets) diff --git a/code/__DEFINES/projectiles.dm b/code/__DEFINES/projectiles.dm index 07137c192fd..aecd71092ac 100644 --- a/code/__DEFINES/projectiles.dm +++ b/code/__DEFINES/projectiles.dm @@ -1,3 +1,6 @@ + +GLOBAL_LIST_EMPTY_TYPED(proj_by_path_key, /obj/projectile) // A list of projectile objects, which are keyed by their path + // check_pierce() return values /// Default behavior: hit and delete self #define PROJECTILE_PIERCE_NONE 0 diff --git a/code/__HELPERS/files.dm b/code/__HELPERS/files.dm index 3b9d35243f1..144f127e3ba 100644 --- a/code/__HELPERS/files.dm +++ b/code/__HELPERS/files.dm @@ -1,3 +1,11 @@ + +/** + * For FTP requests. (i.e. downloading runtime logs.) + * + * However it'd be ok to use for accessing attack logs and such too, which are even laggier. + */ +GLOBAL_VAR_INIT(fileaccess_timer, 0) + /client/proc/browse_files(root_type=BROWSE_ROOT_ALL_LOGS, max_iterations=10, list/valid_extensions=list("txt","log","htm", "html")) // wow why was this ever a parameter var/root = "data/logs/" diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 2cdf763d8d1..411c4f148d9 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -315,10 +315,10 @@ Turf and target are separate in case you want to teleport some distance from a t // Format an energy value measured in Power Cell units. /proc/DisplayEnergy(units) // APCs process every (SSmachines.wait * 0.1) seconds, and turn 1 W of - // excess power into GLOB.CELLRATE energy units when charging cells. + // excess power into watts when charging cells. // With the current configuration of wait=20 and CELLRATE=0.002, this // means that one unit is 1 kJ. - return DisplayJoules(units * SSmachines.wait * 0.1 / GLOB.CELLRATE) + return DisplayJoules(units * SSmachines.wait * 0.1 WATTS) /proc/get_mob_by_ckey(key) if(!key) diff --git a/code/_globalvars/lists/admin.dm b/code/_globalvars/admin.dm similarity index 86% rename from code/_globalvars/lists/admin.dm rename to code/_globalvars/admin.dm index f2e08ec085d..f614061366c 100644 --- a/code/_globalvars/lists/admin.dm +++ b/code/_globalvars/admin.dm @@ -10,3 +10,5 @@ GLOBAL_VAR(stickbanadminexemptiontimerid) //stores the timerid of the callback t return smites GLOBAL_LIST_INIT_TYPED(smites, /datum/smite, init_smites()) + +GLOBAL_VAR_INIT(admin_notice, "") // Admin notice that all clients see when joining the server diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm deleted file mode 100644 index 32cec5cd523..00000000000 --- a/code/_globalvars/misc.dm +++ /dev/null @@ -1,38 +0,0 @@ -GLOBAL_VAR_INIT(admin_notice, "") // Admin notice that all clients see when joining the server - -GLOBAL_VAR_INIT(timezoneOffset, 0) // The difference betwen midnight (of the host computer) and 0 world.ticks. - -GLOBAL_VAR_INIT(year, time2text(world.realtime,"YYYY")) -GLOBAL_VAR_INIT(year_integer, text2num(year)) // = 2013??? - - // For FTP requests. (i.e. downloading runtime logs.) - // However it'd be ok to use for accessing attack logs and such too, which are even laggier. -GLOBAL_VAR_INIT(fileaccess_timer, 0) - -GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) - -GLOBAL_VAR_INIT(CELLRATE, 0.002) // conversion ratio between a watt-tick and kilojoule -GLOBAL_VAR_INIT(CHARGELEVEL, 0.001) // Cap for how fast cells charge, as a percentage-per-tick (.001 means cellcharge is capped to 1% per second) - -GLOBAL_LIST_EMPTY(powernets) - -GLOBAL_VAR_INIT(bsa_unlock, FALSE) //BSA unlocked by head ID swipes - -GLOBAL_LIST_EMPTY(player_details) // ckey -> /datum/player_details - -///All currently running polls held as datums -GLOBAL_LIST_EMPTY(polls) -GLOBAL_PROTECT(polls) - -///All poll option datums of running polls -GLOBAL_LIST_EMPTY(poll_options) -GLOBAL_PROTECT(poll_options) - -GLOBAL_VAR_INIT(internal_tick_usage, 0.2 * world.tick_lag) - -GLOBAL_VAR_INIT(glowshrooms, 0) - -/// If drones are blacklisted from certain sensitive machines -GLOBAL_VAR_INIT(drone_machine_blacklist_enabled, TRUE) - -GLOBAL_LIST_EMPTY_TYPED(proj_by_path_key, /obj/projectile) // A list of projectile objects, which are keyed by their path diff --git a/code/_globalvars/time_vars.dm b/code/_globalvars/time_vars.dm new file mode 100644 index 00000000000..cc830721145 --- /dev/null +++ b/code/_globalvars/time_vars.dm @@ -0,0 +1,6 @@ + +/// The difference betwen midnight (of the host computer) and 0 world.ticks. +GLOBAL_VAR_INIT(timezoneOffset, 0) + +GLOBAL_VAR_INIT(year, time2text(world.realtime,"YYYY")) +GLOBAL_VAR_INIT(year_integer, text2num(year)) // = 2013??? diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 95990b75159..a11e07f2f33 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -1,3 +1,6 @@ + +GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) + //TODO: someone please get rid of this shit /datum/datacore var/list/medical = list() diff --git a/code/game/objects/effects/glowshroom.dm b/code/game/objects/effects/glowshroom.dm index e4559484cef..bb1613a1167 100644 --- a/code/game/objects/effects/glowshroom.dm +++ b/code/game/objects/effects/glowshroom.dm @@ -1,6 +1,6 @@ -#define GLOWSHROOM_SPREAD_BASE_DIMINISH_FACTOR 10 -#define GLOWSHROOM_SPREAD_DIMINISH_FACTOR_PER_GLOWSHROOM 0.2 -#define GLOWSHROOM_BASE_INTEGRITY 60 + +GLOBAL_VAR_INIT(glowshrooms, 0) + /obj/structure/glowshroom name = "glowshroom" desc = "Mycena Bregprox, a species of mushroom that glows in the dark." @@ -252,9 +252,3 @@ myseed.potency = 50 myseed.endurance = 50 myseed.yield = 5 - - - -#undef GLOWSHROOM_SPREAD_BASE_DIMINISH_FACTOR -#undef GLOWSHROOM_SPREAD_DIMINISH_FACTOR_PER_GLOWSHROOM -#undef GLOWSHROOM_BASE_INTEGRITY diff --git a/code/modules/client/player_details.dm b/code/modules/client/player_details.dm index 0c06d96b649..7358cc9cee3 100644 --- a/code/modules/client/player_details.dm +++ b/code/modules/client/player_details.dm @@ -1,3 +1,7 @@ + +///assoc list of ckey -> /datum/player_details +GLOBAL_LIST_EMPTY(player_details) + /datum/player_details var/list/player_actions = list() var/list/logging = list() diff --git a/code/modules/mob/dead/new_player/poll.dm b/code/modules/mob/dead/new_player/poll.dm index 6779ec4d0e5..55257d4ac8f 100644 --- a/code/modules/mob/dead/new_player/poll.dm +++ b/code/modules/mob/dead/new_player/poll.dm @@ -1,3 +1,12 @@ + +///All currently running polls held as datums +GLOBAL_LIST_EMPTY(polls) +GLOBAL_PROTECT(polls) + +///All poll option datums of running polls +GLOBAL_LIST_EMPTY(poll_options) +GLOBAL_PROTECT(poll_options) + /** * Shows a list of currently running polls a player can vote/has voted on * diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index 377a53d59ae..742e534f2cb 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -1,29 +1,4 @@ -#define DRONE_HANDS_LAYER 1 -#define DRONE_HEAD_LAYER 2 -#define DRONE_TOTAL_LAYERS 2 - -/// Message displayed when new drone spawns in drone network -#define DRONE_NET_CONNECT span_notice("DRONE NETWORK: [name] connected.") -/// Message displayed when drone in network dies -#define DRONE_NET_DISCONNECT span_danger("DRONE NETWORK: [name] is not responding.") - -/// Maintenance Drone icon_state (multiple colors) -#define MAINTDRONE "drone_maint" -/// Repair Drone icon_state -#define REPAIRDRONE "drone_repair" -/// Scout Drone icon_state -#define SCOUTDRONE "drone_scout" -/// Clockwork Drone icon_state -#define CLOCKDRONE "drone_clock" - -/// [MAINTDRONE] hacked icon_state -#define MAINTDRONE_HACKED "drone_maint_red" -/// [REPAIRDRONE] hacked icon_state -#define REPAIRDRONE_HACKED "drone_repair_hacked" -/// [SCOUTDRONE] hacked icon_state -#define SCOUTDRONE_HACKED "drone_scout_hacked" - /** * # Maintenance Drone * diff --git a/code/modules/modular_computers/computers/item/computer_power.dm b/code/modules/modular_computers/computers/item/computer_power.dm index 92d4a812a27..882e10a667f 100644 --- a/code/modules/modular_computers/computers/item/computer_power.dm +++ b/code/modules/modular_computers/computers/item/computer_power.dm @@ -13,10 +13,10 @@ if(battery_module && battery_module.battery && battery_module.battery.charge) var/obj/item/stock_parts/cell/cell = battery_module.battery - if(cell.use(amount * GLOB.CELLRATE)) + if(cell.use(amount JOULES)) return TRUE else // Discharge the cell anyway. - cell.use(min(amount*GLOB.CELLRATE, cell.charge)) + cell.use(min(amount JOULES, cell.charge)) return FALSE return FALSE diff --git a/code/modules/modular_computers/hardware/recharger.dm b/code/modules/modular_computers/hardware/recharger.dm index f98382e5257..0d9952080bd 100644 --- a/code/modules/modular_computers/hardware/recharger.dm +++ b/code/modules/modular_computers/hardware/recharger.dm @@ -20,7 +20,7 @@ return if(use_power(charge_rate, charging=1)) - holder.give_power(charge_rate * GLOB.CELLRATE) + holder.give_power(charge_rate JOULES) /obj/item/computer_hardware/recharger/apc_recharger diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 8568f7e2efe..302d7cd3597 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -1273,18 +1273,18 @@ if(cell && !shorted) // draw power from cell as before to power the area - var/cellused = min(cell.charge, GLOB.CELLRATE * lastused_total) // clamp deduction to a max, amount left in cell + var/cellused = min(cell.charge, lastused_total) // clamp deduction to a max, amount left in cell cell.use(cellused) if(excess > lastused_total) // if power excess recharge the cell // by the same amount just used cell.give(cellused) - add_load(cellused/GLOB.CELLRATE) // add the load used to recharge the cell + add_load(cellused WATTS) // add the load used to recharge the cell else // no excess, and not enough per-apc - if((cell.charge/GLOB.CELLRATE + excess) >= lastused_total) // can we draw enough from cell+grid to cover last usage? - cell.charge = min(cell.maxcharge, cell.charge + GLOB.CELLRATE * excess) //recharge with what we can + if((cell.charge WATTS + excess) >= lastused_total) // can we draw enough from cell+grid to cover last usage? + cell.charge = min(cell.maxcharge, cell.charge + excess JOULES) //recharge with what we can add_load(excess) // so draw what we can from the grid charging = APC_NOT_CHARGING @@ -1332,8 +1332,8 @@ if(chargemode && charging == APC_CHARGING && operating) if(excess > 0) // check to make sure we have enough to charge // Max charge is capped to % per second constant - var/ch = min(excess*GLOB.CELLRATE, cell.maxcharge*GLOB.CHARGELEVEL) - add_load(ch/GLOB.CELLRATE) // Removes the power we're taking from the grid + var/ch = min(excess JOULES, cell.maxcharge JOULES) + add_load(ch WATTS) // Removes the power we're taking from the grid cell.give(ch) // actually recharge the cell else diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 3f9623cf671..ac9c1db17a2 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -404,9 +404,9 @@ if (isarea(power_source)) var/area/source_area = power_source - source_area.use_power(drained_energy/GLOB.CELLRATE) + source_area.use_power(drained_energy WATTS) else if (istype(power_source, /datum/powernet)) - var/drained_power = drained_energy/GLOB.CELLRATE //convert from "joules" to "watts" + var/drained_power = drained_energy WATTS //convert from "joules" to "watts" PN.delayedload += (min(drained_power, max(PN.newavail - PN.delayedload, 0))) else if (istype(power_source, /obj/item/stock_parts/cell)) cell.use(drained_energy) diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm index e373cf29da0..887feca67bd 100644 --- a/code/modules/station_goals/bsa.dm +++ b/code/modules/station_goals/bsa.dm @@ -1,3 +1,7 @@ + +///BSA unlocked by head ID swipes +GLOBAL_VAR_INIT(bsa_unlock, FALSE) + // Crew has to build a bluespace cannon // Cargo orders part for high price // Requires high amount of power diff --git a/tgstation.dme b/tgstation.dme index ed4becafe11..07d7f12d619 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -54,6 +54,7 @@ #include "code\__DEFINES\diseases.dm" #include "code\__DEFINES\DNA.dm" #include "code\__DEFINES\do_afters.dm" +#include "code\__DEFINES\drone.dm" #include "code\__DEFINES\dye_keys.dm" #include "code\__DEFINES\dynamic.dm" #include "code\__DEFINES\economy.dm" @@ -107,6 +108,7 @@ #include "code\__DEFINES\pinpointers.dm" #include "code\__DEFINES\pipe_construction.dm" #include "code\__DEFINES\plumbing.dm" +#include "code\__DEFINES\polls.dm" #include "code\__DEFINES\power.dm" #include "code\__DEFINES\preferences.dm" #include "code\__DEFINES\processing.dm" @@ -217,18 +219,18 @@ #include "code\__HELPERS\sorts\InsertSort.dm" #include "code\__HELPERS\sorts\MergeSort.dm" #include "code\__HELPERS\sorts\TimSort.dm" +#include "code\_globalvars\admin.dm" #include "code\_globalvars\bitfields.dm" #include "code\_globalvars\configuration.dm" #include "code\_globalvars\game_modes.dm" #include "code\_globalvars\genetics.dm" #include "code\_globalvars\logging.dm" -#include "code\_globalvars\misc.dm" #include "code\_globalvars\regexes.dm" #include "code\_globalvars\religion.dm" #include "code\_globalvars\tgui.dm" +#include "code\_globalvars\time_vars.dm" #include "code\_globalvars\traits.dm" #include "code\_globalvars\lists\achievements.dm" -#include "code\_globalvars\lists\admin.dm" #include "code\_globalvars\lists\ambience.dm" #include "code\_globalvars\lists\client.dm" #include "code\_globalvars\lists\color.dm"