diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index f7de10c2a9f..547711c9c17 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -169,23 +169,23 @@ pump_direction = 1 if("set_input_pressure" in signal.data) - input_pressure_min = between( - 0, + input_pressure_min = Clamp( text2num(signal.data["set_input_pressure"]), + 0, ONE_ATMOSPHERE*50 ) if("set_output_pressure" in signal.data) - output_pressure_max = between( - 0, + output_pressure_max = Clamp( text2num(signal.data["set_output_pressure"]), + 0, ONE_ATMOSPHERE*50 ) if("set_external_pressure" in signal.data) - external_pressure_bound = between( - 0, + external_pressure_bound = Clamp( text2num(signal.data["set_external_pressure"]), + 0, ONE_ATMOSPHERE*50 ) diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index a126928e2da..1185463bb7c 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -113,9 +113,9 @@ obj/machinery/atmospherics/binary/passive_gate on = !on if("set_output_pressure" in signal.data) - target_pressure = between( - 0, + target_pressure = Clamp( text2num(signal.data["set_output_pressure"]), + 0, ONE_ATMOSPHERE*50 ) diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index e4d62469ad2..0fdabe08c8b 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -128,9 +128,9 @@ obj/machinery/atmospherics/binary/pump on = !on if("set_output_pressure" in signal.data) - target_pressure = between( - 0, + target_pressure = Clamp( text2num(signal.data["set_output_pressure"]), + 0, ONE_ATMOSPHERE*50 ) diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index e2dddfa97c1..65a51c3dbf0 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -126,9 +126,9 @@ obj/machinery/atmospherics/binary/volume_pump on = !on if("set_transfer_rate" in signal.data) - transfer_rate = between( - 0, + transfer_rate = Clamp( text2num(signal.data["set_transfer_rate"]), + 0, air1.volume ) diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm index 64a016bc626..9bff0a6d72b 100644 --- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm @@ -124,7 +124,7 @@ if("set_volume_rate" in signal.data) var/number = text2num(signal.data["set_volume_rate"]) - volume_rate = between(0, number, air_contents.volume) + volume_rate = Clamp(number, 0, air_contents.volume) if("status" in signal.data) spawn(2) diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index 2c1ff603714..451832c06e0 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -214,30 +214,30 @@ pump_direction = text2num(signal.data["direction"]) if("set_internal_pressure" in signal.data) - internal_pressure_bound = between( - 0, + internal_pressure_bound = Clamp( text2num(signal.data["set_internal_pressure"]), + 0, ONE_ATMOSPHERE*50 ) if("set_external_pressure" in signal.data) - external_pressure_bound = between( - 0, + external_pressure_bound = Clamp( text2num(signal.data["set_external_pressure"]), + 0, ONE_ATMOSPHERE*50 ) if("adjust_internal_pressure" in signal.data) - internal_pressure_bound = between( - 0, + internal_pressure_bound = Clamp( internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]), + 0, ONE_ATMOSPHERE*50 ) if("adjust_external_pressure" in signal.data) - external_pressure_bound = between( - 0, + external_pressure_bound = Clamp( external_pressure_bound + text2num(signal.data["adjust_external_pressure"]), + 0, ONE_ATMOSPHERE*50 ) diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index a08e6827d48..396c25b5e75 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -31,29 +31,28 @@ return "[output][and_text][input[index]]" //Returns list element or null. Should prevent "index out of bounds" error. -proc/listgetindex(var/list/list,index) - if(istype(list) && list.len) +proc/listgetindex(list/L, index) + if(istype(L)) if(isnum(index)) - if(InRange(index,1,list.len)) - return list[index] - else if(index in list) - return list[index] + if(IsInRange(index,1,L.len)) + return L[index] + else if(index in L) + return L[index] return -proc/islist(list/list) - if(istype(list)) +proc/islist(list/L) + if(istype(L)) return 1 return 0 //Return either pick(list) or null if list is not of type /list or is empty -proc/safepick(list/list) - if(!islist(list) || !list.len) - return - return pick(list) +proc/safepick(list/L) + if(istype(L) && L.len) + return pick(L) //Checks if the list is empty -proc/isemptylist(list/list) - if(!list.len) +proc/isemptylist(list/L) + if(!L.len) return 1 return 0 diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm index fc5ad930680..3d749ccfe91 100644 --- a/code/__HELPERS/maths.dm +++ b/code/__HELPERS/maths.dm @@ -3,6 +3,8 @@ var/const/E = 2.71828183 var/const/Sqrt2 = 1.41421356 +/proc/sign(x) + return x!=0?x/abs(x):0 /proc/Atan2(x, y) if(!x && !y) return 0 @@ -110,7 +112,7 @@ var/const/Sqrt2 = 1.41421356 var/t = round((val - min) / d) return val - (t * d) -//polar variant of a gaussian distributed PRNG +//converts a uniform distributed random number into a normal distributed one //since this method produces two random numbers, one is saved for subsequent calls //(making the cost negligble for every second call) //This will return +/- decimals, situated about mean with standard deviation stddev diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index a7c982e108b..4b0e9818a89 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -36,12 +36,6 @@ /proc/dd_range(var/low, var/high, var/num) return max(low,min(high,num)) -//Returns whether or not A is the middle most value -/proc/InRange(var/A, var/lower, var/upper) - if(A < lower) return 0 - if(A > upper) return 0 - return 1 - /proc/Get_Angle(atom/movable/start,atom/movable/end)//For beams. if(!start || !end) return 0 @@ -189,9 +183,6 @@ Turf and target are seperate in case you want to teleport some distance from a t return 1 return 0 -/proc/sign(x) - return x!=0?x/abs(x):0 - /proc/getline(atom/M,atom/N)//Ultra-Fast Bresenham Line-Drawing Algorithm var/px=M.x //starting x var/py=M.y @@ -468,14 +459,6 @@ Turf and target are seperate in case you want to teleport some distance from a t var/M = E/(SPEED_OF_LIGHT_SQ) return M -//Forces a variable to be posative -/proc/modulus(var/M) - if(M >= 0) - return M - if(M < 0) - return -M - - /proc/key_name(var/whom, var/include_link = null, var/include_name = 1) var/mob/M var/client/C @@ -534,15 +517,6 @@ Turf and target are seperate in case you want to teleport some distance from a t /proc/key_name_admin(var/whom, var/include_name = 1) return key_name(whom, 1, include_name) - -//Will return the location of the turf an atom is ultimatly sitting on -/proc/get_turf_loc(var/atom/movable/M) //gets the location of the turf that the atom is on, or what the atom is in is on, etc - //in case they're in a closet or sleeper or something - var/atom/loc = M.loc - while(loc && !istype(loc, /turf/)) - loc = loc.loc - return loc - // 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(var/atom/movable/M) @@ -600,27 +574,10 @@ Turf and target are seperate in case you want to teleport some distance from a t var/y = min(world.maxy, max(1, A.y + dy)) return locate(x,y,A.z) -//Makes sure MIDDLE is between LOW and HIGH. If not, it adjusts it. Returns the adjusted value. -/proc/between(var/low, var/middle, var/high) - return max(min(middle, high), low) - proc/arctan(x) var/y=arcsin(x/sqrt(1+x*x)) return y -//returns random gauss number -proc/GaussRand(var/sigma) - var/x,y,rsq - do - x=2*rand()-1 - y=2*rand()-1 - rsq=x*x+y*y - while(rsq>1 || !rsq) - return sigma*y*sqrt(-2*log(rsq)/rsq) - -//returns random gauss number, rounded to 'roundto' -proc/GaussRandRound(var/sigma,var/roundto) - return round(GaussRand(sigma),roundto) proc/anim(turf/location as turf,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. @@ -755,10 +712,9 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl //Returns: all the areas in the world /proc/return_areas() - var/list/area/areas = list() + . = list() for(var/area/A in world) - areas += A - return areas + . += A //Returns: all the areas in the world, sorted. /proc/return_sorted_areas() @@ -1155,14 +1111,6 @@ proc/oview_or_orange(distance = world.view , center = usr , type) . = orange(distance,center) return -proc/get_mob_with_client_list() - var/list/mobs = list() - for(var/mob/M in world) - if (M.client) - mobs += M - return mobs - - /proc/parse_zone(zone) if(zone == "r_hand") return "right hand" else if (zone == "l_hand") return "left hand" @@ -1175,12 +1123,11 @@ proc/get_mob_with_client_list() else return zone -/proc/get_turf(turf/location) - while(location) - if(isturf(location)) - return location - location = location.loc - return null +/proc/get_turf(atom/movable/AM) + if(istype(AM)) + return locate(/turf) in AM.locs + else if(isturf(AM)) + return AM /proc/get(atom/loc, type) while(loc) @@ -1189,10 +1136,6 @@ proc/get_mob_with_client_list() loc = loc.loc return null -/proc/get_turf_or_move(turf/location) - return get_turf(location) - - //Quick type checks for some tools var/global/list/common_tools = list( /obj/item/weapon/cable_coil, @@ -1208,46 +1151,6 @@ var/global/list/common_tools = list( return 1 return 0 -/proc/iswrench(O) - if(istype(O, /obj/item/weapon/wrench)) - return 1 - return 0 - -/proc/iswelder(O) - if(istype(O, /obj/item/weapon/weldingtool)) - return 1 - return 0 - -/proc/iscoil(O) - if(istype(O, /obj/item/weapon/cable_coil)) - return 1 - return 0 - -/proc/iswirecutter(O) - if(istype(O, /obj/item/weapon/wirecutters)) - return 1 - return 0 - -/proc/isscrewdriver(O) - if(istype(O, /obj/item/weapon/screwdriver)) - return 1 - return 0 - -/proc/ismultitool(O) - if(istype(O, /obj/item/device/multitool)) - return 1 - return 0 - -/proc/iscrowbar(O) - if(istype(O, /obj/item/weapon/crowbar)) - return 1 - return 0 - -/proc/iswire(O) - if(istype(O, /obj/item/weapon/cable_coil)) - return 1 - return 0 - proc/is_hot(obj/item/W as obj) switch(W.type) if(/obj/item/weapon/weldingtool) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 95a095920e9..e1a11e22f44 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -105,14 +105,14 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown", var/obj/item/I = L.get_active_hand() holder.add_hiddenprint(L) if(href_list["cut"]) // Toggles the cut/mend status - if(iswirecutter(I)) + if(istype(I, /obj/item/weapon/wirecutters)) var/colour = href_list["cut"] CutWireColour(colour) else L << "You need wirecutters!" else if(href_list["pulse"]) - if(ismultitool(I)) + if(istype(I, /obj/item/device/multitool)) var/colour = href_list["pulse"] PulseColour(colour) else diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 0d4634fe21e..32f16352f49 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -242,6 +242,8 @@ var/global/datum/controller/gameticker/ticker else player.create_character() del(player) + else + player.new_player_panel() proc/collect_minds() diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index c74b90627d1..dccfb930f63 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -1090,7 +1090,7 @@ Code shamelessly copied from apc_frame if (!(ndir in cardinal)) return - var/turf/loc = get_turf_loc(usr) + var/turf/loc = get_turf(usr) var/area/A = loc.loc if (!istype(loc, /turf/simulated/floor)) usr << "\red Air Alarm cannot be placed on this spot." @@ -1452,7 +1452,7 @@ Code shamelessly copied from apc_frame if (!(ndir in cardinal)) return - var/turf/loc = get_turf_loc(usr) + var/turf/loc = get_turf(usr) var/area/A = loc.loc if (!istype(loc, /turf/simulated/floor)) usr << "\red Fire Alarm cannot be placed on this spot." diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm index 41aa8db4bfd..95031cc99dd 100644 --- a/code/game/machinery/atmo_control.dm +++ b/code/game/machinery/atmo_control.dm @@ -255,7 +255,7 @@ Rate: [volume_rate] L/sec
"} if(href_list["adj_pressure"]) var/change = text2num(href_list["adj_pressure"]) - pressure_setting = between(0, pressure_setting + change, 50*ONE_ATMOSPHERE) + pressure_setting = Clamp(pressure_setting + change, 0, 50*ONE_ATMOSPHERE) spawn(1) src.updateDialog() return diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 6e6c664f8a7..ebbe904f6e1 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -103,7 +103,7 @@ /obj/machinery/camera/attackby(W as obj, mob/living/user as mob) // DECONSTRUCTION - if(isscrewdriver(W)) + if(istype(W, /obj/item/weapon/screwdriver)) //user << "You start to [panel_open ? "close" : "open"] the camera's panel." //if(toggle_panel(user)) // No delay because no one likes screwdrivers trying to be hip and have a duration cooldown panel_open = !panel_open @@ -111,10 +111,10 @@ "You screw the camera's panel [panel_open ? "open" : "closed"].") playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - else if((iswirecutter(W) || ismultitool(W)) && panel_open) + else if((istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/device/multitool)) && panel_open) wires.Interact(user) - else if(iswelder(W) && wires.CanDeconstruct()) + else if(istype(W, /obj/item/weapon/weldingtool) && wires.CanDeconstruct()) if(weld(W, user)) if(assembly) assembly.loc = src.loc diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index c67a5a77b19..a18ab5f4dbf 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -28,7 +28,7 @@ if(0) // State 0 - if(iswrench(W) && isturf(src.loc)) + if(istype(W, /obj/item/weapon/wrench) && isturf(src.loc)) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You wrench the assembly into place." anchored = 1 @@ -39,14 +39,14 @@ if(1) // State 1 - if(iswelder(W)) + if(istype(W, /obj/item/weapon/weldingtool)) if(weld(W, user)) user << "You weld the assembly securely into place." anchored = 1 state = 2 return - else if(iswrench(W)) + else if(istype(W, /obj/item/weapon/wrench)) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You unattach the assembly from it's place." anchored = 0 @@ -56,14 +56,14 @@ if(2) // State 2 - if(iscoil(W)) + if(istype(W, /obj/item/weapon/cable_coil)) var/obj/item/weapon/cable_coil/C = W if(C.use(2)) user << "You add wires to the assembly." state = 3 return - else if(iswelder(W)) + else if(istype(W, /obj/item/weapon/weldingtool)) if(weld(W, user)) user << "You unweld the assembly from it's place." @@ -74,7 +74,7 @@ if(3) // State 3 - if(isscrewdriver(W)) + if(istype(W, /obj/item/weapon/screwdriver)) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) var/input = strip_html(input(usr, "Which networks would you like to connect this camera to? Seperate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13")) @@ -108,7 +108,7 @@ break return - else if(iswirecutter(W)) + else if(istype(W, /obj/item/weapon/wirecutters)) new/obj/item/weapon/cable_coil(get_turf(src), 2) playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) @@ -125,7 +125,7 @@ return // Taking out upgrades - else if(iscrowbar(W) && upgrades.len) + else if(istype(W, /obj/item/weapon/crowbar) && upgrades.len) var/obj/U = locate(/obj) in upgrades if(U) user << "You unattach an upgrade from the assembly." diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index caaffaec921..10c1136a55b 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -57,7 +57,7 @@ message = rebootmsg else user << "A no server error appears on the screen." - if(isscrewdriver(O) && emag) + if(istype(O, /obj/item/weapon/screwdriver) && emag) //Stops people from just unscrewing the monitor and putting it back to get the console working again. user << "It is too hot to mess with!" return diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index d6aec34a9d6..a53f0032541 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -47,7 +47,7 @@ var/loc_display = "Unknown" var/mob/living/carbon/M = T.imp_in if(M.z == 1 && !istype(M.loc, /turf/space)) - var/turf/mob_loc = get_turf_loc(M) + var/turf/mob_loc = get_turf(M) loc_display = mob_loc.loc dat += "ID: [T.id] | Location: [loc_display]
" dat += "(Message Holder) |
" diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 98af012d467..1f59dbe475a 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -215,7 +215,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() var/datum/gas_mixture/environment = loc.return_air() switch(environment.temperature) if(T0C to (T20C + 20)) - integrity = between(0, integrity, 100) + integrity = Clamp(integrity, 0, 100) if((T20C + 20) to (T0C + 70)) integrity = max(0, integrity - 1) if(delay) diff --git a/code/game/machinery/turrets.dm b/code/game/machinery/turrets.dm index eb2a41add43..3a50e4ef09d 100644 --- a/code/game/machinery/turrets.dm +++ b/code/game/machinery/turrets.dm @@ -555,7 +555,7 @@ if(src) src.process() if(href_list["scan_range"]) - src.scan_range = between(1,src.scan_range+text2num(href_list["scan_range"]),8) + src.scan_range = Clamp(src.scan_range+text2num(href_list["scan_range"]), 1, 8) if(href_list["scan_for"]) if(href_list["scan_for"] in scan_for) scan_for[href_list["scan_for"]] = !scan_for[href_list["scan_for"]] @@ -626,20 +626,23 @@ var/target_y = targloc.y var/target_z = targloc.z targloc = null - spawn for(var/i=1 to min(projectiles, projectiles_per_shot)) - if(!src) break - var/turf/curloc = get_turf(src) - targloc = locate(target_x+GaussRandRound(deviation,1),target_y+GaussRandRound(deviation,1),target_z) - if (!targloc || !curloc) - continue - if (targloc == curloc) - continue - playsound(src, 'sound/weapons/Gunshot.ogg', 50, 1) - var/obj/item/projectile/A = new /obj/item/projectile(curloc) - src.projectiles-- - A.current = curloc - A.yo = targloc.y - curloc.y - A.xo = targloc.x - curloc.x - A.process() - sleep(2) + spawn(-1) + for(var/i=1 to min(projectiles, projectiles_per_shot)) + if(!src) break + var/turf/curloc = get_turf(src) + var/dx = round(gaussian(0,deviation),1) + var/dy = round(gaussian(0,deviation),1) + targloc = locate(target_x+dx, target_y+dy, target_z) + if (!targloc || !curloc) + continue + if (targloc == curloc) + continue + playsound(src, 'sound/weapons/Gunshot.ogg', 50, 1) + var/obj/item/projectile/A = new /obj/item/projectile(curloc) + src.projectiles-- + A.current = curloc + A.yo = targloc.y - curloc.y + A.xo = targloc.x - curloc.x + A.process() + sleep(2) return diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm index 91b2455eb03..b1e5519eb5f 100644 --- a/code/game/mecha/equipment/weapons/weapons.dm +++ b/code/game/mecha/equipment/weapons/weapons.dm @@ -203,7 +203,9 @@ var/target_z = targloc.z targloc = null for(var/i=1 to min(projectiles, projectiles_per_shot)) - targloc = locate(target_x+GaussRandRound(deviation,1),target_y+GaussRandRound(deviation,1),target_z) + var/dx = round(gaussian(0,deviation),1) + var/dy = round(gaussian(0,deviation),1) + targloc = locate(target_x+dx, target_y+dy, target_z) if(!targloc || targloc == curloc) break playsound(chassis, fire_sound, 80, 1) @@ -242,7 +244,9 @@ spawn for(var/i=1 to min(projectiles, projectiles_per_shot)) if(!chassis) break var/turf/curloc = get_turf(chassis) - targloc = locate(target_x+GaussRandRound(deviation,1),target_y+GaussRandRound(deviation,1),target_z) + var/dx = round(gaussian(0,deviation),1) + var/dy = round(gaussian(0,deviation),1) + targloc = locate(target_x+dx, target_y+dy, target_z) if (!targloc || !curloc) continue if (targloc == curloc) diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index b4b42dc48f1..8bf093cf18b 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -642,7 +642,7 @@ var/index = filter.getNum("index") var/new_index = index + filter.getNum("queue_move") if(isnum(index) && isnum(new_index)) - if(InRange(new_index,1,queue.len)) + if(IsInRange(new_index,1,queue.len)) queue.Swap(index,new_index) return update_queue_on_page() if(href_list["clear_queue"]) diff --git a/code/game/objects/items/apc_frame.dm b/code/game/objects/items/apc_frame.dm index 5a4bb811e24..4ed920fd12e 100644 --- a/code/game/objects/items/apc_frame.dm +++ b/code/game/objects/items/apc_frame.dm @@ -19,7 +19,7 @@ var/ndir = get_dir(usr,on_wall) if (!(ndir in cardinal)) return - var/turf/loc = get_turf_loc(usr) + var/turf/loc = get_turf(usr) var/area/A = loc.loc if (!istype(loc, /turf/simulated/floor)) usr << "\red APC cannot be placed on this spot." diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index aa8f419b575..d8479d11d99 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -74,7 +74,7 @@ move an amendment to the drawing.

/obj/item/blueprints/proc/get_area() - var/turf/T = get_turf_loc(usr) + var/turf/T = get_turf(usr) var/area/A = T.loc A = A.master return A @@ -101,7 +101,7 @@ move an amendment to the drawing.

/obj/item/blueprints/proc/create_area() //world << "DEBUG: create_area" - var/res = detect_room(get_turf_loc(usr)) + var/res = detect_room(get_turf(usr)) if(!istype(res,/list)) switch(res) if(ROOM_ERR_SPACE) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index bb1ce45aa6a..dee3f31e07d 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -392,7 +392,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if (3) dat += "

Atmospheric Readings

" - var/turf/T = get_turf_or_move(user.loc) + var/turf/T = get_turf(user.loc) if (isnull(T)) dat += "Unable to obtain a reading.
" else @@ -655,7 +655,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if("1") // Configure pAI device pai.attack_self(U) if("2") // Eject pAI device - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) if(T) pai.loc = T diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm index 4172df49e43..99f190f0b13 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -126,7 +126,7 @@ if(9) src.overlays += "pai-what" /obj/item/device/paicard/proc/alertUpdate() - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) for (var/mob/M in viewers(T)) M.show_message("\blue [src] flashes a message across its screen, \"Additional personalities available for download.\"", 3, "\blue [src] bleeps electronically.", 2) diff --git a/code/game/objects/items/shooting_range.dm b/code/game/objects/items/shooting_range.dm index 7e43819fb94..5b42a14cafa 100644 --- a/code/game/objects/items/shooting_range.dm +++ b/code/game/objects/items/shooting_range.dm @@ -61,7 +61,7 @@ user.put_in_hands(src) user << "You take the target out of the stake." else - src.loc = get_turf_loc(user) + src.loc = get_turf(user) user << "You take the target out of the stake." stake.pinned_target = null diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm index 315c86c5b0e..fab2c57a415 100644 --- a/code/game/objects/items/weapons/explosives.dm +++ b/code/game/objects/items/weapons/explosives.dm @@ -36,10 +36,10 @@ return . /obj/item/weapon/plastique/attackby(var/obj/item/I, var/mob/user) - if(isscrewdriver(I)) + if(istype(I, /obj/item/weapon/screwdriver)) open_panel = !open_panel user << "You [open_panel ? "open" : "close"] the wire panel." - else if(iswirecutter(I) || ismultitool(I) || istype(I, /obj/item/device/assembly/signaler )) + else if(istype(I, /obj/item/weapon/wirecutters) || istype(I, /obj/item/device/multitool) || istype(I, /obj/item/device/assembly/signaler )) wires.Interact(user) else ..() diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index 39fed529c46..9eaf50fc810 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -70,7 +70,7 @@ /obj/item/weapon/flamethrower/attackby(obj/item/W as obj, mob/user as mob) if(user.stat || user.restrained() || user.lying) return - if(iswrench(W) && !status)//Taking this apart + if(istype(W, /obj/item/weapon/wrench) && !status)//Taking this apart var/turf/T = get_turf(src) if(weldtool) weldtool.loc = T @@ -85,7 +85,7 @@ del(src) return - if(isscrewdriver(W) && igniter && !lit) + if(istype(W, /obj/item/weapon/screwdriver) && igniter && !lit) status = !status user << "[igniter] is now [status ? "secured" : "unsecured"]!" update_icon() diff --git a/code/game/objects/items/weapons/grenades/grenade.dm b/code/game/objects/items/weapons/grenades/grenade.dm index 035ef2f3ee1..ba91c899ac8 100644 --- a/code/game/objects/items/weapons/grenades/grenade.dm +++ b/code/game/objects/items/weapons/grenades/grenade.dm @@ -79,7 +79,7 @@ /obj/item/weapon/grenade/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(isscrewdriver(W)) + if(istype(W, /obj/item/weapon/screwdriver)) switch(det_time) if ("1") det_time = 10 diff --git a/code/game/objects/structures/crates_lockers/bins.dm b/code/game/objects/structures/crates_lockers/bins.dm index 8bde5dc87a2..2304c964bea 100644 --- a/code/game/objects/structures/crates_lockers/bins.dm +++ b/code/game/objects/structures/crates_lockers/bins.dm @@ -38,7 +38,7 @@ O.loc = T T.update_icon() animate() - else if(iswrench(W)) + else if(istype(W, /obj/item/weapon/wrench)) anchored = !anchored playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) else if(istype(W, /obj/item/weapon/grab)) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index dd3023413f4..7c5b83ac78c 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -99,12 +99,12 @@ return 0 /obj/structure/grille/attackby(obj/item/weapon/W as obj, mob/user as mob) - if(iswirecutter(W)) + if(istype(W, /obj/item/weapon/wirecutters)) if(!shock(user, 100)) playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1) new /obj/item/stack/rods(loc) del(src) - else if((isscrewdriver(W)) && (istype(loc, /turf/simulated) || anchored)) + else if((istype(W, /obj/item/weapon/screwdriver)) && (istype(loc, /turf/simulated) || anchored)) if(!shock(user, 90)) playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1) anchored = !anchored diff --git a/code/game/objects/structures/target_stake.dm b/code/game/objects/structures/target_stake.dm index 1e9ac37a558..2a8d7719b2a 100644 --- a/code/game/objects/structures/target_stake.dm +++ b/code/game/objects/structures/target_stake.dm @@ -46,7 +46,7 @@ user.put_in_hands(pinned_target) user << "You take the target out of the stake." else - pinned_target.loc = get_turf_loc(user) + pinned_target.loc = get_turf(user) user << "You take the target out of the stake." pinned_target = null \ No newline at end of file diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 933632719d5..b126362a9ea 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -425,7 +425,7 @@ if(M) dat += "[M.real_name][M.client ? "" : " (logged out)"][M.stat == 2 ? " (DEAD)" : ""]" dat += "PM" - var/turf/mob_loc = get_turf_loc(M) + var/turf/mob_loc = get_turf(M) dat += "[mob_loc.loc]" else dat += "Head not found!" diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm index ce338bfd3e6..8cdc2454dd9 100644 --- a/code/modules/admin/verbs/playsound.dm +++ b/code/modules/admin/verbs/playsound.dm @@ -22,7 +22,7 @@ log_admin("[key_name(src)] played a local sound [S]") message_admins("[key_name_admin(src)] played a local sound [S]", 1) - playsound(get_turf_loc(src.mob), S, 50, 0, 0) + playsound(get_turf(src.mob), S, 50, 0, 0) feedback_add_details("admin_verb","PLS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 56bbc795911..978cf6ea440 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -91,7 +91,7 @@ return if(!M) - M = input("Direct narrate to who?", "Active Players") as null|anything in get_mob_with_client_list() + M = input("Direct narrate to who?", "Active Players") as null|anything in player_list if(!M) return diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 963b26147a7..ddcefd3eb5f 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -110,7 +110,7 @@ if((!A.secured) && (!secured)) attach_assembly(A,user) return - if(isscrewdriver(W)) + if(istype(W, /obj/item/weapon/screwdriver)) if(toggle_secure()) user << "\blue \The [src] is ready!" else diff --git a/code/modules/assembly/holder.dm b/code/modules/assembly/holder.dm index 154a7785353..ae48d780dfb 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -141,7 +141,7 @@ attackby(obj/item/weapon/W as obj, mob/user as mob) - if(isscrewdriver(W)) + if(istype(W, /obj/item/weapon/screwdriver)) if(!a_left || !a_right) user << "\red BUG:Assembly part missing, please report this!" return diff --git a/code/modules/events/bluespaceanomaly.dm b/code/modules/events/bluespaceanomaly.dm index e04f4349fea..d6f57c81413 100644 --- a/code/modules/events/bluespaceanomaly.dm +++ b/code/modules/events/bluespaceanomaly.dm @@ -57,7 +57,7 @@ // Calculate previous position for transition var/turf/FROM = T // the turf of origin we're travelling FROM - var/turf/TO = get_turf_loc(chosen) // the turf of origin we're travelling TO + var/turf/TO = get_turf(chosen) // the turf of origin we're travelling TO playsound(TO, 'sound/effects/phasein.ogg', 100, 1) diff --git a/code/modules/events/ninja.dm b/code/modules/events/ninja.dm index f0a6961d936..58b0b9213a8 100644 --- a/code/modules/events/ninja.dm +++ b/code/modules/events/ninja.dm @@ -1640,7 +1640,7 @@ ________________________________________________________________________________ dat += "" if(1) dat += "

Atmospheric Scan:

"//Headers don't need breaks. They are automatically placed. - var/turf/T = get_turf_or_move(U.loc) + var/turf/T = get_turf(U.loc) if (isnull(T)) dat += "Unable to obtain a reading." else diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm index d51309b736d..9023bc9b1d6 100644 --- a/code/modules/mining/mint.dm +++ b/code/modules/mining/mint.dm @@ -146,7 +146,7 @@ if(href_list["choose"]) chosen = href_list["choose"] if(href_list["chooseAmt"]) - coinsToProduce = between(0, coinsToProduce + text2num(href_list["chooseAmt"]), 1000) + coinsToProduce = Clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000) if(href_list["makeCoins"]) var/temp_coins = coinsToProduce if (src.output) diff --git a/code/modules/mob/living/silicon/pai/hud.dm b/code/modules/mob/living/silicon/pai/hud.dm index c1f1a4b3eda..a7838cf25b9 100644 --- a/code/modules/mob/living/silicon/pai/hud.dm +++ b/code/modules/mob/living/silicon/pai/hud.dm @@ -7,7 +7,7 @@ /mob/living/silicon/pai/proc/securityHUD() if(client) var/image/holder - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) for(var/mob/living/carbon/human/perp in view(T)) var/perpname = "wot" holder = perp.hud_list[ID_HUD] @@ -49,7 +49,7 @@ /mob/living/silicon/pai/proc/medicalHUD() if(client) var/image/holder - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) for(var/mob/living/carbon/human/patient in view(T)) var/foundVirus = 0 diff --git a/code/modules/mob/living/silicon/pai/life.dm b/code/modules/mob/living/silicon/pai/life.dm index 61bbd2c33d7..e2c43d482f1 100644 --- a/code/modules/mob/living/silicon/pai/life.dm +++ b/code/modules/mob/living/silicon/pai/life.dm @@ -3,7 +3,7 @@ return if(src.cable) if(get_dist(src, src.cable) > 1) - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) for (var/mob/M in viewers(T)) M.show_message("\red [src.cable] rapidly retracts back into its spool.", 3, "\red You hear a click and the sound of wire spooling rapidly.", 2) del(src.cable) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 65eeb9d19aa..1766c59348b 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -121,7 +121,7 @@ src.silence_time = world.timeofday + 120 * 10 // Silence for 2 minutes src << "Communication circuit overload. Shutting down and reloading communication circuits - speech and messaging functionality will be unavailable until the reboot is complete." if(prob(20)) - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) for (var/mob/M in viewers(T)) M.show_message("\red A shower of sparks spray from [src]'s inner workings.", 3, "\red You hear and smell the ozone hiss of electrical sparks being expelled violently.", 2) return src.death(0) diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index d97e8c1f691..e83a5173066 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -262,7 +262,7 @@ if(href_list["cancel"]) src.hackdoor = null if(href_list["cable"]) - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) src.cable = new /obj/item/weapon/pai_cable(T) for (var/mob/M in viewers(T)) M.show_message("\red A port on [src] opens to reveal [src.cable], which promptly falls to the floor.", 3, "\red You hear the soft click of something light and hard falling to the ground.", 2) @@ -370,7 +370,7 @@ /mob/living/silicon/pai/proc/CheckDNA(mob/living/carbon/M, mob/living/silicon/pai/P) var/answer = input(M, "[P] is requesting a DNA sample from you. Will you allow it to confirm your identity?", "[P] Check DNA", "No") in list("Yes", "No") if(answer == "Yes") - var/turf/T = get_turf_or_move(P.loc) + var/turf/T = get_turf(P.loc) for (var/mob/v in viewers(T)) v.show_message("\blue [M] presses \his thumb against [P].", 3, "\blue [P] makes a sharp clicking sound as it extracts DNA material from [M].", 2) if(!check_dna_integrity(M)) @@ -531,7 +531,7 @@ /mob/living/silicon/pai/proc/softwareAtmo() var/dat = "

Atmospheric Sensor

" - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) if (isnull(T)) dat += "Unable to obtain a reading.
" else @@ -608,7 +608,7 @@ // Door Jack - supporting proc /mob/living/silicon/pai/proc/hackloop() - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf(src.loc) for(var/mob/living/silicon/ai/AI in player_list) if(T.loc) AI << "Network Alert: Brute-force encryption crack in progress in [T.loc]." diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 27d4d5d80c0..667acfb45a8 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -18,12 +18,7 @@ tag = "mob_[next_mob_id++]" mob_list += src - verb/new_player_panel() - set src = usr - new_player_panel_proc() - - - proc/new_player_panel_proc() + proc/new_player_panel() var/output = "

Setup Character

" @@ -100,7 +95,7 @@ if(href_list["refresh"]) src << browse(null, "window=playersetup") //closes the player setup window - new_player_panel_proc() + new_player_panel() if(href_list["observe"]) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 0d69e59f794..da28c138593 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -320,7 +320,7 @@ user << "You start adding cables to the APC frame..." playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) if(do_after(user, 20) && C.amount >= 10) - var/turf/T = get_turf_loc(src) + var/turf/T = get_turf(src) var/obj/structure/cable/N = T.get_cable_node() if (prob(50) && electrocute_mob(usr, N, N)) var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 70da53ed059..e9e30e975ec 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -34,7 +34,7 @@ var/ndir = get_dir(usr,on_wall) if (!(ndir in cardinal)) return - var/turf/loc = get_turf_loc(usr) + var/turf/loc = get_turf(usr) if (!istype(loc, /turf/simulated/floor)) usr << "\red [src.name] cannot be placed on this spot." return diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index edd773ec4ae..b0e29ea970c 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -44,7 +44,7 @@ field_generator power level display // Scale % power to % num_power_levels and truncate value var/level = round(num_power_levels * power / field_generator_max_power) // Clamp between 0 and num_power_levels for out of range power values - level = between(0, level, num_power_levels) + level = Clamp(level, 0, num_power_levels) if(level) overlays += "+p[level]" diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index 852d5f93ea9..896ea2af974 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -211,35 +211,35 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps if(0) - if(iswrench(O)) + if(istype(O, /obj/item/weapon/wrench)) playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) src.anchored = 1 user.visible_message("[user.name] secures the [src.name] to the floor.", \ "You secure the external bolts.") temp_state++ if(1) - if(iswrench(O)) + if(istype(O, /obj/item/weapon/wrench)) playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) src.anchored = 0 user.visible_message("[user.name] detaches the [src.name] from the floor.", \ "You remove the external bolts.") temp_state-- - else if(iscoil(O)) + else if(istype(O, /obj/item/weapon/cable_coil)) if(O:use(1,user)) user.visible_message("[user.name] adds wires to the [src.name].", \ "You add some wires.") temp_state++ if(2) - if(iswirecutter(O))//TODO:Shock user if its on? + if(istype(O, /obj/item/weapon/wirecutters))//TODO:Shock user if its on? user.visible_message("[user.name] removes some wires from the [src.name].", \ "You remove some wires.") temp_state-- - else if(isscrewdriver(O)) + else if(istype(O, /obj/item/weapon/screwdriver)) user.visible_message("[user.name] closes the [src.name]'s access panel.", \ "You close the access panel.") temp_state++ if(3) - if(isscrewdriver(O)) + if(istype(O, /obj/item/weapon/screwdriver)) user.visible_message("[user.name] opens the [src.name]'s access panel.", \ "You open the access panel.") temp_state-- @@ -362,35 +362,35 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin var/temp_state = src.construction_state switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps if(0) - if(iswrench(O)) + if(istype(O, /obj/item/weapon/wrench)) playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) src.anchored = 1 user.visible_message("[user.name] secures the [src.name] to the floor.", \ "You secure the external bolts.") temp_state++ if(1) - if(iswrench(O)) + if(istype(O, /obj/item/weapon/wrench)) playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) src.anchored = 0 user.visible_message("[user.name] detaches the [src.name] from the floor.", \ "You remove the external bolts.") temp_state-- - else if(iscoil(O)) + else if(istype(O, /obj/item/weapon/cable_coil)) if(O:use(1)) user.visible_message("[user.name] adds wires to the [src.name].", \ "You add some wires.") temp_state++ if(2) - if(iswirecutter(O))//TODO:Shock user if its on? + if(istype(O, /obj/item/weapon/wirecutters))//TODO:Shock user if its on? user.visible_message("[user.name] removes some wires from the [src.name].", \ "You remove some wires.") temp_state-- - else if(isscrewdriver(O)) + else if(istype(O, /obj/item/weapon/screwdriver)) user.visible_message("[user.name] closes the [src.name]'s access panel.", \ "You close the access panel.") temp_state++ if(3) - if(isscrewdriver(O)) + if(istype(O, /obj/item/weapon/screwdriver)) user.visible_message("[user.name] opens the [src.name]'s access panel.", \ "You open the access panel.") temp_state-- diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 0114aa50994..d9fcccdb536 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -63,7 +63,7 @@ var/list/solars_list = list() /obj/machinery/power/solar/attackby(obj/item/weapon/W, mob/user) - if(iscrowbar(W)) + if(istype(W, /obj/item/weapon/crowbar)) playsound(src.loc, 'sound/machines/click.ogg', 50, 1) if(do_after(user, 50)) var/obj/item/solar_assembly/S = locate() in src @@ -218,13 +218,13 @@ var/list/solars_list = list() /obj/item/solar_assembly/attackby(var/obj/item/weapon/W, var/mob/user) if(!anchored && isturf(loc)) - if(iswrench(W)) + if(istype(W, /obj/item/weapon/wrench)) anchored = 1 user.visible_message("[user] wrenches the solar assembly into place.") playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) return 1 else - if(iswrench(W)) + if(istype(W, /obj/item/weapon/wrench)) anchored = 0 user.visible_message("[user] unwrenches the solar assembly from it's place.") playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) @@ -251,7 +251,7 @@ var/list/solars_list = list() user.visible_message("[user] inserts the electronics into the solar assembly.") return 1 else - if(iscrowbar(W)) + if(istype(W, /obj/item/weapon/crowbar)) new /obj/item/weapon/tracker_electronics(src.loc) tracker = 0 user.visible_message("[user] takes out the electronics from the solar assembly.") diff --git a/code/modules/power/tracker.dm b/code/modules/power/tracker.dm index 3312ff9deee..24895c8b350 100644 --- a/code/modules/power/tracker.dm +++ b/code/modules/power/tracker.dm @@ -56,7 +56,7 @@ /obj/machinery/power/tracker/attackby(var/obj/item/weapon/W, var/mob/user) - if(iscrowbar(W)) + if(istype(W, /obj/item/weapon/crowbar)) playsound(src.loc, 'sound/machines/click.ogg', 50, 1) if(do_after(user, 50)) var/obj/item/solar_assembly/S = locate() in src diff --git a/code/modules/reagents/Chemistry-Recipes.dm b/code/modules/reagents/Chemistry-Recipes.dm index 9e7f735cfb9..9f704ada893 100644 --- a/code/modules/reagents/Chemistry-Recipes.dm +++ b/code/modules/reagents/Chemistry-Recipes.dm @@ -757,8 +757,8 @@ datum if(chosen) // Calculate previous position for transition - var/turf/FROM = get_turf_loc(holder.my_atom) // the turf of origin we're travelling FROM - var/turf/TO = get_turf_loc(chosen) // the turf of origin we're travelling TO + var/turf/FROM = get_turf(holder.my_atom) // the turf of origin we're travelling FROM + var/turf/TO = get_turf(chosen) // the turf of origin we're travelling TO playsound(TO, 'sound/effects/phasein.ogg', 100, 1) @@ -819,16 +819,16 @@ datum )//exclusion list for things you don't want the reaction to create. var/list/critters = typesof(/mob/living/simple_animal/hostile) - blocked // list of possible hostile mobs - playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) + playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) - for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null)) if(M:eyecheck() <= 0) flick("e_flash", M.flash) for(var/i = 1, i <= created_volume, i++) var/chosen = pick(critters) var/mob/living/simple_animal/hostile/C = new chosen - C.loc = get_turf_loc(holder.my_atom) + C.loc = get_turf(holder.my_atom) if(prob(50)) for(var/j = 1, j <= rand(1, 3), j++) step(C, pick(NORTH,SOUTH,EAST,WEST)) @@ -845,9 +845,9 @@ datum var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/snacks) - /obj/item/weapon/reagent_containers/food/snacks // BORK BORK BORK - playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) + playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) - for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null)) if(M:eyecheck() <= 0) flick("e_flash", M.flash) @@ -855,7 +855,7 @@ datum var/chosen = pick(borks) var/obj/B = new chosen if(B) - B.loc = get_turf_loc(holder.my_atom) + B.loc = get_turf(holder.my_atom) if(prob(50)) for(var/j = 1, j <= rand(1, 3), j++) step(B, pick(NORTH,SOUTH,EAST,WEST)) @@ -926,10 +926,10 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red Infused with plasma, the core begins to quiver and grow, and soon a new baby slime emerges from it!"), 1) var/mob/living/carbon/slime/S = new /mob/living/carbon/slime - S.loc = get_turf_loc(holder.my_atom) + S.loc = get_turf(holder.my_atom) slimemonkey @@ -944,7 +944,7 @@ datum feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") for(var/i = 1, i <= 3, i++) var /obj/item/weapon/reagent_containers/food/snacks/monkeycube/M = new /obj/item/weapon/reagent_containers/food/snacks/monkeycube - M.loc = get_turf_loc(holder.my_atom) + M.loc = get_turf(holder.my_atom) //Green slimemutate @@ -971,10 +971,10 @@ datum feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/stack/sheet/metal/M = new /obj/item/stack/sheet/metal M.amount = 15 - M.loc = get_turf_loc(holder.my_atom) + M.loc = get_turf(holder.my_atom) var/obj/item/stack/sheet/plasteel/P = new /obj/item/stack/sheet/plasteel P.amount = 5 - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) //Gold slimecrit @@ -987,7 +987,7 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red The slime extract begins to vibrate violently !"), 1) sleep(50) @@ -1026,9 +1026,9 @@ datum message_admins(message, 0, 1) - playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) + playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) - for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null)) if(M:eyecheck() <= 0) flick("e_flash", M.flash) @@ -1036,7 +1036,7 @@ datum var/chosen = pick(critters) var/mob/living/simple_animal/hostile/C = new chosen C.faction = "slimesummon" - C.loc = get_turf_loc(holder.my_atom) + C.loc = get_turf(holder.my_atom) if(prob(50)) for(var/j = 1, j <= rand(1, 3), j++) step(C, pick(NORTH,SOUTH,EAST,WEST)) @@ -1051,7 +1051,7 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red The slime extract begins to vibrate violently !"), 1) sleep(50) @@ -1090,16 +1090,16 @@ datum message_admins(message, 0, 1) - playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) + playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) - for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null)) if(M:eyecheck() <= 0) flick("e_flash", M.flash) var/chosen = pick(critters) var/mob/living/simple_animal/hostile/C = new chosen C.faction = "neutral" - C.loc = get_turf_loc(holder.my_atom) + C.loc = get_turf(holder.my_atom) //Silver slimebork @@ -1117,9 +1117,9 @@ datum var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/snacks) - /obj/item/weapon/reagent_containers/food/snacks // BORK BORK BORK - playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) + playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) - for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null)) if(M:eyecheck() <= 0) flick("e_flash", M.flash) @@ -1127,7 +1127,7 @@ datum var/chosen = pick(borks) var/obj/B = new chosen if(B) - B.loc = get_turf_loc(holder.my_atom) + B.loc = get_turf(holder.my_atom) if(prob(50)) for(var/j = 1, j <= rand(1, 3), j++) step(B, pick(NORTH,SOUTH,EAST,WEST)) @@ -1148,9 +1148,9 @@ datum var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/drinks) - /obj/item/weapon/reagent_containers/food/drinks // BORK BORK BORK - playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) + playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) - for(var/mob/living/carbon/human/M in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null)) if(M:eyecheck() <= 0) flick("e_flash", M.flash) @@ -1158,7 +1158,7 @@ datum var/chosen = pick(borks) var/obj/B = new chosen if(B) - B.loc = get_turf_loc(holder.my_atom) + B.loc = get_turf(holder.my_atom) if(prob(50)) for(var/j = 1, j <= rand(1, 3), j++) step(B, pick(NORTH,SOUTH,EAST,WEST)) @@ -1187,11 +1187,11 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red The slime extract begins to vibrate violently !"), 1) sleep(50) - playsound(get_turf_loc(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) - for(var/mob/living/M in range (get_turf_loc(holder.my_atom), 7)) + playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1) + for(var/mob/living/M in range (get_turf(holder.my_atom), 7)) M.bodytemperature -= 240 M << "\blue You feel a chill!" @@ -1217,7 +1217,7 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red The slime extract begins to vibrate violently !"), 1) sleep(50) var/turf/location = get_turf(holder.my_atom.loc) @@ -1244,7 +1244,7 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder, var/created_volume) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - empulse(get_turf_loc(holder.my_atom), 3, 7) + empulse(get_turf(holder.my_atom), 3, 7) slimecell @@ -1258,7 +1258,7 @@ datum on_reaction(var/datum/reagents/holder, var/created_volume) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/weapon/cell/slime/P = new /obj/item/weapon/cell/slime - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) slimeglow name = "Slime Glow" @@ -1270,10 +1270,10 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red The slime begins to emit a soft light. Squeezing it will cause it to grow brightly."), 1) var/obj/item/device/flashlight/slime/F = new /obj/item/device/flashlight/slime - F.loc = get_turf_loc(holder.my_atom) + F.loc = get_turf(holder.my_atom) //Purple @@ -1288,7 +1288,7 @@ datum on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/weapon/slimesteroid/P = new /obj/item/weapon/slimesteroid - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) slimejam name = "Slime Jam" @@ -1315,7 +1315,7 @@ datum feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/stack/sheet/mineral/plasma/P = new /obj/item/stack/sheet/mineral/plasma P.amount = 10 - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) //Red slimeglycerol @@ -1340,10 +1340,10 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - for(var/mob/living/carbon/slime/slime in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/living/carbon/slime/slime in viewers(get_turf(holder.my_atom), null)) slime.tame = 0 slime.rabid = 1 - for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red The [slime] is driven into a frenzy!."), 1) //Pink @@ -1358,7 +1358,7 @@ datum on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/weapon/slimepotion/P = new /obj/item/weapon/slimepotion - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) //Black @@ -1384,10 +1384,10 @@ datum required_other = 1 on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") - for(var/mob/O in viewers(get_turf_loc(holder.my_atom), null)) + for(var/mob/O in viewers(get_turf(holder.my_atom), null)) O.show_message(text("\red The slime extract begins to vibrate violently !"), 1) sleep(50) - explosion(get_turf_loc(holder.my_atom), 1 ,3, 6) + explosion(get_turf(holder.my_atom), 1 ,3, 6) //Light Pink slimepotion2 name = "Slime Potion 2" @@ -1400,7 +1400,7 @@ datum on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/weapon/slimepotion2/P = new /obj/item/weapon/slimepotion2 - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) //Adamantine slimegolem name = "Slime Golem" @@ -1413,7 +1413,7 @@ datum on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/effect/golemrune/Z = new /obj/effect/golemrune - Z.loc = get_turf_loc(holder.my_atom) + Z.loc = get_turf(holder.my_atom) Z.announce_to_ghosts() @@ -1441,8 +1441,8 @@ datum if(chosen) // Calculate previous position for transition - var/turf/FROM = get_turf_loc(holder.my_atom) // the turf of origin we're travelling FROM - var/turf/TO = get_turf_loc(chosen) // the turf of origin we're travelling TO + var/turf/FROM = get_turf(holder.my_atom) // the turf of origin we're travelling FROM + var/turf/TO = get_turf(chosen) // the turf of origin we're travelling TO playsound(TO, 'sound/effects/phasein.ogg', 100, 1) @@ -1491,7 +1491,7 @@ datum on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/weapon/slimesteroid2/P = new /obj/item/weapon/slimesteroid2 - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) //Sepia slimecamera @@ -1505,7 +1505,7 @@ datum on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/device/camera/P = new /obj/item/device/camera - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) slimefilm name = "Slime Film" @@ -1518,7 +1518,7 @@ datum on_reaction(var/datum/reagents/holder) feedback_add_details("slime_cores_used","[replacetext(name," ","_")]") var/obj/item/device/camera_film/P = new /obj/item/device/camera_film - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) //Pyrite @@ -1537,7 +1537,7 @@ datum var/chosen = pick(paints) var/obj/P = new chosen if(P) - P.loc = get_turf_loc(holder.my_atom) + P.loc = get_turf(holder.my_atom) //////////////////////////////////////////FOOD MIXTURES//////////////////////////////////// diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index f0cd63f683a..910e36a27aa 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -61,7 +61,7 @@ if(ishuman(user)) user.put_in_hands(wrapped) else - wrapped.loc = get_turf_loc(src) + wrapped.loc = get_turf(src) del(src) diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index 80288df9e46..dbd6560bbd9 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -61,7 +61,7 @@ datum/design/proc/CalcReliability(var/list/temp_techs) for(var/datum/tech/T in temp_techs) if(T.id in req_tech) new_reliability += T.level - new_reliability = between(reliability_base, new_reliability, 100) + new_reliability = Clamp(new_reliability, reliability_base, 100) reliability = new_reliability return diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index 719647ebaba..a6501553fad 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -26,7 +26,7 @@ Note: Must be placed within 3 tiles of the R&D Console var/T = 0 for(var/obj/item/weapon/stock_parts/S in src) T += S.rating * 0.1 - T = between (0, T, 1) + T = Clamp(T, 0, 1) decon_mod = T /obj/machinery/r_n_d/destructive_analyzer/meteorhit() diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index ab4d78570ba..4960de86e52 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -637,7 +637,7 @@ won't update every console in existence) but it's more of a hassle to do. Also, dat += "Load Design to Disk || " else dat += "Name: [d_disk.blueprint.name]
" - dat += "Level: [between(0, (d_disk.blueprint.reliability + rand(-15,15)), 100)]
" + dat += "Level: [Clamp((d_disk.blueprint.reliability + rand(-15,15)), 0, 100)]
" switch(d_disk.blueprint.build_type) if(IMPRINTER) dat += "Lathe Type: Circuit Imprinter
" if(PROTOLATHE) dat += "Lathe Type: Proto-lathe
" diff --git a/code/modules/research/research.dm b/code/modules/research/research.dm index c1c8e311490..7938720c0c9 100644 --- a/code/modules/research/research.dm +++ b/code/modules/research/research.dm @@ -134,7 +134,7 @@ research holder datum. if(DesignHasReqs(PD)) AddDesign2Known(PD) for(var/datum/tech/T in known_tech) - T = between(1,T.level,20) + T = Clamp(T.level, 1, 20) for(var/datum/design/D in known_designs) D.CalcReliability(known_tech) return diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index 896fbc5014b..a2f204f3173 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -54,7 +54,7 @@ if(0 to T0C) health = min(100, health + 1) if(T0C to (T20C + 20)) - health = between(0, health, 100) + health = Clamp(health, 0, 100) if((T20C + 20) to (T0C + 70)) health = max(0, health - 1) if(health <= 0) diff --git a/code/unused/pda2/base_os.dm b/code/unused/pda2/base_os.dm index 71f0c98405b..e75edc1cf99 100644 --- a/code/unused/pda2/base_os.dm +++ b/code/unused/pda2/base_os.dm @@ -177,7 +177,7 @@ //Atmos Scanner dat += "

Atmospheric Readings

" - var/turf/T = get_turf_or_move(get_turf(src.master)) + var/turf/T = get_turf(get_turf(src.master)) if (isnull(T)) dat += "Unable to obtain a reading.
" else diff --git a/code/unused/vehicle.dm b/code/unused/vehicle.dm index 12e7aeb91dc..02912f4be77 100644 --- a/code/unused/vehicle.dm +++ b/code/unused/vehicle.dm @@ -260,10 +260,10 @@ last_relay = world.time var/speed_change = 0 if(direction & NORTH) - pr_inertial_movement.desired_delay = between(pr_inertial_movement.min_delay, pr_inertial_movement.desired_delay-1, pr_inertial_movement.max_delay) + pr_inertial_movement.desired_delay = Clamp(pr_inertial_movement.desired_delay-1, pr_inertial_movement.min_delay, pr_inertial_movement.max_delay) speed_change = 1 else if (direction & SOUTH) - pr_inertial_movement.desired_delay = between(pr_inertial_movement.min_delay, pr_inertial_movement.desired_delay+1, pr_inertial_movement.max_delay) + pr_inertial_movement.desired_delay = Clamp(pr_inertial_movement.desired_delay+1, pr_inertial_movement.min_delay, pr_inertial_movement.max_delay) speed_change = 1 else if (src.can_rotate && direction & 4) src.dir = turn(src.dir, -90.0)