diff --git a/code/_onclick/hud/picture_in_picture.dm b/code/_onclick/hud/picture_in_picture.dm index 5e474331f61..0e890871598 100644 --- a/code/_onclick/hud/picture_in_picture.dm +++ b/code/_onclick/hud/picture_in_picture.dm @@ -12,7 +12,6 @@ var/obj/screen/component_button/button_shrink var/mutable_appearance/standard_background - var/const/max_dimensions = 10 /obj/screen/movable/pic_in_pic/Initialize() . = ..() @@ -101,9 +100,11 @@ standard_background.transform = M add_overlay(standard_background) +// maximum number of dimensions is 10 + /obj/screen/movable/pic_in_pic/proc/set_view_size(width, height, do_refresh = TRUE) - width = clamp(width, 0, max_dimensions) - height = clamp(height, 0, max_dimensions) + width = clamp(width, 0, 10) + height = clamp(height, 0, 10) src.width = width src.height = height diff --git a/code/controllers/subsystem/dbcore.dm b/code/controllers/subsystem/dbcore.dm index f896159cd44..dbe11d5683a 100644 --- a/code/controllers/subsystem/dbcore.dm +++ b/code/controllers/subsystem/dbcore.dm @@ -3,7 +3,6 @@ SUBSYSTEM_DEF(dbcore) flags = SS_BACKGROUND wait = 1 MINUTES init_order = INIT_ORDER_DBCORE - var/const/FAILED_DB_CONNECTION_CUTOFF = 5 var/failed_connection_timeout = 0 var/schema_mismatch = 0 @@ -68,7 +67,7 @@ SUBSYSTEM_DEF(dbcore) if(failed_connection_timeout <= world.time) //it's been more than 5 seconds since we failed to connect, reset the counter failed_connections = 0 - if(failed_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect for 5 seconds. + if(failed_connections > 5) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect for 5 seconds. failed_connection_timeout = world.time + 50 return FALSE diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 6ae167582b6..d15054b6a9a 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -1,3 +1,5 @@ +#define DEFAULT_MAP_SIZE 15 + /obj/machinery/computer/security name = "security camera console" desc = "Used to access the various cameras on the station." @@ -14,7 +16,6 @@ // Stuff needed to render the map var/map_name - var/const/default_map_size = 15 var/obj/screen/map_view/cam_screen /// All the plane masters that need to be applied. var/list/cam_plane_masters @@ -158,7 +159,7 @@ /obj/machinery/computer/security/proc/show_camera_static() cam_screen.vis_contents.Cut() cam_background.icon_state = "scanline2" - cam_background.fill_rect(1, 1, default_map_size, default_map_size) + cam_background.fill_rect(1, 1, DEFAULT_MAP_SIZE, DEFAULT_MAP_SIZE) // Returns the list of cameras accessible from this computer /obj/machinery/computer/security/proc/get_available_cameras() @@ -335,3 +336,5 @@ name = "\improper AI upload monitor" desc = "A telescreen that connects to the AI upload's camera network." network = list("aiupload") + +#undef DEFAULT_MAP_SIZE diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index a9f7cd2a06c..1323a2dd0c6 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -1,3 +1,15 @@ +#define STATE_DEFAULT 1 +#define STATE_CALLSHUTTLE 2 +#define STATE_CANCELSHUTTLE 3 +#define STATE_MESSAGELIST 4 +#define STATE_VIEWMESSAGE 5 +#define STATE_DELMESSAGE 6 +#define STATE_STATUSDISPLAY 7 +#define STATE_ALERT_LEVEL 8 +#define STATE_CONFIRM_LEVEL 9 +#define STATE_TOGGLE_EMERGENCY 10 +#define STATE_PURCHASE 11 + // The communications computer /obj/machinery/computer/communications name = "communications console" @@ -15,17 +27,6 @@ var/message_cooldown = 0 var/ai_message_cooldown = 0 var/tmp_alertlevel = 0 - var/const/STATE_DEFAULT = 1 - var/const/STATE_CALLSHUTTLE = 2 - var/const/STATE_CANCELSHUTTLE = 3 - var/const/STATE_MESSAGELIST = 4 - var/const/STATE_VIEWMESSAGE = 5 - var/const/STATE_DELMESSAGE = 6 - var/const/STATE_STATUSDISPLAY = 7 - var/const/STATE_ALERT_LEVEL = 8 - var/const/STATE_CONFIRM_LEVEL = 9 - var/const/STATE_TOGGLE_EMERGENCY = 10 - var/const/STATE_PURCHASE = 11 var/stat_msg1 var/stat_msg2 @@ -764,3 +765,15 @@ content = new_content if(new_possible_answers) possible_answers = new_possible_answers + +#undef STATE_DEFAULT +#undef STATE_CALLSHUTTLE +#undef STATE_CANCELSHUTTLE +#undef STATE_MESSAGELIST +#undef STATE_VIEWMESSAGE +#undef STATE_DELMESSAGE +#undef STATE_STATUSDISPLAY +#undef STATE_ALERT_LEVEL +#undef STATE_CONFIRM_LEVEL +#undef STATE_TOGGLE_EMERGENCY +#undef STATE_PURCHASE diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm index b6bede4cc31..9cffc004323 100644 --- a/code/game/objects/items/devices/powersink.dm +++ b/code/game/objects/items/devices/powersink.dm @@ -1,3 +1,7 @@ +#define DISCONNECTED 0 +#define CLAMPED_OFF 1 +#define OPERATING 2 + // Powersink - used to drain station power /obj/item/powersink @@ -20,10 +24,6 @@ var/mode = 0 // 0 = off, 1=clamped (off), 2=operating var/admins_warned = FALSE // stop spam, only warn the admins once that we are about to boom - var/const/DISCONNECTED = 0 - var/const/CLAMPED_OFF = 1 - var/const/OPERATING = 2 - var/obj/structure/cable/attached // the attached cable /obj/item/powersink/update_icon_state() @@ -158,3 +158,7 @@ STOP_PROCESSING(SSobj, src) explosion(src.loc, 4,8,16,32) qdel(src) + +#undef DISCONNECTED +#undef CLAMPED_OFF +#undef OPERATING diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index fd4ab05e364..5ea01783512 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -1,3 +1,5 @@ +#define FREQ_LISTENING (1<<0) + /obj/item/radio icon = 'icons/obj/radio.dmi' name = "station bounced radio" @@ -38,9 +40,6 @@ var/list/channels = list() // Map from name (see communications.dm) to on/off. First entry is current department (:h). var/list/secure_radio_connections - var/const/FREQ_LISTENING = 1 - //FREQ_BROADCASTING = 2 - /obj/item/radio/suicide_act(mob/living/user) user.visible_message("[user] starts bouncing [src] off [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!") return BRUTELOSS @@ -374,7 +373,7 @@ /obj/item/radio/borg/resetChannels() . = ..() - + var/mob/living/silicon/robot/R = loc if(istype(R)) for(var/ch_name in R.module.radio_channels) diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 9045ccd3edf..eedb3c3b439 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -13,7 +13,7 @@ var/obj/item/reagent_containers/spray/cleaner/myspray var/obj/item/lightreplacer/myreplacer var/signs = 0 - var/const/max_signs = 4 + var/max_signs = 4 /obj/structure/janitorialcart/Initialize() diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index b915879539d..bc44fb36226 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -1,3 +1,5 @@ +#define OPEN_DURATION 6 +#define CLOSE_DURATION 6 // A place where tube pods stop, and people can get in or out. // Mappers: use "Generate Instances from Directions" for this @@ -19,9 +21,6 @@ var/base_icon = "station0" var/boarding_dir //from which direction you can board the tube - var/const/OPEN_DURATION = 6 - var/const/CLOSE_DURATION = 6 - /obj/structure/transit_tube/station/New() ..() START_PROCESSING(SSobj, src) @@ -295,3 +294,6 @@ /obj/structure/transit_tube/station/dispenser/reverse/flipped/init_tube_dirs() ..() boarding_dir = dir + +#undef OPEN_DURATION +#undef CLOSE_DURATION diff --git a/code/game/objects/structures/transit_tubes/transit_tube.dm b/code/game/objects/structures/transit_tubes/transit_tube.dm index f68f8acf25a..13d662f7981 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube.dm @@ -12,7 +12,6 @@ var/list/tube_dirs //list of directions this tube section can connect to. var/exit_delay = 1 var/enter_delay = 0 - var/const/time_to_unwrench = 2 SECONDS /obj/structure/transit_tube/CanAllowThrough(atom/movable/mover, turf/target) . = ..() @@ -43,7 +42,7 @@ to_chat(user, "Remove the pod first!") return user.visible_message("[user] starts to detach \the [src].", "You start to detach the [name]...") - if(W.use_tool(src, user, time_to_unwrench, volume=50)) + if(W.use_tool(src, user, 2 SECONDS, volume=50)) to_chat(user, "You detach the [name].") var/obj/structure/c_transit_tube/R = new tube_construction(loc) R.setDir(dir) diff --git a/code/game/objects/structures/transit_tubes/transit_tube_construction.dm b/code/game/objects/structures/transit_tubes/transit_tube_construction.dm index bd445d29d87..c8b3c433557 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_construction.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_construction.dm @@ -9,7 +9,6 @@ density = FALSE layer = LOW_ITEM_LAYER //same as the built tube anchored = FALSE - var/const/time_to_unwrench = 2 SECONDS var/flipped = 0 var/build_type = /obj/structure/transit_tube var/flipped_build_type @@ -46,7 +45,7 @@ return to_chat(user, "You start attaching the [name]...") add_fingerprint(user) - if(I.use_tool(src, user, time_to_unwrench, volume=50, extra_checks=CALLBACK(src, .proc/can_wrench_in_loc, user))) + if(I.use_tool(src, user, 2 SECONDS, volume=50, extra_checks=CALLBACK(src, .proc/can_wrench_in_loc, user))) to_chat(user, "You attach the [name].") var/obj/structure/transit_tube/R = new build_type(loc, dir) transfer_fingerprints_to(R) diff --git a/code/modules/antagonists/disease/disease_mob.dm b/code/modules/antagonists/disease/disease_mob.dm index a1acf4e7321..82cd33c1f2e 100644 --- a/code/modules/antagonists/disease/disease_mob.dm +++ b/code/modules/antagonists/disease/disease_mob.dm @@ -1,3 +1,5 @@ +#define FREEMOVE_TIME 2 MINUTES + /* A mob of type /mob/camera/disease is an overmind coordinating at least one instance of /datum/disease/advance/sentient_disease that has infected a host. All instances in a host will be synchronized with the stats of the overmind's disease_template. Any @@ -23,7 +25,6 @@ the new instance inside the host to be updated to the template's stats. var/freemove = TRUE var/freemove_end = 0 - var/const/freemove_time = 1200 var/freemove_end_timerid var/datum/action/innate/disease_adapt/adaptation_menu_action @@ -67,8 +68,8 @@ the new instance inside the host to be updated to the template's stats. browser = new /datum/browser(src, "disease_menu", "Adaptation Menu", 1000, 770, src) - freemove_end = world.time + freemove_time - freemove_end_timerid = addtimer(CALLBACK(src, .proc/infect_random_patient_zero), freemove_time, TIMER_STOPPABLE) + freemove_end = world.time + FREEMOVE_TIME + freemove_end_timerid = addtimer(CALLBACK(src, .proc/infect_random_patient_zero), FREEMOVE_TIME, TIMER_STOPPABLE) /mob/camera/disease/Destroy() . = ..() @@ -409,3 +410,5 @@ the new instance inside the host to be updated to the template's stats. /datum/action/innate/disease_adapt/Activate() var/mob/camera/disease/D = owner D.adaptation_menu() + +#undef FREEMOVE_TIME diff --git a/code/modules/food_and_drinks/drinks/drinks/bottle.dm b/code/modules/food_and_drinks/drinks/drinks/bottle.dm index 8e01f69763d..72e73765b1b 100644 --- a/code/modules/food_and_drinks/drinks/drinks/bottle.dm +++ b/code/modules/food_and_drinks/drinks/drinks/bottle.dm @@ -17,10 +17,11 @@ inhand_icon_state = "broken_beer" //Generic held-item sprite until unique ones are made. lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi' righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi' - var/const/duration = 13 //Directly relates to the 'knockdown' duration. Lowered by armor (i.e. helmets) isGlass = TRUE foodtype = ALCOHOL age_restricted = TRUE // wrryy can't set an init value to see if foodtype contains ALCOHOL so here we go + ///Directly relates to the 'knockdown' duration. Lowered by armor (i.e. helmets) + var/bottle_knockdown_duration = 1.3 SECONDS /obj/item/reagent_containers/food/drinks/bottle/update_overlays() . = ..() @@ -93,13 +94,13 @@ headarmor = 0 //Calculate the knockdown duration for the target. - armor_duration = (duration - headarmor) + force + armor_duration = (bottle_knockdown_duration - headarmor) + force else //Only humans can have armor, right? armor_block = target.run_armor_check(affecting, "melee") if(affecting == BODY_ZONE_HEAD) - armor_duration = duration + force + armor_duration = bottle_knockdown_duration + force //Apply the damage! armor_block = min(90,armor_block) diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 8ac6a7ef124..45a755e8802 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -26,8 +26,10 @@ var/bomb_active = FALSE // If the bomb is counting down. var/bomb_defused = TRUE // If the bomb is inert. var/bomb_timer = 1 // How long before blowing the bomb. - var/const/BOMB_TIMER_MIN = 1 - var/const/BOMB_TIMER_MAX = 10 + /// Min bomb timer allowed + var/bomb_timer_min = 1 + /// Max bomb timer allower + var/bomb_timer_max = 10 /obj/item/pizzabox/Initialize() . = ..() @@ -124,12 +126,12 @@ update_icon() return else - bomb_timer = input(user, "Set the [bomb] timer from [BOMB_TIMER_MIN] to [BOMB_TIMER_MAX].", bomb, bomb_timer) as num|null + bomb_timer = input(user, "Set the [bomb] timer from [bomb_timer_min] to [bomb_timer_max].", bomb, bomb_timer) as num|null if (isnull(bomb_timer)) return - bomb_timer = clamp(CEILING(bomb_timer / 2, 1), BOMB_TIMER_MIN, BOMB_TIMER_MAX) + bomb_timer = clamp(CEILING(bomb_timer / 2, 1), bomb_timer_min, bomb_timer_max) bomb_defused = FALSE log_bomber(user, "has trapped a", src, "with [bomb] set to [bomb_timer * 2] seconds") diff --git a/code/modules/hydroponics/seed_extractor.dm b/code/modules/hydroponics/seed_extractor.dm index 8b0a37e2fff..f74a6d9374a 100644 --- a/code/modules/hydroponics/seed_extractor.dm +++ b/code/modules/hydroponics/seed_extractor.dm @@ -64,19 +64,16 @@ /// Associated list of seeds, they are all weak refs. We check the len to see how many refs we have for each // seed var/list/piles = list() - /// Starting constants for Refresh parts - var/const/staring_max_seeds = 1000 - var/const/staring_seed_multiplier = 1 - var/max_seeds = staring_max_seeds - var/seed_multiplier = staring_seed_multiplier + var/max_seeds = 1000 + var/seed_multiplier = 1 ui_x = 1000 ui_y = 400 /obj/machinery/seed_extractor/RefreshParts() for(var/obj/item/stock_parts/matter_bin/B in component_parts) - max_seeds = staring_max_seeds * B.rating + max_seeds = initial(max_seeds) * B.rating for(var/obj/item/stock_parts/manipulator/M in component_parts) - seed_multiplier = staring_seed_multiplier * M.rating + seed_multiplier = initial(seed_multiplier) * M.rating /obj/machinery/seed_extractor/examine(mob/user) . = ..() diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index c74fcc352ea..bcd9fc00956 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -3,8 +3,8 @@ /* field_generator power level display - The icon used for the field_generator need to have 'num_power_levels' number of icon states - named 'Field_Gen +p[num]' where 'num' ranges from 1 to 'num_power_levels' + The icon used for the field_generator need to have 6 icon states + named 'Field_Gen +p[num]' where 'num' ranges from 1 to 6 The power level is displayed using overlays. The current displayed power level is stored in 'powerlevel'. The overlay in use and the powerlevel variable must be kept in sync. A powerlevel equal to 0 means that @@ -35,7 +35,6 @@ field_generator power level display CanAtmosPass = ATMOS_PASS_YES //100% immune to lasers and energy projectiles since it absorbs their energy. armor = list("melee" = 25, "bullet" = 10, "laser" = 100, "energy" = 100, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 70) - var/const/num_power_levels = 6 // Total number of power level icon has var/power_level = 0 var/active = FG_OFFLINE var/power = 20 // Current amount of power @@ -171,9 +170,14 @@ field_generator power level display cleanup() return ..() +/* + The power level is displayed using overlays. The current displayed power level is stored in 'powerlevel'. + The overlay in use and the powerlevel variable must be kept in sync. A powerlevel equal to 0 means that + no power level overlay is currently in the overlays list. + */ /obj/machinery/field/generator/proc/check_power_level() - var/new_level = round(num_power_levels * power / field_generator_max_power) + var/new_level = round(6 * power / field_generator_max_power) if(new_level != power_level) power_level = new_level update_icon() @@ -203,7 +207,7 @@ field_generator power level display warming_up++ update_icon() if(warming_up >= 3) - start_fields() + start_fields() else addtimer(CALLBACK(src, .proc/warm_up), 50) @@ -264,7 +268,7 @@ field_generator power level display addtimer(CALLBACK(src, .proc/setup_field, 2), 2) addtimer(CALLBACK(src, .proc/setup_field, 4), 3) addtimer(CALLBACK(src, .proc/setup_field, 8), 4) - addtimer(VARSET_CALLBACK(src, active, FG_ONLINE), 5) + addtimer(VARSET_CALLBACK(src, active, FG_ONLINE), 5) /obj/machinery/field/generator/proc/setup_field(NSEW) var/turf/T = loc @@ -345,13 +349,13 @@ field_generator power level display if(connected_gens.len < 2) return var/CGcounter - for(CGcounter = 1; CGcounter < connected_gens.len, CGcounter++) - + for(CGcounter = 1; CGcounter < connected_gens.len, CGcounter++) + var/list/CGList = ((connected_gens[CGcounter].connected_gens & connected_gens[CGcounter+1].connected_gens)^src) if(!CGList.len) return var/obj/machinery/field/generator/CG = CGList[1] - + var/x_step var/y_step if(CG.x > x && CG.y > y) @@ -370,14 +374,14 @@ field_generator power level display for(x_step=x; x_step >= CG.x; x_step--) for(y_step=y; y_step >= CG.y; y_step--) place_floor(locate(x_step,y_step,z),create) - + /obj/machinery/field/generator/proc/place_floor(Location,create) if(create && !locate(/obj/effect/shield) in Location) new/obj/effect/shield(Location) - else if(!create) + else if(!create) var/obj/effect/shield/S=locate(/obj/effect/shield) in Location - if(S) + if(S) qdel(S) /obj/machinery/field/generator/proc/notify_admins()