diff --git a/code/__DEFINES/_flags/_flags.dm b/code/__DEFINES/_flags/_flags.dm index 6f8ea6cda7..9511b1f171 100644 --- a/code/__DEFINES/_flags/_flags.dm +++ b/code/__DEFINES/_flags/_flags.dm @@ -41,6 +41,8 @@ GLOBAL_LIST_INIT(bitflags, list( #define OVERLAY_QUEUED_1 (1<<8) ///Item has priority to check when entering or leaving. #define ON_BORDER_1 (1<<9) +///Whether or not this atom shows screentips when hovered over +#define NO_SCREENTIPS_1 (1<<10) ///Prevent clicking things below it on the same turf eg. doors/ fulltile windows. #define PREVENT_CLICK_UNDER_1 (1<<11) #define HOLOGRAM_1 (1<<12) diff --git a/code/__HELPERS/AStar.dm b/code/__HELPERS/AStar.dm deleted file mode 100644 index 5e03d9b350..0000000000 --- a/code/__HELPERS/AStar.dm +++ /dev/null @@ -1,209 +0,0 @@ -/* -A Star pathfinding algorithm -Returns a list of tiles forming a path from A to B, taking dense objects as well as walls, and the orientation of -windows along the route into account. -Use: -your_list = AStar(start location, end location, moving atom, distance proc, max nodes, maximum node depth, minimum distance to target, adjacent proc, atom id, turfs to exclude, check only simulated) - -Optional extras to add on (in order): -Distance proc : the distance used in every A* calculation (length of path and heuristic) -MaxNodes: The maximum number of nodes the returned path can be (0 = infinite) -Maxnodedepth: The maximum number of nodes to search (default: 30, 0 = infinite) -Mintargetdist: Minimum distance to the target before path returns, could be used to get -near a target, but not right to it - for an AI mob with a gun, for example. -Adjacent proc : returns the turfs to consider around the actually processed node -Simulated only : whether to consider unsimulated turfs or not (used by some Adjacent proc) - -Also added 'exclude' turf to avoid travelling over; defaults to null - -Actual Adjacent procs : - - /turf/proc/reachableAdjacentTurfs : returns reachable turfs in cardinal directions (uses simulated_only) - - /turf/proc/reachableAdjacentAtmosTurfs : returns turfs in cardinal directions reachable via atmos - -*/ -#define PF_TIEBREAKER 0.005 -//tiebreker weight.To help to choose between equal paths -////////////////////// -//datum/PathNode object -////////////////////// -#define MASK_ODD 85 -#define MASK_EVEN 170 - - -//A* nodes variables -/datum/PathNode - var/turf/source //turf associated with the PathNode - var/datum/PathNode/prevNode //link to the parent PathNode - var/f //A* Node weight (f = g + h) - var/g //A* movement cost variable - var/h //A* heuristic variable - var/nt //count the number of Nodes traversed - var/bf //bitflag for dir to expand.Some sufficiently advanced motherfuckery - -/datum/PathNode/New(s,p,pg,ph,pnt,_bf) - source = s - prevNode = p - g = pg - h = ph - f = g + h*(1+ PF_TIEBREAKER) - nt = pnt - bf = _bf - -/datum/PathNode/proc/setp(p,pg,ph,pnt) - prevNode = p - g = pg - h = ph - f = g + h*(1+ PF_TIEBREAKER) - nt = pnt - -/datum/PathNode/proc/calc_f() - f = g + h - -////////////////////// -//A* procs -////////////////////// - -//the weighting function, used in the A* algorithm -/proc/PathWeightCompare(datum/PathNode/a, datum/PathNode/b) - return a.f - b.f - -//reversed so that the Heap is a MinHeap rather than a MaxHeap -/proc/HeapPathWeightCompare(datum/PathNode/a, datum/PathNode/b) - return b.f - a.f - -//wrapper that returns an empty list if A* failed to find a path -/proc/get_path_to(caller, end, dist, maxnodes, maxnodedepth = 30, mintargetdist, adjacent = /turf/proc/reachableTurftest, id=null, turf/exclude=null, simulated_only = 1) - var/l = SSpathfinder.mobs.getfree(caller) - while(!l) - stoplag(3) - l = SSpathfinder.mobs.getfree(caller) - var/list/path = AStar(caller, end, dist, maxnodes, maxnodedepth, mintargetdist, adjacent,id, exclude, simulated_only) - - SSpathfinder.mobs.found(l) - if(!path) - path = list() - return path - -/proc/cir_get_path_to(caller, end, dist, maxnodes, maxnodedepth = 30, mintargetdist, adjacent = /turf/proc/reachableTurftest, id=null, turf/exclude=null, simulated_only = 1) - var/l = SSpathfinder.circuits.getfree(caller) - while(!l) - stoplag(3) - l = SSpathfinder.circuits.getfree(caller) - var/list/path = AStar(caller, end, dist, maxnodes, maxnodedepth, mintargetdist, adjacent,id, exclude, simulated_only) - SSpathfinder.circuits.found(l) - if(!path) - path = list() - return path - -/proc/AStar(caller, _end, dist, maxnodes, maxnodedepth = 30, mintargetdist, adjacent = /turf/proc/reachableTurftest, id=null, turf/exclude=null, simulated_only = 1) - //sanitation - var/turf/end = get_turf(_end) - var/turf/start = get_turf(caller) - if(!start || !end) - stack_trace("Invalid A* start or destination") - return 0 - if( start.z != end.z || start == end ) //no pathfinding between z levels - return 0 - if(maxnodes) - //if start turf is farther than maxnodes from end turf, no need to do anything - if(call(start, dist)(end) > maxnodes) - return 0 - maxnodedepth = maxnodes //no need to consider path longer than maxnodes - var/datum/Heap/open = new /datum/Heap(/proc/HeapPathWeightCompare) //the open list - var/list/openc = new() //open list for node check - var/list/path = null //the returned path, if any - //initialization - var/datum/PathNode/cur = new /datum/PathNode(start,null,0,call(start,dist)(end),0,15,1)//current processed turf - open.Insert(cur) - openc[start] = cur - //then run the main loop - while(!open.IsEmpty() && !path) - cur = open.Pop() //get the lower f turf in the open list - //get the lower f node on the open list - //if we only want to get near the target, check if we're close enough - var/closeenough - if(mintargetdist) - closeenough = call(cur.source,dist)(end) <= mintargetdist - - - //found the target turf (or close enough), let's create the path to it - if(cur.source == end || closeenough) - path = new() - path.Add(cur.source) - while(cur.prevNode) - cur = cur.prevNode - path.Add(cur.source) - break - //get adjacents turfs using the adjacent proc, checking for access with id - if((!maxnodedepth)||(cur.nt <= maxnodedepth))//if too many steps, don't process that path - for(var/i = 0 to 3) - var/f= 1<>1) //getting reverse direction throught swapping even and odd bits.((f & 01010101)<<1)|((f & 10101010)>>1) - var/newg = cur.g + call(cur.source,dist)(T) - if(CN) - //is already in open list, check if it's a better way from the current turf - CN.bf &= 15^r //we have no closed, so just cut off exceed dir.00001111 ^ reverse_dir.We don't need to expand to checked turf. - if((newg < CN.g) ) - if(call(cur.source,adjacent)(caller, T, id, simulated_only)) - CN.setp(cur,newg,CN.h,cur.nt+1) - open.ReSort(CN)//reorder the changed element in the list - else - //is not already in open list, so add it - if(call(cur.source,adjacent)(caller, T, id, simulated_only)) - CN = new(T,cur,newg,call(T,dist)(end),cur.nt+1,15^r) - open.Insert(CN) - openc[T] = CN - cur.bf = 0 - CHECK_TICK - //reverse the path to get it from start to finish - if(path) - for(var/i = 1 to round(0.5*path.len)) - path.Swap(i,path.len-i+1) - openc = null - //cleaning after us - return path - -//Returns adjacent turfs in cardinal directions that are reachable -//simulated_only controls whether only simulated turfs are considered or not - -/turf/proc/reachableAdjacentTurfs(caller, ID, simulated_only) - var/list/L = new() - var/turf/T - var/static/space_type_cache = typecacheof(/turf/open/space) - - for(var/k in 1 to GLOB.cardinals.len) - T = get_step(src,GLOB.cardinals[k]) - if(!T || (simulated_only && space_type_cache[T.type])) - continue - if(!T.density && !LinkBlockedWithAccess(T,caller, ID)) - L.Add(T) - return L - -/turf/proc/reachableTurftest(caller, var/turf/T, ID, simulated_only) - if(T && !T.density && !(simulated_only && SSpathfinder.space_type_cache[T.type]) && !LinkBlockedWithAccess(T,caller, ID)) - return TRUE - -//Returns adjacent turfs in cardinal directions that are reachable via atmos -/turf/proc/reachableAdjacentAtmosTurfs() - return atmos_adjacent_turfs - -/turf/proc/LinkBlockedWithAccess(turf/T, caller, ID) - var/adir = get_dir(src, T) - var/rdir = ((adir & MASK_ODD)<<1)|((adir & MASK_EVEN)>>1) - for(var/obj/structure/window/W in src) - if(!W.CanAStarPass(ID, adir)) - return 1 - for(var/obj/machinery/door/window/W in src) - if(!W.CanAStarPass(ID, adir)) - return 1 - for(var/obj/O in T) - if(!O.CanAStarPass(ID, rdir, caller)) - return 1 - - return 0 diff --git a/code/__HELPERS/heap.dm b/code/__HELPERS/heap.dm index 916e7fc05c..eabcb0e0dc 100644 --- a/code/__HELPERS/heap.dm +++ b/code/__HELPERS/heap.dm @@ -1,39 +1,45 @@ - ////////////////////// -//datum/Heap object +//datum/heap object ////////////////////// -/datum/Heap +/datum/heap var/list/L var/cmp -/datum/Heap/New(compare) +/datum/heap/New(compare) L = new() cmp = compare -/datum/Heap/proc/IsEmpty() - return !L.len +/datum/heap/Destroy(force, ...) + for(var/i in L) // because this is before the list helpers are loaded + qdel(i) + L = null + return ..() -//Insert and place at its position a new node in the heap -/datum/Heap/proc/Insert(atom/A) +/datum/heap/proc/is_empty() + return !length(L) + +//insert and place at its position a new node in the heap +/datum/heap/proc/insert(atom/A) L.Add(A) - Swim(L.len) + swim(length(L)) //removes and returns the first element of the heap //(i.e the max or the min dependant on the comparison function) -/datum/Heap/proc/Pop() - if(!L.len) +/datum/heap/proc/pop() + if(!length(L)) return 0 . = L[1] - L[1] = L[L.len] - L.Cut(L.len) - if(L.len) - Sink(1) + L[1] = L[length(L)] + L.Cut(length(L)) + if(length(L)) + sink(1) + //Get a node up to its right position in the heap -/datum/Heap/proc/Swim(var/index) +/datum/heap/proc/swim(index) var/parent = round(index * 0.5) while(parent > 0 && (call(cmp)(L[index],L[parent]) > 0)) @@ -42,21 +48,21 @@ parent = round(index * 0.5) //Get a node down to its right position in the heap -/datum/Heap/proc/Sink(var/index) - var/g_child = GetGreaterChild(index) +/datum/heap/proc/sink(index) + var/g_child = get_greater_child(index) while(g_child > 0 && (call(cmp)(L[index],L[g_child]) < 0)) L.Swap(index,g_child) index = g_child - g_child = GetGreaterChild(index) + g_child = get_greater_child(index) //Returns the greater (relative to the comparison proc) of a node children //or 0 if there's no child -/datum/Heap/proc/GetGreaterChild(var/index) - if(index * 2 > L.len) +/datum/heap/proc/get_greater_child(index) + if(index * 2 > length(L)) return 0 - if(index * 2 + 1 > L.len) + if(index * 2 + 1 > length(L)) return index * 2 if(call(cmp)(L[index * 2],L[index * 2 + 1]) < 0) @@ -65,12 +71,11 @@ return index * 2 //Replaces a given node so it verify the heap condition -/datum/Heap/proc/ReSort(atom/A) +/datum/heap/proc/resort(atom/A) var/index = L.Find(A) - Swim(index) - Sink(index) + swim(index) + sink(index) -/datum/Heap/proc/List() +/datum/heap/proc/List() . = L.Copy() - diff --git a/code/__HELPERS/path.dm b/code/__HELPERS/path.dm new file mode 100644 index 0000000000..7ae72c3fa2 --- /dev/null +++ b/code/__HELPERS/path.dm @@ -0,0 +1,359 @@ +/** + * This file contains the stuff you need for using JPS (Jump Point Search) pathing, an alternative to A* that skips + * over large numbers of uninteresting tiles resulting in much quicker pathfinding solutions. Mind that diagonals + * cost the same as cardinal moves currently, so paths may look a bit strange, but should still be optimal. + */ + +/** + * This is the proc you use whenever you want to have pathfinding more complex than "try stepping towards the thing". + * If no path was found, returns an empty list, which is important for bots like medibots who expect an empty list rather than nothing. + * + * Arguments: + * * caller: The movable atom that's trying to find the path + * * end: What we're trying to path to. It doesn't matter if this is a turf or some other atom, we're gonna just path to the turf it's on anyway + * * max_distance: The maximum number of steps we can take in a given path to search (default: 30, 0 = infinite) + * * mintargetdistance: Minimum distance to the target before path returns, could be used to get near a target, but not right to it - for an AI mob with a gun, for example. + * * id: An ID card representing what access we have and what doors we can open. Its location relative to the pathing atom is irrelevant + * * simulated_only: Whether we consider turfs without atmos simulation (AKA do we want to ignore space) + * * exclude: If we want to avoid a specific turf, like if we're a mulebot who already got blocked by some turf + * * skip_first: Whether or not to delete the first item in the path. This would be done because the first item is the starting tile, which can break movement for some creatures. + */ +/proc/get_path_to(caller, end, max_distance = 30, mintargetdist, id=null, simulated_only = TRUE, turf/exclude, skip_first=TRUE) + if(!caller || !get_turf(end)) + return + + var/l = SSpathfinder.mobs.getfree(caller) + while(!l) + stoplag(3) + l = SSpathfinder.mobs.getfree(caller) + + var/list/path + var/datum/pathfind/pathfind_datum = new(caller, end, id, max_distance, mintargetdist, simulated_only, exclude) + path = pathfind_datum.search() + qdel(pathfind_datum) + + SSpathfinder.mobs.found(l) + if(!path) + path = list() + if(length(path) > 0 && skip_first) + path.Cut(1,2) + return path + +/** + * A helper macro to see if it's possible to step from the first turf into the second one, minding things like door access and directional windows. + * Note that this can only be used inside the [datum/pathfind][pathfind datum] since it uses variables from said datum. + * If you really want to optimize things, optimize this, cuz this gets called a lot. + */ +#define CAN_STEP(cur_turf, next) (next && !next.density && cur_turf.Adjacent(next) && !(simulated_only && SSpathfinder.space_type_cache[next.type]) && !cur_turf.LinkBlockedWithAccess(next,caller, id) && (next != avoid)) +/// Another helper macro for JPS, for telling when a node has forced neighbors that need expanding +#define STEP_NOT_HERE_BUT_THERE(cur_turf, dirA, dirB) ((!CAN_STEP(cur_turf, get_step(cur_turf, dirA)) && CAN_STEP(cur_turf, get_step(cur_turf, dirB)))) + +/// The JPS Node datum represents a turf that we find interesting enough to add to the open list and possibly search for new tiles from +/datum/jps_node + /// The turf associated with this node + var/turf/tile + /// The node we just came from + var/datum/jps_node/previous_node + /// The A* node weight (f_value = number_of_tiles + heuristic) + var/f_value + /// The A* node heuristic (a rough estimate of how far we are from the goal) + var/heuristic + /// How many steps it's taken to get here from the start (currently pulling double duty as steps taken & cost to get here, since all moves incl diagonals cost 1 rn) + var/number_tiles + /// How many steps it took to get here from the last node + var/jumps + /// Nodes store the endgoal so they can process their heuristic without a reference to the pathfind datum + var/turf/node_goal + +/datum/jps_node/New(turf/our_tile, datum/jps_node/incoming_previous_node, jumps_taken, turf/incoming_goal) + tile = our_tile + jumps = jumps_taken + if(incoming_goal) // if we have the goal argument, this must be the first/starting node + node_goal = incoming_goal + else if(incoming_previous_node) // if we have the parent, this is from a direct lateral/diagonal scan, we can fill it all out now + previous_node = incoming_previous_node + number_tiles = previous_node.number_tiles + jumps + node_goal = previous_node.node_goal + heuristic = get_dist(tile, node_goal) + f_value = number_tiles + heuristic + // otherwise, no parent node means this is from a subscan lateral scan, so we just need the tile for now until we call [datum/jps/proc/update_parent] on it + +/datum/jps_node/Destroy(force, ...) + previous_node = null + return ..() + +/datum/jps_node/proc/update_parent(datum/jps_node/new_parent) + previous_node = new_parent + node_goal = previous_node.node_goal + jumps = get_dist(tile, previous_node.tile) + number_tiles = previous_node.number_tiles + jumps + heuristic = get_dist(tile, node_goal) + f_value = number_tiles + heuristic + +/// TODO: Macro this to reduce proc overhead +/proc/HeapPathWeightCompare(datum/jps_node/a, datum/jps_node/b) + return b.f_value - a.f_value + +/// The datum used to handle the JPS pathfinding, completely self-contained +/datum/pathfind + /// The thing that we're actually trying to path for + var/atom/movable/caller + /// The turf where we started at + var/turf/start + /// The turf we're trying to path to (note that this won't track a moving target) + var/turf/end + /// The open list/stack we pop nodes out from (TODO: make this a normal list and macro-ize the heap operations to reduce proc overhead) + var/datum/heap/open + ///An assoc list that serves as the closed list & tracks what turfs came from where. Key is the turf, and the value is what turf it came from + var/list/sources + /// The list we compile at the end if successful to pass back + var/list/path + + // general pathfinding vars/args + /// An ID card representing what access we have and what doors we can open. Its location relative to the pathing atom is irrelevant + var/obj/item/card/id/id + /// How far away we have to get to the end target before we can call it quits + var/mintargetdist = 0 + /// I don't know what this does vs , but they limit how far we can search before giving up on a path + var/max_distance = 30 + /// Space is big and empty, if this is TRUE then we ignore pathing through unsimulated tiles + var/simulated_only + /// A specific turf we're avoiding, like if a mulebot is being blocked by someone t-posing in a doorway we're trying to get through + var/turf/avoid + +/datum/pathfind/New(atom/movable/caller, atom/goal, id, max_distance, mintargetdist, simulated_only, avoid) + src.caller = caller + end = get_turf(goal) + open = new /datum/heap(/proc/HeapPathWeightCompare) + sources = new() + src.id = id + src.max_distance = max_distance + src.mintargetdist = mintargetdist + src.simulated_only = simulated_only + src.avoid = avoid + +/** + * search() is the proc you call to kick off and handle the actual pathfinding, and kills the pathfind datum instance when it's done. + * + * If a valid path was found, it's returned as a list. If invalid or cross-z-level params are entered, or if there's no valid path found, we + * return null, which [/proc/get_path_to] translates to an empty list (notable for simple bots, who need empty lists) + */ +/datum/pathfind/proc/search() + start = get_turf(caller) + if(!start || !end) + stack_trace("Invalid A* start or destination") + return + if(start.z != end.z || start == end ) //no pathfinding between z levels + return + if(max_distance && (max_distance < get_dist(start, end))) //if start turf is farther than max_distance from end turf, no need to do anything + return + + //initialization + var/datum/jps_node/current_processed_node = new (start, -1, 0, end) + open.insert(current_processed_node) + sources[start] = start // i'm sure this is fine + + //then run the main loop + while(!open.is_empty() && !path) + if(!caller) + return + current_processed_node = open.pop() //get the lower f_value turf in the open list + if(max_distance && (current_processed_node.number_tiles > max_distance))//if too many steps, don't process that path + continue + + var/turf/current_turf = current_processed_node.tile + for(var/scan_direction in list(EAST, WEST, NORTH, SOUTH)) + lateral_scan_spec(current_turf, scan_direction, current_processed_node) + + for(var/scan_direction in list(NORTHEAST, SOUTHEAST, NORTHWEST, SOUTHWEST)) + diag_scan_spec(current_turf, scan_direction, current_processed_node) + + CHECK_TICK + + //we're done! reverse the path to get it from start to finish + if(path) + for(var/i = 1 to round(0.5 * length(path))) + path.Swap(i, length(path) - i + 1) + + sources = null + qdel(open) + return path + +/// Called when we've hit the goal with the node that represents the last tile, then sets the path var to that path so it can be returned by [datum/pathfind/proc/search] +/datum/pathfind/proc/unwind_path(datum/jps_node/unwind_node) + path = new() + var/turf/iter_turf = unwind_node.tile + path.Add(iter_turf) + + while(unwind_node.previous_node) + var/dir_goal = get_dir(iter_turf, unwind_node.previous_node.tile) + for(var/i = 1 to unwind_node.jumps) + iter_turf = get_step(iter_turf,dir_goal) + path.Add(iter_turf) + unwind_node = unwind_node.previous_node + +/** + * For performing lateral scans from a given starting turf. + * + * These scans are called from both the main search loop, as well as subscans for diagonal scans, and they treat finding interesting turfs slightly differently. + * If we're doing a normal lateral scan, we already have a parent node supplied, so we just create the new node and immediately insert it into the heap, ezpz. + * If we're part of a subscan, we still need for the diagonal scan to generate a parent node, so we return a node datum with just the turf and let the diag scan + * proc handle transferring the values and inserting them into the heap. + * + * Arguments: + * * original_turf: What turf did we start this scan at? + * * heading: What direction are we going in? Obviously, should be cardinal + * * parent_node: Only given for normal lateral scans, if we don't have one, we're a diagonal subscan. +*/ +/datum/pathfind/proc/lateral_scan_spec(turf/original_turf, heading, datum/jps_node/parent_node) + var/steps_taken = 0 + + var/turf/current_turf = original_turf + var/turf/lag_turf = original_turf + + while(TRUE) + if(path) + return + lag_turf = current_turf + current_turf = get_step(current_turf, heading) + steps_taken++ + if(!CAN_STEP(lag_turf, current_turf)) + return + + if(current_turf == end || (mintargetdist && (get_dist(current_turf, end) <= mintargetdist))) + var/datum/jps_node/final_node = new(current_turf, parent_node, steps_taken) + sources[current_turf] = original_turf + if(parent_node) // if this is a direct lateral scan we can wrap up, if it's a subscan from a diag, we need to let the diag make their node first, then finish + unwind_path(final_node) + return final_node + else if(sources[current_turf]) // already visited, essentially in the closed list + return + else + sources[current_turf] = original_turf + + if(parent_node && parent_node.number_tiles + steps_taken > max_distance) + return + + var/interesting = FALSE // have we found a forced neighbor that would make us add this turf to the open list? + + switch(heading) + if(NORTH) + if(STEP_NOT_HERE_BUT_THERE(current_turf, WEST, NORTHWEST) || STEP_NOT_HERE_BUT_THERE(current_turf, EAST, NORTHEAST)) + interesting = TRUE + if(SOUTH) + if(STEP_NOT_HERE_BUT_THERE(current_turf, WEST, SOUTHWEST) || STEP_NOT_HERE_BUT_THERE(current_turf, EAST, SOUTHEAST)) + interesting = TRUE + if(EAST) + if(STEP_NOT_HERE_BUT_THERE(current_turf, NORTH, NORTHEAST) || STEP_NOT_HERE_BUT_THERE(current_turf, SOUTH, SOUTHEAST)) + interesting = TRUE + if(WEST) + if(STEP_NOT_HERE_BUT_THERE(current_turf, NORTH, NORTHWEST) || STEP_NOT_HERE_BUT_THERE(current_turf, SOUTH, SOUTHWEST)) + interesting = TRUE + + if(interesting) + var/datum/jps_node/newnode = new(current_turf, parent_node, steps_taken) + if(parent_node) // if we're a diagonal subscan, we'll handle adding ourselves to the heap in the diag + open.insert(newnode) + return newnode + +/** + * For performing diagonal scans from a given starting turf. + * + * Unlike lateral scans, these only are called from the main search loop, so we don't need to worry about returning anything, + * though we do need to handle the return values of our lateral subscans of course. + * + * Arguments: + * * original_turf: What turf did we start this scan at? + * * heading: What direction are we going in? Obviously, should be diagonal + * * parent_node: We should always have a parent node for diagonals +*/ +/datum/pathfind/proc/diag_scan_spec(turf/original_turf, heading, datum/jps_node/parent_node) + var/steps_taken = 0 + var/turf/current_turf = original_turf + var/turf/lag_turf = original_turf + + while(TRUE) + if(path) + return + lag_turf = current_turf + current_turf = get_step(current_turf, heading) + steps_taken++ + if(!CAN_STEP(lag_turf, current_turf)) + return + + if(current_turf == end || (mintargetdist && (get_dist(current_turf, end) <= mintargetdist))) + var/datum/jps_node/final_node = new(current_turf, parent_node, steps_taken) + sources[current_turf] = original_turf + unwind_path(final_node) + return + else if(sources[current_turf]) // already visited, essentially in the closed list + return + else + sources[current_turf] = original_turf + + if(parent_node.number_tiles + steps_taken > max_distance) + return + + var/interesting = FALSE // have we found a forced neighbor that would make us add this turf to the open list? + var/datum/jps_node/possible_child_node // otherwise, did one of our lateral subscans turn up something? + + switch(heading) + if(NORTHWEST) + if(STEP_NOT_HERE_BUT_THERE(current_turf, EAST, NORTHEAST) || STEP_NOT_HERE_BUT_THERE(current_turf, SOUTH, SOUTHWEST)) + interesting = TRUE + else + possible_child_node = (lateral_scan_spec(current_turf, WEST) || lateral_scan_spec(current_turf, NORTH)) + if(NORTHEAST) + if(STEP_NOT_HERE_BUT_THERE(current_turf, WEST, NORTHWEST) || STEP_NOT_HERE_BUT_THERE(current_turf, SOUTH, SOUTHEAST)) + interesting = TRUE + else + possible_child_node = (lateral_scan_spec(current_turf, EAST) || lateral_scan_spec(current_turf, NORTH)) + if(SOUTHWEST) + if(STEP_NOT_HERE_BUT_THERE(current_turf, EAST, SOUTHEAST) || STEP_NOT_HERE_BUT_THERE(current_turf, NORTH, NORTHWEST)) + interesting = TRUE + else + possible_child_node = (lateral_scan_spec(current_turf, SOUTH) || lateral_scan_spec(current_turf, WEST)) + if(SOUTHEAST) + if(STEP_NOT_HERE_BUT_THERE(current_turf, WEST, SOUTHWEST) || STEP_NOT_HERE_BUT_THERE(current_turf, NORTH, NORTHEAST)) + interesting = TRUE + else + possible_child_node = (lateral_scan_spec(current_turf, SOUTH) || lateral_scan_spec(current_turf, EAST)) + + if(interesting || possible_child_node) + var/datum/jps_node/newnode = new(current_turf, parent_node, steps_taken) + open.insert(newnode) + if(possible_child_node) + possible_child_node.update_parent(newnode) + open.insert(possible_child_node) + if(possible_child_node.tile == end || (mintargetdist && (get_dist(possible_child_node.tile, end) <= mintargetdist))) + unwind_path(possible_child_node) + return + +/** + * For seeing if we can actually move between 2 given turfs while accounting for our access and the caller's pass_flags + * + * Arguments: + * * caller: The movable, if one exists, being used for mobility checks to see what tiles it can reach + * * ID: An ID card that decides if we can gain access to doors that would otherwise block a turf + * * simulated_only: Do we only worry about turfs with simulated atmos, most notably things that aren't space? +*/ +/turf/proc/LinkBlockedWithAccess(turf/destination_turf, caller, ID) + var/actual_dir = get_dir(src, destination_turf) + + for(var/obj/structure/window/iter_window in src) + if(!iter_window.CanAStarPass(ID, actual_dir)) + return TRUE + + for(var/obj/machinery/door/window/iter_windoor in src) + if(!iter_windoor.CanAStarPass(ID, actual_dir)) + return TRUE + + var/reverse_dir = get_dir(destination_turf, src) + for(var/obj/iter_object in destination_turf) + if(!iter_object.CanAStarPass(ID, reverse_dir, caller)) + return TRUE + + return FALSE + +#undef CAN_STEP +#undef STEP_NOT_HERE_BUT_THERE diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index df3b6e5334..2dc77d3bcb 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -160,6 +160,7 @@ GLOBAL_LIST_INIT(bitfields, list( "HOLOGRAM_1" = HOLOGRAM_1, "SHOCKED_1" = SHOCKED_1, "INITIALIZED_1" = INITIALIZED_1, + "NO_SCREENTIPS_1" = NO_SCREENTIPS_1, "ADMIN_SPAWNED_1" = ADMIN_SPAWNED_1, "BLOCK_FACE_ATOM_1" = BLOCK_FACE_ATOM_1, "PREVENT_CONTENTS_EXPLOSION_1" = PREVENT_CONTENTS_EXPLOSION_1 diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 8f366f4dc5..651a782fb9 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -54,6 +54,22 @@ GLOBAL_LIST_INIT(available_ui_styles, list( var/list/hand_slots // /atom/movable/screen/inventory/hand objects, assoc list of "[held_index]" = object var/list/atom/movable/screen/plane_master/plane_masters = list() // see "appearance_flags" in the ref, assoc list of "[plane]" = object + + ///UI for screentips that appear when you mouse over things + var/atom/movable/screen/screentip/screentip_text + + /// Whether or not screentips are enabled. + /// This is updated by the preference for cheaper reads than would be + /// had with a proc call, especially on one of the hottest procs in the + /// game (MouseEntered). + var/screentips_enabled = TRUE + + /// The color to use for the screentips. + /// This is updated by the preference for cheaper reads than would be + /// had with a proc call, especially on one of the hottest procs in the + /// game (MouseEntered). + var/screentip_color + var/atom/movable/screen/movable/action_button/hide_toggle/hide_actions_toggle var/action_buttons_hidden = FALSE @@ -84,6 +100,8 @@ GLOBAL_LIST_INIT(available_ui_styles, list( plane_masters["[instance.plane]"] = instance instance.backdrop(mymob) + screentip_text = new(null, src) + static_inventory += screentip_text /datum/hud/Destroy() if(mymob.hud_used == src) @@ -125,6 +143,8 @@ GLOBAL_LIST_INIT(available_ui_styles, list( QDEL_LIST(screenoverlays) mymob = null + QDEL_NULL(screentip_text) + return ..() diff --git a/code/_onclick/hud/screentip.dm b/code/_onclick/hud/screentip.dm new file mode 100644 index 0000000000..43b728ade6 --- /dev/null +++ b/code/_onclick/hud/screentip.dm @@ -0,0 +1,19 @@ +/atom/movable/screen/screentip + icon = null + icon_state = null + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + screen_loc = "TOP,LEFT" + maptext_height = 480 + maptext_width = 480 + maptext = "" + +/atom/movable/screen/screentip/Initialize(mapload, _hud) + . = ..() + hud = _hud + update_view() + +/atom/movable/screen/screentip/proc/update_view(datum/source) + SIGNAL_HANDLER + if(!hud || !hud.mymob.client.view_size) //Might not have been initialized by now + return + maptext_width = getviewsize(hud.mymob.client.view_size.getView())[1] * world.icon_size diff --git a/code/game/atoms.dm b/code/game/atoms.dm index e7a0aa1c68..80802e34f0 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1427,11 +1427,12 @@ //Update the screentip to reflect what we're hoverin over /atom/MouseEntered(location, control, params) . = ..() - // Statusbar - // status_bar_set_text(usr, name) // Screentips - // if(usr?.hud_used) - // if(!usr.client?.prefs.screentip_pref || (flags_1 & NO_SCREENTIPS_1)) - // usr.hud_used.screentip_text.maptext = "" - // else - // usr.hud_used.screentip_text.maptext = MAPTEXT("[name]") + var/client/client = usr?.client + var/datum/hud/active_hud = client?.mob?.hud_used + if(active_hud) + if(!client.prefs.screentip_pref || (flags_1 & NO_SCREENTIPS_1)) + active_hud.screentip_text.maptext = "" + else + //We inline a MAPTEXT() here, because there's no good way to statically add to a string like this + active_hud.screentip_text.maptext = MAPTEXT("[name]") diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 982e40a79b..ce29d1947d 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -102,7 +102,7 @@ rad_insulation = RAD_MEDIUM_INSULATION var/static/list/airlock_overlays = list() - + /// sigh var/unelectrify_timerid @@ -1278,8 +1278,8 @@ assemblytype = /obj/structure/door_assembly/door_assembly_extmai update_icon() -/obj/machinery/door/airlock/CanAStarPass(obj/item/card/id/ID) -//Airlock is passable if it is open (!density), bot has access, and is not bolted shut or powered off) +/obj/machinery/door/airlock/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) + //Airlock is passable if it is open (!density), bot has access, and is not bolted shut or powered off) return !density || (check_access(ID) && !locked && hasPower()) /obj/machinery/door/airlock/emag_act(mob/user) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index e263678943..cf256dd6fc 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -238,7 +238,18 @@ /obj/get_dumping_location(datum/component/storage/source,mob/user) return get_turf(src) -/obj/proc/CanAStarPass() +/** + * This proc is used for telling whether something can pass by this object in a given direction, for use by the pathfinding system. + * + * Trying to generate one long path across the station will call this proc on every single object on every single tile that we're seeing if we can move through, likely + * multiple times per tile since we're likely checking if we can access said tile from multiple directions, so keep these as lightweight as possible. + * + * Arguments: + * * ID- An ID card representing what access we have (and thus if we can open things like airlocks or windows to pass through them). The ID card's physical location does not matter, just the reference + * * to_dir- What direction we're trying to move in, relevant for things like directional windows that only block movement in certain directions + * * caller- The movable we're checking pass flags for, if we're making any such checks + **/ +/obj/proc/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) . = !density /obj/proc/check_uplink_validity() diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index 50240aabb3..22f9cf7111 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -305,11 +305,10 @@ else return 0 -/obj/structure/girder/CanAStarPass(ID, dir, caller) +/obj/structure/girder/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) . = !density - if(ismovable(caller)) - var/atom/movable/mover = caller - . = . || (mover.pass_flags & PASSGRILLE) + if(istype(caller)) + . = . || (caller.pass_flags & PASSGRILLE) /obj/structure/girder/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 2ac85f79dc..a09ce578e7 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -133,11 +133,10 @@ else return !density -/obj/structure/grille/CanAStarPass(ID, dir, caller) +/obj/structure/grille/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) . = !density - if(ismovable(caller)) - var/atom/movable/mover = caller - . = . || (mover.pass_flags & PASSGRILLE) + if(istype(caller)) + . = . || (caller.pass_flags & PASSGRILLE) /obj/structure/grille/attackby(obj/item/W, mob/user, params) user.DelayNextAction(CLICK_CD_MELEE) diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 73268009ce..383b57a0b0 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -371,8 +371,7 @@ GLOBAL_LIST_EMPTY(crematoriums) else return 0 -/obj/structure/tray/m_tray/CanAStarPass(ID, dir, caller) +/obj/structure/tray/m_tray/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) . = !density - if(ismovable(caller)) - var/atom/movable/mover = caller - . = . || (mover.pass_flags & PASSTABLE) + if(istype(caller)) + . = . || (caller.pass_flags & PASSTABLE) diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index ff8287d77b..46d5316458 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -56,18 +56,18 @@ return FALSE return TRUE -/obj/structure/plasticflaps/CanAStarPass(ID, to_dir, caller) +/obj/structure/plasticflaps/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) if(isliving(caller)) if(isbot(caller)) - return 1 + return TRUE - var/mob/living/M = caller - if(!(SEND_SIGNAL(M, COMSIG_CHECK_VENTCRAWL)) && M.mob_size != MOB_SIZE_TINY) - return 0 - var/atom/movable/M = caller - if(M && M.pulling) - return CanAStarPass(ID, to_dir, M.pulling) - return 1 //diseases, stings, etc can pass + var/mob/living/living_caller = caller + if(!(SEND_SIGNAL(living_caller, COMSIG_CHECK_VENTCRAWL)) && living_caller.mob_size != MOB_SIZE_TINY) + return FALSE + + if(caller?.pulling) + return CanAStarPass(ID, to_dir, caller.pulling) + return TRUE //diseases, stings, etc can pass /obj/structure/plasticflaps/CanPass(atom/movable/A, turf/T) if(istype(A) && (A.pass_flags & PASSGLASS)) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 74ac894505..a7c716c39e 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -109,11 +109,10 @@ else return !density -/obj/structure/table/CanAStarPass(ID, dir, caller) +/obj/structure/table/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) . = !density - if(ismovable(caller)) - var/atom/movable/mover = caller - . = . || (mover.pass_flags & PASSTABLE) + if(istype(caller)) + . = . || (caller.pass_flags & PASSTABLE) /obj/structure/table/proc/tableplace(mob/living/user, mob/living/pushed_mob) pushed_mob.forceMove(src.loc) @@ -702,11 +701,10 @@ else return 0 -/obj/structure/rack/CanAStarPass(ID, dir, caller) +/obj/structure/rack/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) . = !density - if(ismovable(caller)) - var/atom/movable/mover = caller - . = . || (mover.pass_flags & PASSTABLE) + if(istype(caller)) + . = . || (caller.pass_flags & PASSTABLE) /obj/structure/rack/MouseDrop_T(obj/O, mob/user) . = ..() diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 9d923f2bcc..7be91ccfef 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -571,13 +571,13 @@ GLOBAL_LIST_EMPTY(electrochromatic_window_lookup) /obj/structure/window/get_dumping_location(obj/item/storage/source,mob/user) return null -/obj/structure/window/CanAStarPass(ID, to_dir) +/obj/structure/window/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) if(!density) - return 1 + return TRUE if((dir == FULLTILE_WINDOW_DIR) || (dir == to_dir)) - return 0 + return FALSE - return 1 + return TRUE /obj/structure/window/GetExplosionBlock() return reinf && fulltile ? real_explosion_block : 0 diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index acd7a9336e..efe84828d7 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -12,6 +12,7 @@ barefootstep = FOOTSTEP_HARD_BAREFOOT clawfootstep = FOOTSTEP_HARD_CLAW heavyfootstep = FOOTSTEP_GENERIC_HEAVY + flags_1 = NO_SCREENTIPS_1 /// Minimum explosion power to break tile var/explosion_power_break_tile = EXPLOSION_POWER_FLOOR_TILE_BREAK diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm index 1236d7c0ad..f1f06ed86c 100644 --- a/code/game/turfs/simulated/floor/plating.dm +++ b/code/game/turfs/simulated/floor/plating.dm @@ -134,8 +134,12 @@ if(istype(W, /obj/item/stack/tile/material)) var/turf/newturf = PlaceOnTop(/turf/open/floor/material, flags = CHANGETURF_INHERIT_AIR) newturf.set_custom_materials(W.custom_materials) + if(length(C.atom_colours) && C.atom_colours[WASHABLE_COLOUR_PRIORITY] != null) + newturf.add_atom_colour(C.atom_colours[WASHABLE_COLOUR_PRIORITY], FIXED_COLOUR_PRIORITY) else if(W.turf_type) var/turf/open/floor/T = PlaceOnTop(W.turf_type, flags = CHANGETURF_INHERIT_AIR) + if(length(C.atom_colours) && C.atom_colours[WASHABLE_COLOUR_PRIORITY] != null) + T.add_atom_colour(C.atom_colours[WASHABLE_COLOUR_PRIORITY], FIXED_COLOUR_PRIORITY) if(istype(W, /obj/item/stack/tile/light)) //TODO: get rid of this ugly check somehow var/obj/item/stack/tile/light/L = W var/turf/open/floor/light/F = T diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 85de964463..419378acb9 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -638,3 +638,23 @@ GLOBAL_LIST_EMPTY(station_turfs) var/obj/machinery/door/D = locate() in src if(D?.density) . += D.opacity? 29 : 19 // glass doors are slightly more resistant to screaming + +/** + * Returns adjacent turfs to this turf that are reachable, in all cardinal directions + * + * Arguments: + * * caller: The movable, if one exists, being used for mobility checks to see what tiles it can reach + * * ID: An ID card that decides if we can gain access to doors that would otherwise block a turf + * * simulated_only: Do we only worry about turfs with simulated atmos, most notably things that aren't space? +*/ +/turf/proc/reachableAdjacentTurfs(caller, ID, simulated_only) + var/static/space_type_cache = typecacheof(/turf/open/space) + . = list() + + for(var/iter_dir in GLOB.cardinals) + var/turf/turf_to_check = get_step(src,iter_dir) + if(!turf_to_check || (simulated_only && space_type_cache[turf_to_check.type])) + continue + if(turf_to_check.density || LinkBlockedWithAccess(turf_to_check, caller, ID)) + continue + . += turf_to_check diff --git a/code/modules/antagonists/blob/blob/theblob.dm b/code/modules/antagonists/blob/blob/theblob.dm index a95f73f90d..8ca7e65c3f 100644 --- a/code/modules/antagonists/blob/blob/theblob.dm +++ b/code/modules/antagonists/blob/blob/theblob.dm @@ -75,11 +75,10 @@ /obj/structure/blob/CanAtmosPass(turf/T) return !atmosblock -/obj/structure/blob/CanAStarPass(ID, dir, caller) - . = 0 - if(ismovable(caller)) - var/atom/movable/mover = caller - . = . || (mover.pass_flags & PASSBLOB) +/obj/structure/blob/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller) + . = FALSE + if(istype(caller)) + . = . || (caller.pass_flags & PASSBLOB) /obj/structure/blob/update_icon() //Updates color based on overmind color if we have an overmind. if(overmind) diff --git a/code/modules/antagonists/changeling/powers/tiny_prick.dm b/code/modules/antagonists/changeling/powers/tiny_prick.dm index 9bda1bf5b9..2e684b514b 100644 --- a/code/modules/antagonists/changeling/powers/tiny_prick.dm +++ b/code/modules/antagonists/changeling/powers/tiny_prick.dm @@ -47,8 +47,8 @@ return if(!isturf(user.loc)) return - if(!AStar(user, target.loc, /turf/proc/Distance, changeling.sting_range, simulated_only = 0)) - return + if(!length(get_path_to(user, target, max_distance = changeling.sting_range, simulated_only = FALSE))) + return // no path within the sting's range is found. what a weird place to use the pathfinding system return 1 /obj/effect/proc_holder/changeling/sting/sting_feedback(mob/user, mob/target) diff --git a/code/modules/atmospherics/auxgm/gas_types.dm b/code/modules/atmospherics/auxgm/gas_types.dm index aaf3945aac..6ee234d64d 100644 --- a/code/modules/atmospherics/auxgm/gas_types.dm +++ b/code/modules/atmospherics/auxgm/gas_types.dm @@ -129,7 +129,7 @@ heat_penalty = 10 transmit_modifier = 30 fire_products = list(GAS_H2O = 1) - enthalpy = 40000 + enthalpy = 300000 fire_burn_rate = 2 fire_radiation_released = 50 // arbitrary number, basically 60 moles of trit burning will just barely start to harm you fire_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 50 diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index dc1aefd746..41f652dab5 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -156,7 +156,15 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( var/atom/target = locate(href_list["statpanel_item_target"]) if(!target) return - Click(target, target.loc, null, "[href_list["statpanel_item_shiftclick"]?"shift=1;":null][href_list["statpanel_item_ctrlclick"]?"ctrl=1;":null]&alt=[href_list["statpanel_item_altclick"]?"alt=1;":null]", FALSE, "statpanel") + var/button = "left=1" + switch(href_list["statpanel_item_click"]) + if("middle") + button = "middle=1" + if("right") + button = "right=1" + else + button = "left=1" + Click(target, target.loc, null, "[button];[href_list["statpanel_item_shiftclick"]?"shift=1;":null][href_list["statpanel_item_ctrlclick"]?"ctrl=1;":null]&alt=[href_list["statpanel_item_altclick"]?"alt=1;":null]", FALSE, "statpanel") /client/proc/is_content_unlocked() if(!prefs.unlock_content) @@ -1021,6 +1029,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( var/list/actualview = getviewsize(view) update_clickcatcher() parallax_holder.Reset() + mob.hud_used.screentip_text.update_view() mob.reload_fullscreen() if (isliving(mob)) var/mob/living/M = mob diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 54b4eddeec..7b58e31b5a 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -62,6 +62,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/UI_style = null var/outline_enabled = TRUE var/outline_color = COLOR_THEME_MIDNIGHT + var/screentip_pref = TRUE + var/screentip_color = "#ffd391" var/buttons_locked = FALSE var/hotkeys = FALSE @@ -961,6 +963,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += "UI Style: [UI_style]
" dat += "Outline: [outline_enabled ? "Enabled" : "Disabled"]
" dat += "Outline Color: [outline_color ? "" : "Theme-based (null)"][outline_color] Change
" + dat += "Screentip: [screentip_pref ? "Enabled" : "Disabled"]
" + dat += "Screentip Color: [screentip_color] Change
" dat += "tgui Monitors: [(tgui_lock) ? "Primary" : "All"]
" dat += "tgui Style: [(tgui_fancy) ? "Fancy" : "No Frills"]
" dat += "Show Runechat Chat Bubbles: [chat_on_map ? "Enabled" : "Disabled"]
" @@ -3161,6 +3165,12 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/pickedOutlineColor = input(user, "Choose your outline color.", "General Preference", outline_color) as color|null if(pickedOutlineColor != pickedOutlineColor) outline_color = pickedOutlineColor // nullable + if("screentip_pref") + screentip_pref = !screentip_pref + if("screentip_color") + var/pickedScreentipColor = input(user, "Choose your screentip color.", "General Preference", screentip_color) as color|null + if(pickedScreentipColor) + screentip_color = pickedScreentipColor if("tgui_lock") tgui_lock = !tgui_lock if("winflash") diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index f497279770..eb644f3150 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -385,6 +385,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car S["UI_style"] >> UI_style S["outline_color"] >> outline_color S["outline_enabled"] >> outline_enabled + S["screentip_pref"] >> screentip_pref + S["screentip_color"] >> screentip_color S["hotkeys"] >> hotkeys S["chat_on_map"] >> chat_on_map S["max_chat_length"] >> max_chat_length @@ -577,6 +579,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car WRITE_FILE(S["UI_style"], UI_style) WRITE_FILE(S["outline_enabled"], outline_enabled) WRITE_FILE(S["outline_color"], outline_color) + WRITE_FILE(S["screentip_pref"], screentip_pref) + WRITE_FILE(S["screentip_color"], screentip_color) WRITE_FILE(S["hotkeys"], hotkeys) WRITE_FILE(S["chat_on_map"], chat_on_map) WRITE_FILE(S["max_chat_length"], max_chat_length) diff --git a/code/modules/holiday/dynamic.dm b/code/modules/holiday/dynamic.dm index fb50ea72ca..f75dd37542 100644 --- a/code/modules/holiday/dynamic.dm +++ b/code/modules/holiday/dynamic.dm @@ -3,7 +3,7 @@ /datum/holiday/dynamic/shouldCelebrate(dd, mm, yy, ww, ddd) var/list/days = CONFIG_GET(keyed_list/dynamic_mode_days) - return ddd in days + return lowertext(ddd) in days /datum/holiday/dynamic/celebrate() GLOB.dynamic_forced_threat_level = rand(90, 100) diff --git a/code/modules/integrated_electronics/subtypes/smart.dm b/code/modules/integrated_electronics/subtypes/smart.dm index 5185331e40..60b17c73fe 100644 --- a/code/modules/integrated_electronics/subtypes/smart.dm +++ b/code/modules/integrated_electronics/subtypes/smart.dm @@ -97,7 +97,7 @@ return idc.access = get_pin_data(IC_INPUT, 4) var/turf/a_loc = get_turf(assembly) - var/list/P = cir_get_path_to(assembly, locate(get_pin_data(IC_INPUT, 1),get_pin_data(IC_INPUT, 2),a_loc.z), /turf/proc/Distance_cardinal, 0, 200, id=idc, exclude=get_turf(get_pin_data_as_type(IC_INPUT,3, /atom)), simulated_only = 0) + var/list/P = get_path_to(assembly, locate(get_pin_data(IC_INPUT, 1),get_pin_data(IC_INPUT, 2),a_loc.z), 200, id=idc, exclude=get_turf(get_pin_data_as_type(IC_INPUT,3, /atom)), simulated_only = 0) if(!P) activate_pin(3) diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm index 13d234092c..0c9895c729 100644 --- a/code/modules/mob/living/carbon/monkey/combat.dm +++ b/code/modules/mob/living/carbon/monkey/combat.dm @@ -30,7 +30,7 @@ return 0 if(myPath.len <= 0) - myPath = get_path_to(src, get_turf(target), /turf/proc/Distance, MAX_RANGE_FIND + 1, 250,1) + myPath = get_path_to(src, target, 250, 1) if(myPath) if(myPath.len > 0) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index ca9ca75e6c..3aec65f6fb 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -551,7 +551,7 @@ Pass a positive integer as an argument to override a bot's default speed. var/datum/job/captain/All = new/datum/job/captain all_access.access = All.get_access() - set_path(get_path_to(src, waypoint, /turf/proc/Distance_cardinal, 0, 200, id=all_access)) + set_path(get_path_to(src, waypoint, 200, id=all_access)) calling_ai = caller //Link the AI to the bot! ai_waypoint = waypoint @@ -730,6 +730,7 @@ Pass a positive integer as an argument to override a bot's default speed. access_card.access = user_access + prev_access //Adds the user's access, if any. mode = BOT_SUMMON speak("Responding.", radio_channel) + calc_summon_path() if("ejectpai") @@ -765,12 +766,12 @@ Pass a positive integer as an argument to override a bot's default speed. // given an optional turf to avoid /mob/living/simple_animal/bot/proc/calc_path(turf/avoid) check_bot_access() - set_path(get_path_to(src, patrol_target, /turf/proc/Distance_cardinal, 0, 120, id=access_card, exclude=avoid)) + set_path(get_path_to(src, patrol_target, 120, id=access_card, exclude=avoid)) /mob/living/simple_animal/bot/proc/calc_summon_path(turf/avoid) check_bot_access() spawn() - set_path(get_path_to(src, summon_target, /turf/proc/Distance_cardinal, 0, 150, id=access_card, exclude=avoid)) + set_path(get_path_to(src, summon_target, 150, id=access_card, exclude=avoid)) if(!path.len) //Cannot reach target. Give up and announce the issue. speak("Summon command failed, destination unreachable.",radio_channel) bot_reset() diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 9e4f60bf8a..723a9ad357 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -302,7 +302,7 @@ if(!path || path.len == 0) //No path, need a new one //Try to produce a path to the target, and ignore airlocks to which it has access. - path = get_path_to(src, target.loc, /turf/proc/Distance_cardinal, 0, 30, id=access_card) + path = get_path_to(src, target, 30, id=access_card) if(!bot_move(target)) add_to_ignore(target) target = null diff --git a/code/modules/mob/living/simple_animal/bot/firebot.dm b/code/modules/mob/living/simple_animal/bot/firebot.dm index 66d1955502..9eea7a85b1 100644 --- a/code/modules/mob/living/simple_animal/bot/firebot.dm +++ b/code/modules/mob/living/simple_animal/bot/firebot.dm @@ -223,7 +223,7 @@ if(target_fire && (get_dist(src, target_fire) > 2)) - path = get_path_to(src, get_turf(target_fire), /turf/proc/Distance_cardinal, 0, 30, 1, id=access_card) + path = get_path_to(src, target_fire, 30, 1, id=access_card) mode = BOT_MOVING if(!path.len) soft_reset() diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 5f0075aaa2..c8b502f032 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -263,9 +263,9 @@ if(path.len == 0) if(!isturf(target)) var/turf/TL = get_turf(target) - path = get_path_to(src, TL, /turf/proc/Distance_cardinal, 0, 30, id=access_card,simulated_only = 0) + path = get_path_to(src, TL, 30, id=access_card,simulated_only = 0) else - path = get_path_to(src, target, /turf/proc/Distance_cardinal, 0, 30, id=access_card,simulated_only = 0) + path = get_path_to(src, target, 30, id=access_card,simulated_only = 0) if(!bot_move(target)) add_to_ignore(target) diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index e00adfd8e8..0b21f4a825 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -492,10 +492,10 @@ return if(patient && path.len == 0 && (get_dist(src,patient) > 1)) - path = get_path_to(src, get_turf(patient), /turf/proc/Distance_cardinal, 0, 30,id=access_card) + path = get_path_to(src, patient, 30, id=access_card) mode = BOT_MOVING if(!path.len) //try to get closer if you can't reach the patient directly - path = get_path_to(src, get_turf(patient), /turf/proc/Distance_cardinal, 0, 30,1,id=access_card) + path = get_path_to(src, patient, 30, 1, id=access_card) if(!path.len) //Do not chase a patient we cannot reach. soft_reset() diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index dcb5e5f237..56e2f66feb 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -530,7 +530,7 @@ // calculates a path to the current destination // given an optional turf to avoid /mob/living/simple_animal/bot/mulebot/calc_path(turf/avoid = null) - path = get_path_to(src, target, /turf/proc/Distance_cardinal, 0, 250, id=access_card, exclude=avoid) + path = get_path_to(src, target, 250, id=access_card, exclude=avoid) // sets the current destination // signals all beacons matching the delivery code diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 7c7a684cf3..4cc66bc4bd 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -655,7 +655,7 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( item = I break if(item) - if(!AStar(src, get_turf(item), /turf/proc/Distance_cardinal)) + if(!get_path_to(src, item)) item = null continue return item diff --git a/html/statbrowser.html b/html/statbrowser.html index 1cb089a189..ecb47c419c 100644 --- a/html/statbrowser.html +++ b/html/statbrowser.html @@ -12,16 +12,27 @@ font-size: 12px !important; margin: 0 !important; padding: 0 !important; + overflow-x: hidden; + overflow-y: scroll; } + body.dark { background-color: #131313; - color: #abc6ec; + color: #b2c4dd; + scrollbar-base-color: #1c1c1c; + scrollbar-face-color: #3b3b3b; + scrollbar-3dlight-color: #252525; + scrollbar-highlight-color: #252525; + scrollbar-track-color: #1c1c1c; + scrollbar-arrow-color: #929292; + scrollbar-shadow-color: #3b3b3b; } #menu { background-color: #F0F0F0; position: fixed; width: 100%; + z-index: 100; } .dark #menu { @@ -38,7 +49,7 @@ } .dark a { - color: #abc6ec; + color: #b2c4dd; } a:hover, .dark a:hover { @@ -80,73 +91,115 @@ .button { background-color: #dfdfdf; - border-color: #cecece; - border-width: 1px; - border-style: solid; + border: 1px solid #cecece; + border-bottom-width: 2px; color: rgba(0, 0, 0, 0.7); - padding: 6px 4px; + padding: 6px 4px 4px; text-align: center; text-decoration: none; font-size: 12px; margin: 0; cursor: pointer; - transition-duration: 0.25s; + transition-duration: 100ms; order: 3; min-width: 40px; } .dark button { - background-color: #444444; + background-color: #222222; border-color: #343434; - color: rgba(255, 255, 255, 0.7); + color: rgba(255, 255, 255, 0.5); } .button:hover { background-color: #ececec; + transition-duration: 0; } .dark button:hover { - background-color: #4d4d4d; + background-color: #2e2e2e; } .button:active, .button.active { background-color: #ffffff; color: black; - border-top: 1px solid #cecece; - border-left: 1px solid #cecece; - border-right: 1px solid #cecece; - border-bottom: 1px solid #ffffff; + border-top-color: #cecece; + border-left-color: #cecece; + border-right-color: #cecece; + border-bottom-color: #ffffff; } .dark .button:active, .dark .button.active { - background-color: #131313; + background-color: #444444; color: white; - border-top: 1px solid #343434; - border-left: 1px solid #343434; - border-right: 1px solid #343434; - border-bottom: 1px solid #131313; + border-top-color: #343434; + border-left-color: #343434; + border-right-color: #343434; + border-bottom-color: #ffffff; } .grid-container { - display: inline-flex; - flex-wrap: wrap; - justify-content: flex-start; - align-items: flex-start; - min-width: 0; - min-height: 0; - white-space: pre-wrap; + margin: -2px; + margin-right: -15px; } .grid-item { - color: black; - width: 150px; - font-size: 11px; - line-height: 24px; - text-align: left; - min-width: 0; - min-height: 0; - white-space: pre-wrap; - padding-right: 12px; /* A little more than two spaces, to look good in IE8 where flex-justify does nothing */ + position: relative; + display: inline-block; + width: 100%; + box-sizing: border-box; + overflow: visible; + padding: 3px 2px; + text-decoration: none; + } + + @media only screen and (min-width: 300px) { + .grid-item { + width: 50%; + } + } + + @media only screen and (min-width: 430px) { + .grid-item { + width: 33%; + } + } + + @media only screen and (min-width: 560px) { + .grid-item { + width: 25%; + } + } + + @media only screen and (min-width: 770px) { + .grid-item { + width: 20%; + } + } + + .grid-item:hover { + z-index: 1; + } + + .grid-item:hover .grid-item-text { + width: auto; + text-decoration: underline; + } + + .grid-item-text { + display: inline-block; + width: 100%; + background-color: #ffffff; + margin: 0 -6px; + padding: 0 6px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + pointer-events: none; + } + + .dark .grid-item-text { + background-color: #131313; } .link { @@ -173,6 +226,10 @@ -ms-interpolation-mode: nearest-neighbor; image-rendering: pixelated; } + + .interview_panel_controls, .interview_panel_stats { + margin-bottom: 10px; + } @@ -242,53 +299,6 @@ if (!String.prototype.trim) { }, 0, 'test'); }()) -// Browser passthrough code --------------------------------------------------- -if (window.location) { - var anti_spam = []; // wow I wish I could use e.repeat but IE is dumb and doesn't have it. - document[addEventListenerKey]("keydown", function(e) { - if(e.target && (e.target.localName == "input" || e.target.localName == "textarea")) - return; - if(e.defaultPrevented) - return; // do e.preventDefault() to prevent this behavior. - if(e.which) { - if(!anti_spam[e.which]) { - anti_spam[e.which] = true; - var key = String.fromCharCode(e.which); - var x = event.x || event.clientX; - var y = event.y || event.clientY; - if(x || y ) // if either of these exist this is happening after a click - return; - window.location.href = "byond://winset?command=keyDown " + e.key; - } - } - }); - document[addEventListenerKey]("keyup", function(e) { - if(e.target && (e.target.localName == "input" || e.target.localName == "textarea")) - return; - if(e.defaultPrevented) - return; - if(e.which) { - anti_spam[e.which] = false; - var key = String.fromCharCode(e.which); - var x = event.x || event.clientX; - var y = event.y || event.clientY; - if( x || y ) // if either of these exist this is happening after a click - return; - - window.location.href = "byond://winset?command=keyUp " + e.key; - } - }); -} -/* document.addEventListener("mousedown", function(e){ - var shiftPressed=0; - var evt = e?e:window.event; - shiftPressed=evt.shiftKey; - if (shiftPressed) { - return false; - } - return true; -}); */ - // Status panel implementation ------------------------------------------------ var status_tab_parts = ["Loading..."]; var current_tab = null; @@ -300,20 +310,80 @@ var spell_tabs = []; var verb_tabs = []; var verbs = [["", ""]]; // list with a list inside var tickets = []; +var interviewManager = {status: "", interviews: []}; var sdql2 = []; var permanent_tabs = []; // tabs that won't be cleared by wipes var turfcontents = []; var turfname = ""; var imageRetryDelay = 500; var imageRetryLimit = 50; -var menu = document.querySelector('#menu'); -var under_menu = document.querySelector('#under_menu'); -var statcontentdiv = document.querySelector('#statcontent'); +var menu = document.getElementById('menu'); +var under_menu = document.getElementById('under_menu'); +var statcontentdiv = document.getElementById('statcontent'); var storedimages = []; +var split_admin_tabs = false; + +var connected = false; +var commandQueue = []; + +// Any BYOND verb call must go through this, as if a verb is sent during reconnect then +// it will cause the reconnect to fail. +// This function will either call immediately, or queue until +// BYOND confirms we are connected. +function send_byond_command(command) { + var href = "byond://winset?command=" + command; + + if (connected) { + window.location.href = href; + } else { + commandQueue.push(href); + } +} + +// Any BYOND commands that could result in the client's focus changing go through this +// to ensure that when we relinquish our focus, we don't do it after the result of +// a command has already taken focus for itself. +function run_after_focus(callback) { + setTimeout(callback, 0); +} + +function connected_to_server() { + if (connected) { + return; + } + + connected = true; + + for (var index = 0; index < commandQueue.length; index++) { + // This is just setting it a lot, is this not going to cancel? + window.location.href = commandQueue[index]; + } + + commandQueue = []; +} + +function update_split_admin_tabs(status) { + status = (status == true); + + if (split_admin_tabs !== status) { + if (split_admin_tabs === true) { + removeStatusTab("Events"); + removeStatusTab("Fun"); + removeStatusTab("Game"); + } + update_verbs(); + } + split_admin_tabs = status; +} function createStatusTab(name) { - if (name.indexOf(".") != -1) - name = name.split(".")[0]; + if (name.indexOf(".") != -1) { + var splitName = name.split("."); + if (split_admin_tabs && splitName[0] === "Admin") + name = splitName[1]; + else + name = splitName[0]; + } if(document.getElementById(name) || name.trim() == "") return; if(!verb_tabs.includes(name) && !permanent_tabs.includes(name)) @@ -386,6 +456,7 @@ function checkStatusTab() { if(!verb_tabs.includes(menu.children[i].id) && !permanent_tabs.includes(menu.children[i].id)) menu.removeChild(menu.children[i]); } + function remove_verb(v) { var verb_to_remove = v; // to_remove = [verb:category, verb:name] for(var i = verbs.length - 1; i >= 0; i--){ @@ -403,7 +474,14 @@ function check_verbs() { } function verbs_cat_check(cat) { - var tabCat = cat.indexOf(".") != -1 ? cat.split(".")[0] : cat; + var tabCat = cat; + if (cat.indexOf(".") != -1) { + var splitName = cat.split("."); + if (split_admin_tabs && splitName[0] === "Admin") + tabCat = splitName[1]; + else + tabCat = splitName[0]; + } var verbs_in_cat = 0; var verbcat = ""; if(!verb_tabs.includes(tabCat)){ @@ -412,7 +490,14 @@ function verbs_cat_check(cat) { } for(var v = 0; v < verbs.length; v++){ var part = verbs[v]; - verbcat = part[0].indexOf(".") != -1 ? part[0].split(".")[0] : part[0]; + verbcat = part[0]; + if (verbcat.indexOf(".") != -1) { + var splitName = verbcat.split("."); + if (split_admin_tabs && splitName[0] === "Admin") + verbcat = splitName[1]; + else + verbcat = splitName[0]; + } if(verbcat != tabCat || verbcat.trim() == ""){ continue; } @@ -441,6 +526,11 @@ function wipe_verbs() { checkStatusTab(); // remove all empty verb tabs } +function update_verbs() { + wipe_verbs(); + send_byond_command("Update-Verbs"); +} + function add_verb_list(v) { var to_add = JSON.parse(v); // list of a list with category and verb inside it to_add.sort(); // sort what we're adding @@ -448,7 +538,14 @@ function add_verb_list(v) { var part = to_add[i]; if(!part[0]) continue; - var category = part[0].indexOf(".") == -1 ? part[0] : part[0].split(".")[0]; + var category = part[0]; + if (category.indexOf(".") != -1) { + var splitName = category.split("."); + if (split_admin_tabs && splitName[0] === "Admin") + category = splitName[1]; + else + category = splitName[0]; + } if(findVerbindex(part[1], verbs)) continue; if(verb_tabs.includes(category)){ @@ -478,6 +575,7 @@ function remove_verb_list(v) { // passes a 2D list of (verbcategory, verbname) creates tabs and adds verbs to respective list // example (IC, Say) function init_verbs(c, v) { + connected_to_server(); wipe_verbs(); // remove all verb categories so we can replace them checkStatusTab(); // remove all status tabs verb_tabs = JSON.parse(c); @@ -510,12 +608,12 @@ function SendTabsToByond(){ } function SendTabToByond(tab) { - window.location.href = "byond://winset?command=Send-Tabs " + tab; + send_byond_command("Send-Tabs " + tab); } //Byond can't have this tab anymore since we're removing it function TakeTabFromByond(tab) { - window.location.href = "byond://winset?command=Remove-Tabs " + tab; + send_byond_command("Remove-Tabs " + tab); } function update(global_data, ping_entry, other_entries) { @@ -625,6 +723,7 @@ function tab_change(tab) { draw_debug(); } else if(tab == "Tickets") { draw_tickets(); +// draw_interviews(); } else if(tab == "SDQL2") { draw_sdql2(); }else if(tab == turfname) { @@ -636,8 +735,9 @@ function tab_change(tab) { } function set_byond_tab(tab){ - window.location.href = "byond://winset?command=Set-Tab " + tab; + send_byond_command("Set-Tab " + tab); } + function draw_debug() { statcontentdiv[textContentKey] = ""; var wipeverbstabs = document.createElement("div"); @@ -646,12 +746,26 @@ function draw_debug() { link[textContentKey] = "Wipe All Verbs"; wipeverbstabs.appendChild(link); document.getElementById("statcontent").appendChild(wipeverbstabs); + var wipeUpdateVerbsTabs = document.createElement("div"); + var updateLink = document.createElement("a"); + updateLink.onclick = function() {update_verbs()}; + updateLink[textContentKey] = "Wipe and Update All Verbs"; + wipeUpdateVerbsTabs.appendChild(updateLink); + document.getElementById("statcontent").appendChild(wipeUpdateVerbsTabs); var text = document.createElement("div"); text[textContentKey] = "Verb Tabs:"; document.getElementById("statcontent").appendChild(text); var table1 = document.createElement("table"); for(var i=0; i < verb_tabs.length ; i++) { var part = verb_tabs[i]; + // Hide subgroups except admin subgroups if they are split + if (verb_tabs[i].lastIndexOf(".") != -1) { + var splitName = verb_tabs[i].split("."); + if (split_admin_tabs && splitName[0] === "Admin") + part = splitName[1]; + else + continue; + } var tr = document.createElement("tr"); var td1 = document.createElement("td"); td1[textContentKey] = part; @@ -740,7 +854,7 @@ function draw_status() { } if(verb_tabs.length == 0 || !verbs) { - window.location.href = "byond://winset?command=Fix-Stat-Panel"; + send_byond_command("Fix-Stat-Panel"); } } @@ -776,6 +890,11 @@ function update_tickets(T){ if(current_tab == "Tickets") draw_tickets(); } +function update_interviews(I){ + interviewManager = JSON.parse(I); + if(current_tab == "Tickets") + draw_interviews(); +} function update_sdql2(S) { sdql2 = JSON.parse(S); if(sdql2.length > 0 && !verb_tabs.includes("SDQL2")) { @@ -805,12 +924,21 @@ function remove_tickets() { } checkStatusTab(); } + +function remove_interviews() { + if(tickets) { + tickets = []; + } + checkStatusTab(); +} + // removes MC, Tickets and MC tabs. function remove_admin_tabs() { href_token = null; remove_mc(); remove_tickets(); remove_sdql2(); +// remove_interviews(); } function add_admin_tabs(ht) { @@ -875,7 +1003,17 @@ function draw_listedturf() { // rather than every onmousedown getting the "part" of the last entry. return function(e) { e.preventDefault(); - clickcatcher = "?src=_statpanel_;statpanel_item_target=" + part[1] + ";statpanel_item_click=1"; + clickcatcher = "?src=_statpanel_;statpanel_item_target=" + part[1]; + switch(e.button){ + case 1: + clickcatcher += ";statpanel_item_click=middle" + break; + case 2: + clickcatcher += ";statpanel_item_click=right" + break; + default: + clickcatcher += ";statpanel_item_click=left" + } if(e.shiftKey){ clickcatcher += ";statpanel_item_shiftclick=1"; } @@ -912,7 +1050,7 @@ function draw_sdql2(){ var td2 = document.createElement("td"); if(part[2]) { var a = document.createElement("a"); - a.href = "?src=" + "_statpanel_" + ";statpanel_item_target=" + part[2] + ";statpanel_item_click=1"; + a.href = "?src=" + "_statpanel_" + ";statpanel_item_target=" + part[2] + ";statpanel_item_click=left"; a[textContentKey] = part[1]; td2.appendChild(a); } else { @@ -938,12 +1076,12 @@ function draw_tickets() { var td2 = document.createElement("td"); if(part[2]) { var a = document.createElement("a"); - a.href = "?_src_=holder;admin_token=" + href_token + ";ahelp=" + part[2] + ";ahelp_action=ticket;statpanel_item_click=1;action=ticket" ; + a.href = "?_src_=holder;admin_token=" + href_token + ";ahelp=" + part[2] + ";ahelp_action=ticket;statpanel_item_click=left;action=ticket" ; a[textContentKey] = part[1]; td2.appendChild(a); } else if(part[3]){ var a = document.createElement("a"); - a.href = "?src=_statpanel_" + ";statpanel_item_target=" + part[3] + ";statpanel_item_click=1"; + a.href = "?src=_statpanel_" + ";statpanel_item_target=" + part[3] + ";statpanel_item_click=left"; a[textContentKey] = part[1]; td2.appendChild(a); } else { @@ -956,6 +1094,55 @@ function draw_tickets() { document.getElementById("statcontent").appendChild(table); } +function draw_interviews() { + var body = document.createElement("div"); + var header = document.createElement("h3"); + header[textContentKey] = "Interviews"; + body.appendChild(header); + var manDiv = document.createElement("div"); + manDiv.className = "interview_panel_controls" + var manLink = document.createElement("a"); + manLink[textContentKey] = "Open Interview Manager Panel"; + manLink.href = "?_src_=holder;admin_token=" + href_token + ";interview_man=1;statpanel_item_click=left"; + manDiv.appendChild(manLink); + body.appendChild(manDiv); + + // List interview stats + var statsDiv = document.createElement("table"); + statsDiv.className="interview_panel_stats"; + for (var key in interviewManager.status) { + var d = document.createElement("div"); + var tr = document.createElement("tr"); + var stat_name = document.createElement("td"); + var stat_text = document.createElement("td"); + stat_name[textContentKey] = key; + stat_text[textContentKey] = interviewManager.status[key]; + tr.appendChild(stat_name); + tr.appendChild(stat_text); + statsDiv.appendChild(tr); + } + body.appendChild(statsDiv); + document.getElementById("statcontent").appendChild(body); + + // List interviews if any are open + var table = document.createElement("table"); + table.className = "interview_panel_table"; + if(!interviewManager) + return; + for(var i = 0; i < interviewManager.interviews.length; i++) { + var part = interviewManager.interviews[i]; + var tr = document.createElement("tr"); + var td = document.createElement("td"); + var a = document.createElement("a"); + a[textContentKey] = part["status"]; + a.href = "?_src_=holder;admin_token=" + href_token + ";interview=" + part["ref"] + ";statpanel_item_click=left"; + td.appendChild(a); + tr.appendChild(td); + table.appendChild(tr); + } + document.getElementById("statcontent").appendChild(table); +} + function draw_spells(cat) { statcontentdiv[textContentKey] = ""; var table = document.createElement("table"); @@ -968,7 +1155,7 @@ function draw_spells(cat) { var td2 = document.createElement("td"); if(part[3]) { var a = document.createElement("a"); - a.href = "?src=" + part[3] + ";statpanel_item_click=1"; + a.href = "?src=" + part[3] + ";statpanel_item_click=left"; a[textContentKey] = part[2]; td2.appendChild(a); } else { @@ -981,16 +1168,34 @@ function draw_spells(cat) { document.getElementById("statcontent").appendChild(table); } +function make_verb_onclick(command) { + return function() { + run_after_focus(function() { + send_byond_command(command); + }); + }; +} + function draw_verbs(cat){ statcontentdiv[textContentKey] = ""; var table = document.createElement("div"); var additions = {}; // additional sub-categories to be rendered table.className = "grid-container"; sortVerbs(); + if (split_admin_tabs && cat.lastIndexOf(".") != -1) { + var splitName = cat.split("."); + if (splitName[0] === "Admin") + cat = splitName[1]; + } verbs.reverse(); // sort verbs backwards before we draw for (var i = 0; i < verbs.length; ++i) { var part = verbs[i]; var name = part[0]; + if (split_admin_tabs && name.lastIndexOf(".") != -1) { + var splitName = name.split("."); + if (splitName[0] === "Admin") + name = splitName[1]; + } var command = part[1]; if (command && name.lastIndexOf(cat, 0) != -1 && (name.length == cat.length || name.charAt(cat.length) == ".")) { @@ -1002,9 +1207,13 @@ function draw_verbs(cat){ } var a = document.createElement("a"); - a.href = "byond://winset?command=" + command.replace(/\s/g, "-"); - a[textContentKey] = command; + a.href = "#" + a.onclick = make_verb_onclick(command.replace(/\s/g, "-")); a.className = "grid-item"; + var t = document.createElement("span"); + t[textContentKey] = command; + t.className = "grid-item-text"; + a.appendChild(t); (subCat ? additions[subCat] : table).appendChild(a); } } @@ -1029,7 +1238,7 @@ function set_theme(which) { if (which == "light") { document.body.className = ""; set_style_sheet("browserOutput_white"); - } else if (which == "dark" || which == "default") { + } else if (which == "dark") { document.body.className = "dark"; set_style_sheet("browserOutput"); } @@ -1040,7 +1249,7 @@ function set_style_sheet(sheet) { var currentSheet = document.getElementById("goonStyle"); currentSheet.parentElement.removeChild(currentSheet); } - var head = document.getElementsByTagName('head')[0]; + var head = document.getElementsByTagName('head')[0]; var sheetElement = document.createElement("link"); sheetElement.id = "goonStyle"; sheetElement.rel = "stylesheet"; @@ -1050,9 +1259,14 @@ function set_style_sheet(sheet) { head.appendChild(sheetElement); } -document[addEventListenerKey]("click", function(e) { - window.location.href = "byond://winset?map.focus=true"; -}); +function restoreFocus() { + run_after_focus(function() { + window.location.href = "byond://winset?map.focus=true"; + }); +} + +document[addEventListenerKey]("mouseup", restoreFocus); +document[addEventListenerKey]("keyup", restoreFocus); if(!current_tab) { addPermanentTab("Status"); @@ -1061,7 +1275,7 @@ if(!current_tab) { window.onload = function() { NotifyByondOnload(); - }; +}; function NotifyByondOnload() { window.location.href = "byond://winset?command=Panel-Ready"; diff --git a/interface/skin.dmf b/interface/skin.dmf index 69a9387ea4..55d0700faa 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -56,6 +56,7 @@ window "mainwindow" anchor2 = none is-default = true saved-params = "pos;size;is-minimized;is-maximized" + statusbar = false icon = 'modular_splurt\\icons\\ss13_64.png' macro = "default" menu = "menu" @@ -95,6 +96,7 @@ window "mapwindow" anchor2 = none saved-params = "pos;size;is-minimized;is-maximized" is-pane = true + on-status = ".winset \"status_bar.text=[[*]]\" " elem "map" type = MAP pos = 0,0 @@ -107,6 +109,16 @@ window "mapwindow" is-default = true saved-params = "zoom;letterbox;zoom-mode" style = ".center { text-align: center; } .maptext { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; color: white; line-height: 1.1; } .command_headset { font-weight: bold;\tfont-size: 8px; } .small { font-size: 6px; } .big { font-size: 8px; } .reallybig { font-size: 8px; } .extremelybig { font-size: 8px; } .greentext { color: #00FF00; font-size: 7px; } .redtext { color: #FF0000; font-size: 7px; } .clown { color: #FF69Bf; font-size: 7px; font-weight: bold; } .his_grace { color: #15D512; } .hypnophrase { color: #0d0d0d; font-weight: bold; } .yell { font-weight: bold; } .italics { font-size: 6px; }" + elem "status_bar" + type = LABEL + pos = 0,1008 + size = 280x16 + anchor1 = 0,100 + text = "" + align = left + background-color = #222222 + text-color = #ffffff + border = line window "infowindow" elem "infowindow" diff --git a/modular_sand/code/modules/mining/equipment/kinetic_crusher.dm b/modular_sand/code/modules/mining/equipment/kinetic_crusher.dm index e2013cb73f..f1af8ecdec 100644 --- a/modular_sand/code/modules/mining/equipment/kinetic_crusher.dm +++ b/modular_sand/code/modules/mining/equipment/kinetic_crusher.dm @@ -120,15 +120,27 @@ new /obj/effect/temp_visual/kinetic_blast(target) playsound(target.loc, 'sound/weapons/kenetic_accel.ogg', 60, 0) +// I'm gonna be honest, i cannot trust admins to be smart about it. +/obj/item/crusher_trophy/blaster_tubes/mask/vv_edit_var(var_name, var_value) + switch(var_name) + if(NAMEOF(src, bonus_value)) + if(istype(loc, /obj/item/kinetic_crusher)) + var/datum/component/two_handed/TH = loc.GetComponent(/datum/component/two_handed) + TH.force_wielded -= bonus_value + TH.force_wielded += var_value + . = ..() + /obj/item/crusher_trophy/blaster_tubes/mask/add_to(obj/item/kinetic_crusher/H, mob/living/user) . = ..() if(.) - H.force += bonus_value + var/datum/component/two_handed/TH = H.GetComponent(/datum/component/two_handed) + TH.force_wielded += bonus_value /obj/item/crusher_trophy/blaster_tubes/mask/remove_from(obj/item/kinetic_crusher/H, mob/living/user) . = ..() if(.) - H.force -= bonus_value + var/datum/component/two_handed/TH = H.GetComponent(/datum/component/two_handed) + TH.force_wielded -= bonus_value //lava imp /obj/item/crusher_trophy/blaster_tubes/impskull diff --git a/tgstation.dme b/tgstation.dme index bd84543ece..18d3708fec 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -198,7 +198,6 @@ #include "code\__HELPERS\_string_lists.dm" #include "code\__HELPERS\angles.dm" #include "code\__HELPERS\areas.dm" -#include "code\__HELPERS\AStar.dm" #include "code\__HELPERS\chat.dm" #include "code\__HELPERS\cmp.dm" #include "code\__HELPERS\config.dm" @@ -220,6 +219,7 @@ #include "code\__HELPERS\mobs.dm" #include "code\__HELPERS\mouse_control.dm" #include "code\__HELPERS\names.dm" +#include "code\__HELPERS\path.dm" #include "code\__HELPERS\priority_announce.dm" #include "code\__HELPERS\pronouns.dm" #include "code\__HELPERS\qdel.dm" @@ -315,6 +315,7 @@ #include "code\_onclick\hud\revenanthud.dm" #include "code\_onclick\hud\robot.dm" #include "code\_onclick\hud\screen_objects.dm" +#include "code\_onclick\hud\screentip.dm" #include "code\_onclick\hud\simple_animal.dm" #include "code\_onclick\hud\swarmer.dm" #include "code\_onclick\hud\screen_objects\clickdelay.dm"