From ab780b3acfacc0b274e0f2484e8800528526920c Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Mon, 14 May 2018 06:40:48 -0400 Subject: [PATCH] Removes A Bunch of Old, Unused Files --- code/_DATASTRUCTURES/linked_lists.dm | 191 ------------------------- code/_DATASTRUCTURES/priority_queue.dm | 83 ----------- code/_globalvars/station.dm | 4 - code/datums/computerfiles.dm | 7 - code/datums/modules.dm | 63 -------- code/game/objects/effects/barsign.dm | 8 -- code/game/skincmd.dm | 13 -- code/game/smoothwall.dm | 108 -------------- paradise.dme | 5 - 9 files changed, 482 deletions(-) delete mode 100644 code/_DATASTRUCTURES/linked_lists.dm delete mode 100644 code/_DATASTRUCTURES/priority_queue.dm delete mode 100644 code/datums/computerfiles.dm delete mode 100644 code/datums/modules.dm delete mode 100644 code/game/objects/effects/barsign.dm delete mode 100644 code/game/skincmd.dm delete mode 100644 code/game/smoothwall.dm diff --git a/code/_DATASTRUCTURES/linked_lists.dm b/code/_DATASTRUCTURES/linked_lists.dm deleted file mode 100644 index eccc3c422a8..00000000000 --- a/code/_DATASTRUCTURES/linked_lists.dm +++ /dev/null @@ -1,191 +0,0 @@ - -//Ok so it's technically a double linked list, bite me. - -/datum/linked_list - var/datum/linked_node/head - var/datum/linked_node/tail - var/node_amt = 0 - - -/datum/linked_node - var/value = null - var/datum/linked_list/linked_list = null - var/datum/linked_node/next_node = null - var/datum/linked_node/previous_node = null - - -/datum/linked_list/proc/IsEmpty() - . = (node_amt <= 0) - - -//Add a linked_node (or value, creating a linked_node) at position -//the added node BECOMES the position-th element, -//eg: add("Test",5), the 5th node is now "Test", the previous 5th moves up to become the 6th -/datum/linked_list/proc/Add(node, position) - var/datum/linked_node/adding - if(istype(node, /datum/linked_node)) - adding = node - else - adding = new() - adding.value = node - - if(!adding.linked_list || (adding.linked_list && (adding.linked_list != src))) - node_amt++ - - adding.linked_list = src - - if(position && position < node_amt) - //Replacing head - if(position == 1) - if(head) - head.previous_node = adding - adding.next_node = head - head = adding - - //Replacing any middle node - else - var/location = 0 - var/datum/linked_node/at - while((location != position) && (location <= node_amt)) - if(at) - if(at.next_node) - at = at.next_node - else - break - else - at = head - location++ - - //Push at up and assume it's place as the position-th element - if(at && at.previous_node) - at.previous_node.next_node = adding - adding.previous_node = at.previous_node - at.previous_node = adding - adding.next_node = at - return - - //Replacing tail - if(tail) - tail.next_node = adding - adding.previous_node = tail - if(!tail.previous_node) - head = tail - tail = adding - - - -//Remove a linked_node or the linked_node of a value -//If you specify a value the FIRST ONE is removed -/datum/linked_list/proc/Remove(node) - var/datum/linked_node/removing - if(istype(node,/datum/linked_node)) - removing = node - else - //optimise removing head and tail, no point looping for them, especially the tail - if(removing == head) - removing = head - else if(removing == tail) - removing = tail - else - var/location = 1 - var/current_value = null - var/datum/linked_node/at = null - while((current_value != node) && (location <= node_amt)) - if(at) - if(at.next_node) - at = at.next_node - else - at = head - location++ - if(at) - current_value = at.value - if(current_value == node) - removing = at - break - - //Adjust pointers of where removing -was- in the chain. - if(removing) - if(removing.previous_node) - if(removing == tail) - tail = removing.previous_node - if(removing.next_node) - if(removing == head) - head = removing.next_node - removing.next_node.previous_node = removing.previous_node - removing.previous_node.next_node = removing.next_node - else - removing.previous_node.next_node = null - else - if(removing.next_node) - if(removing == head) - head = removing.next_node - removing.next_node.previous_node = null - - //if this is still true at this point, there's no more nodes to replace them with - if(removing == head) - head = null - if(removing == tail) - tail = null - - removing.next_node = null - removing.previous_node = null - if(removing.linked_list == src) - node_amt-- - removing.linked_list = null - - return removing - return 0 - - -//Removes and deletes a node or value -/datum/linked_list/proc/RemoveDelete(node) - var/datum/linked_node/dead = Remove(node) - if(dead) - qdel(dead) - return 1 - return 0 - - -//Empty the linked_list, deleting all nodes -/datum/linked_list/proc/Empty() - var/datum/linked_node/n = head - while(n) - var/next = n.next_node - Remove(n) - qdel(n) - n = next - node_amt = 0 - - -//Some debugging tools -/datum/linked_list/proc/CheckNodeLinks() - var/datum/linked_node/n = head - while(n) - . = "|[n.value]|" - if(n.previous_node) - . = "[n.previous_node.value]<-" + . - if(n.next_node) - . += "->[n.next_node.value]" - n = n.next_node - . += "
" - - -/datum/linked_list/proc/DrawNodeLinks() - . = "|<-" - var/datum/linked_node/n = head - while(n) - if(n.previous_node) - . += "<-" - . += "[n.value]" - if(n.next_node) - . += "->" - n = n.next_node - . += "->|" - - -/datum/linked_list/proc/ToList() - . = list() - var/datum/linked_node/n = head - while(n) - . += n - n = n.next_node \ No newline at end of file diff --git a/code/_DATASTRUCTURES/priority_queue.dm b/code/_DATASTRUCTURES/priority_queue.dm deleted file mode 100644 index 8689a19f4e4..00000000000 --- a/code/_DATASTRUCTURES/priority_queue.dm +++ /dev/null @@ -1,83 +0,0 @@ - -////////////////////// -//PriorityQueue object -////////////////////// - -//an ordered list, using the cmp proc to weight the list elements -/PriorityQueue - var/list/L //the actual queue - var/cmp //the weight function used to order the queue - -/PriorityQueue/New(compare) - L = new() - cmp = compare - -/PriorityQueue/proc/IsEmpty() - return !L.len - -//return the index the element should be in the priority queue using dichotomic search -/PriorityQueue/proc/FindElementIndex(atom/A) - var/i = 1 - var/j = L.len - var/mid - - while(i < j) - mid = round((i+j)/2) - - if(call(cmp)(L[mid],A) < 0) - i = mid + 1 - else - j = mid - - if(i == 1 || i == L.len) //edge cases - return (call(cmp)(L[i],A) > 0) ? i : i+1 - else - return i - - -//add an element in the list, -//immediatly ordering it to its position using dichotomic search -/PriorityQueue/proc/Enqueue(atom/A) - if(!L.len) - L.Add(A) - return - - L.Insert(FindElementIndex(A),A) - -//removes and returns the first element in the queue -/PriorityQueue/proc/Dequeue() - if(!L.len) - return 0 - . = L[1] - - Remove(.) - -//removes an element -/PriorityQueue/proc/Remove(atom/A) - return L.Remove(A) - -//returns a copy of the elements list -/PriorityQueue/proc/List() - . = L.Copy() - -//return the position of an element or 0 if not found -/PriorityQueue/proc/Seek(atom/A) - . = L.Find(A) - -//return the element at the i_th position -/PriorityQueue/proc/Get(i) - if(i > L.len || i < 1) - return 0 - return L[i] - -//replace the passed element at it's right position using the cmp proc -/PriorityQueue/proc/ReSort(atom/A) - var/i = Seek(A) - if(i == 0) - return - while(i < L.len && call(cmp)(L[i],L[i+1]) > 0) - L.Swap(i,i+1) - i++ - while(i > 1 && call(cmp)(L[i],L[i-1]) <= 0) //last inserted element being first in case of ties (optimization) - L.Swap(i,i-1) - i-- \ No newline at end of file diff --git a/code/_globalvars/station.dm b/code/_globalvars/station.dm index d9e53d96834..2d635996b30 100644 --- a/code/_globalvars/station.dm +++ b/code/_globalvars/station.dm @@ -3,8 +3,4 @@ var/global/datum/datacore/data_core = null var/CELLRATE = 0.002 // multiplier for watts per tick <> cell storage (eg: .002 means if there is a load of 1000 watts, 20 units will be taken from a cell per second) var/CHARGELEVEL = 0.001 // Cap for how fast cells charge, as a percentage-per-tick (.001 means cellcharge is capped to 1% per second) -// this is not strictly unused although the whole modules datum thing is unused -// To remove this you need to remove that -var/datum/moduletypes/mods = new() - var/map_name = "Unknown" //The name of the map that is loaded. Assigned in world/New() \ No newline at end of file diff --git a/code/datums/computerfiles.dm b/code/datums/computerfiles.dm deleted file mode 100644 index 14cd7e38612..00000000000 --- a/code/datums/computerfiles.dm +++ /dev/null @@ -1,7 +0,0 @@ -datum - computer - var/name - folder - var/list/datum/computer/contents = list() - - file \ No newline at end of file diff --git a/code/datums/modules.dm b/code/datums/modules.dm deleted file mode 100644 index d01bded3254..00000000000 --- a/code/datums/modules.dm +++ /dev/null @@ -1,63 +0,0 @@ -// module datum. -// this is per-object instance, and shows the condition of the modules in the object -// actual modules needed is referenced through modulestypes and the object type - -/datum/module - var/status // bits set if working, 0 if broken - var/installed // bits set if installed, 0 if missing - -// moduletypes datum -// this is per-object type, and shows the modules needed for a type of object - -/datum/moduletypes - var/list/modcount = list() // assoc list of the count of modules for a type - - -var/list/modules = list( // global associative list -"/obj/machinery/power/apc" = "card_reader,power_control,id_auth,cell_power,cell_charge") - - -/datum/module/New(var/obj/O) - - var/type = O.type // the type of the creating object - - var/mneed = mods.inmodlist(type) // find if this type has modules defined - - if(!mneed) // not found in module list? - qdel(src) // delete self, thus ending proc - return - - var/needed = mods.getbitmask(type) // get a bitmask for the number of modules in this object - status = needed - installed = needed - -/datum/moduletypes/proc/addmod(var/type, var/modtextlist) - modules += type // index by type text - modules[type] = modtextlist - -/datum/moduletypes/proc/inmodlist(var/type) - return ("[type]" in modules) - -/datum/moduletypes/proc/getbitmask(var/type) - var/count = modcount["[type]"] - if(count) - return 2**count-1 - - var/modtext = modules["[type]"] - var/num = 1 - var/pos = 1 - - while(1) - pos = findtext(modtext, ",", pos, 0) - if(!pos) - break - else - pos++ - num++ - - modcount += "[type]" - modcount["[type]"] = num - - return 2**num-1 - - diff --git a/code/game/objects/effects/barsign.dm b/code/game/objects/effects/barsign.dm deleted file mode 100644 index fd66f8028d1..00000000000 --- a/code/game/objects/effects/barsign.dm +++ /dev/null @@ -1,8 +0,0 @@ -/obj/effect/sign/double/barsign - icon = 'icons/obj/barsigns.dmi' - icon_state = "empty" - anchored = 1 - - New() - var/list/valid_states = list("pinkflamingo", "magmasea", "limbo", "rustyaxe", "armokbar", "brokendrum", "meadbay", "thedamnwall", "thecavern", "cindikate", "theorchard", "thesaucyclown", "theclownshead", "whiskeyimplant", "carpecarp", "robustroadhouse", "greytide", "theredshirt") - src.icon_state = "[pick(valid_states)]" diff --git a/code/game/skincmd.dm b/code/game/skincmd.dm deleted file mode 100644 index 7d27a1ce6df..00000000000 --- a/code/game/skincmd.dm +++ /dev/null @@ -1,13 +0,0 @@ -/mob/var/skincmds = list() -/obj/proc/SkinCmd(mob/user as mob, var/data as text) - -/proc/SkinCmdRegister(var/mob/user, var/name as text, var/O as obj) - user.skincmds[name] = O - -/mob/verb/skincmd(data as text) - set hidden = 1 - - var/ref = copytext(data, 1, findtext(data, ";")) - if(src.skincmds[ref] != null) - var/obj/a = src.skincmds[ref] - a.SkinCmd(src, copytext(data, findtext(data, ";") + 1)) \ No newline at end of file diff --git a/code/game/smoothwall.dm b/code/game/smoothwall.dm deleted file mode 100644 index 20dea8de7b0..00000000000 --- a/code/game/smoothwall.dm +++ /dev/null @@ -1,108 +0,0 @@ -// OKAY I DON'T KNOW WHO THE FUCK ORIGINALLY CODED THIS BUT THEY ARE OFFICIALLY FIRED FOR BEING DRUNK AND STUPID -// FUCK YOU MYSTERY CODERS -// FOR THIS SHIT I'M GOING TO MAKE ALL MY COMMENTS IN CAPS - -/atom - var/list/canSmoothWith=list() // TYPE PATHS I CAN SMOOTH WITH~~~~~ - -// MOVED INTO UTILITY FUNCTION FOR LESS DUPLICATED CODE. -/atom/proc/findSmoothingNeighbors() - // THIS IS A BITMAP BECAUSE NORTH/SOUTH/ETC ARE ALL BITFLAGS BECAUSE BYOND IS DUMB AND - // DOESN'T FUCKING MAKE SENSE, BUT IT WORKS TO OUR ADVANTAGE - var/junction = 0 - for(var/cdir in cardinal) - var/turf/T = get_step(src,cdir) - if(isSmoothableNeighbor(T)) - junction |= cdir - continue // NO NEED FOR FURTHER SEARCHING IN THIS TILE - for(var/atom/A in T) - if(isSmoothableNeighbor(A)) - junction |= cdir - break // NO NEED FOR FURTHER SEARCHING IN THIS TILE - - return junction - -/atom/proc/isSmoothableNeighbor(var/atom/A) - return is_type_in_list(A,canSmoothWith) - -/turf/simulated/wall/isSmoothableNeighbor(var/atom/A) - if(is_type_in_list(A,canSmoothWith)) - // COLON OPERATORS ARE TERRIBLE BUT I HAVE NO CHOICE - if(src.mineral == A:mineral) //mineral not walltype so reinf still smooths with normal and vice versa - return 1 - return 0 - -/** - * WALL SMOOTHING SHIT - * - * IN /ATOM BECAUSE /TURFS ARE /ATOMS AND SO ARE /OBJ/STRUCTURE/FALSEWALLS - * THIS IS STUPID BUT IS FAIRLY ELEGANT FOR BYOND - * - * HOWEVER, INSTEAD OF MAKING ONE BIG GODDAMN MONOLITHIC PROC LIKE A FUCKING - * SHITTY FUNCTIONAL PROGRAMMER, WE WILL BE COOL AND MODERN AND USE INHERITANCE. - */ -/atom/proc/relativewall() - return // DOES JACK SHIT BY DEFAULT. OLD BEHAVIOR WAS TO SPAM LOOPS ANYWAY. - -/* - * SEE? NOW WE ONLY HAVE TO PROGRAM THIS SHIT INTO WHAT WE WANT TO SMOOTH - * INSTEAD OF BEING DUMB AND HAVING A BIG FUCKING IFTREE WITH TYPECHECKS - * MY GOD, WE COULD EVEN MOVE THE CODE TO BE WITH THE REST OF THE WALL'S CODE! - * HOW FUCKING INNOVATIVE. ISN'T INHERITANCE NICE? - * - * WE COULD STANDARDIZE THIS BUT EVERYONE'S A FUCKING SNOWFLAKE - */ -/turf/simulated/wall/relativewall() - var/junction=findSmoothingNeighbors() - icon_state = "[walltype][junction]" // WHY ISN'T THIS IN UPDATE_ICON OR SIMILAR - -/atom/proc/relativewall_neighbours(var/sko=0) //SKO: Skip Optimizations - // OPTIMIZE BY NOT CHECKING FOR NEIGHBORS IF WE DON'T FUCKING SMOOTH - if(canSmoothWith.len>0 || sko) - relativewall() - for(var/cdir in cardinal) - var/turf/T = get_step(src,cdir) - if(isSmoothableNeighbor(T) || sko) - T.relativewall() - for(var/atom/A in T) - if(isSmoothableNeighbor(A) || sko) - A.relativewall() - -/turf/simulated/wall/New() - ..() - relativewall_neighbours() - -/turf/simulated/wall/Destroy() - for(var/obj/effect/E in src) - if(E.name == "Wallrot") - qdel(E) - - if(!del_suppress_resmoothing) - spawn(10) - relativewall_neighbours(sko=1) - - // JESUS WHY - for(var/direction in cardinal) - for(var/obj/structure/glowshroom/shroom in get_step(src,direction)) - if(!shroom.floor) //shrooms drop to the floor - shroom.floor = 1 - shroom.icon_state = "glowshroomf" - shroom.pixel_x = 0 - shroom.pixel_y = 0 -/* for(var/obj/effect/supermatter_crystal/crystal in get_step(src,direction)) - if(!crystal.floor) //crystals drop to the floor - crystal.floor = 1 - crystal.icon_state = "supermatter_crystalf" - crystal.pixel_x = 0 - crystal.pixel_y = 0 */ - return ..() - -// DE-HACK -/turf/simulated/wall/vault/relativewall() - return - - -/obj/structure/alien/resin/relativewall() - var/junction = findSmoothingNeighbors() - icon_state = "[resintype][junction]" - return \ No newline at end of file diff --git a/paradise.dme b/paradise.dme index fc55f608558..eb9b3dce400 100644 --- a/paradise.dme +++ b/paradise.dme @@ -88,8 +88,6 @@ #include "code\__HELPERS\sorts\MergeSort.dm" #include "code\__HELPERS\sorts\TimSort.dm" #include "code\_DATASTRUCTURES\heap.dm" -#include "code\_DATASTRUCTURES\linked_lists.dm" -#include "code\_DATASTRUCTURES\priority_queue.dm" #include "code\_DATASTRUCTURES\stacks.dm" #include "code\_globalvars\configuration.dm" #include "code\_globalvars\database.dm" @@ -220,7 +218,6 @@ #include "code\datums\beam.dm" #include "code\datums\browser.dm" #include "code\datums\callback.dm" -#include "code\datums\computerfiles.dm" #include "code\datums\datacore.dm" #include "code\datums\datum.dm" #include "code\datums\datumvars.dm" @@ -228,7 +225,6 @@ #include "code\datums\hud.dm" #include "code\datums\mind.dm" #include "code\datums\mixed.dm" -#include "code\datums\modules.dm" #include "code\datums\mutable_appearance.dm" #include "code\datums\periodic_news.dm" #include "code\datums\progressbar.dm" @@ -385,7 +381,6 @@ #include "code\game\data_huds.dm" #include "code\game\response_team.dm" #include "code\game\shuttle_engines.dm" -#include "code\game\skincmd.dm" #include "code\game\sound.dm" #include "code\game\world.dm" #include "code\game\area\ai_monitored.dm"