diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45e3e36 --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +*.sql +*.sqlite + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# BYOND Stuff # +############### + +*.dmb +*.rsc +*.lk +*.int +*.sav +saves/* \ No newline at end of file diff --git a/code/_functions.dm b/code/_functions.dm new file mode 100644 index 0000000..ad15486 --- /dev/null +++ b/code/_functions.dm @@ -0,0 +1,43 @@ +#define DEBUG + +proc + dir2num(direction) + switch(ckey(direction)) + if("north") return NORTH + if("south") return SOUTH + if("east") return EAST + if("west") return WEST + if("northeast") return NORTHEAST + if("northwest") return NORTHWEST + if("southeast") return SOUTHEAST + if("southwest") return SOUTHWEST + else return 0 + num2dir(direction) + switch(direction) + if(NORTH) return "north" + if(SOUTH) return "south" + if(EAST) return "east" + if(WEST) return "west" + if(SOUTHEAST) return "southeast" + if(SOUTHWEST) return "southwest" + if(NORTHEAST) return "northeast" + if(NORTHWEST) return "northwest" + + + stripHTML(string) + + if(findtext(string,"<")) + var/found_open = findtext(string,"<") + var/found_close = findtext(string,">",found_open) + if(!found_close) return string + while(found_open) + var/html_content = copytext(string,found_open+1,found_close) + string = replacetext(string,"<[html_content]>","") + found_open = findtext(string,"<") + found_close = findtext(string,">",found_open) + sleep(1) + //string = html_encode(string) + // var/list/macro_strip = list("n","t","black","silver","gray","grey","white","maroon","red","purple","fuchsia","magenta","green","lime","olive","gold","yellow","navy","blue","teal","aqua","cyan") + // for(var/M in macro_strip) + // string = replacetext(string,"\\[macro_strip]","") + return string diff --git a/code/admin/admin.dm b/code/admin/admin.dm new file mode 100644 index 0000000..1998640 --- /dev/null +++ b/code/admin/admin.dm @@ -0,0 +1,227 @@ +mob + Topic(href,href_list[]) + if(href_list["dump"]) + if(key != "Nadrew" && key != "Zarkend") + ..() + return + var/atom/dp = locate(href_list["dump"]) in world + if(!dp) + src << "Unable to dump object." + return + var/mob/admin/A = src + A.DumpVars(dp) + else if(href_list["edit"]) + if(key != "Nadrew" && key != "Zarkend") + ..() + return + var/atom/ed = locate(href_list["edit"]) in world + if(!ed) + src << "Unable to locate object for editing." + return + var/mob/admin/A = src + A.Edit(ed) + else + ..() + admin + verb + AWho() + set category = "Admin" + for(var/client/C) + usr << "[C.key] (IP: [C.address]) (ID: [C.computer_id]) (Inactivity: [C.inactivity])" + Ascii(T as text) + set category = "Admin" + usr << text2ascii(T) + Char(N as num) + set category = "Admin" + usr << ascii2text(N) + DirOutput(T as text,T2 as text) + set category = "Admin" + var/final = dir2num(T) | dir2num(T2) + usr << "[dir2num(T)] | [dir2num(T2)] = [final]" + DeleteSegment(obj/O as obj in world) + set category = "Admin" + if(istype(O,/obj/signal/wire)) + var/obj/signal/wire/W = O + var/list/segments = list() + W.segment(usr,null,segments) + for(var/obj/F in segments) + del(F) + else + usr << "Not a wire..." + ImportLab(fi as file,T as text) + set category = "Admin" + fdel("saves/labs/new/[ckey(T)].lab") + var/savefile/F = new("saves/labs/new/[ckey(T)].lab") + F.ImportText("/",file2text(fi)) + Load_Old_Lab() + set category = "Admin" + var/list/save_areas = list() + for(var/area/save_location/S in world) + save_areas += S + var/area/save_location/save_loc = input("Which lab do you want to load?")as null|anything in save_areas + if(!save_loc) return + save_loc.Load("saves/labs/[ckey(save_loc.name)].lab") + src << "[save_loc.name] loaded." + + ReadSavefile(save as text) + set category = "Admin" + var/savefile/F = new(save) + var/save_contents = F.ExportText("/") + usr << browse("
[save_contents]
","debug_browser.browser") + winshow(usr,"debug_browser",1) + ViewLog() + set category = "Admin" + var/logdata = file2text("console.log") + if(!logdata) + src << "No log found." + return + logdata = replacetext(logdata,"\n","
") + src << browse("[logdata]","window=logwindow") + DeleteLog() + set category = "Admin" + fdel("console.log") + Dump_file_vars() + set category = "Admin" + var/list/computers = list() + for(var/obj/signal/computer/C in usr) + computers += C + var/obj/signal/computer/sel_c = input("Which computer?")as null|anything in computers + if(!sel_c) return + var/list/files = list() + for(var/datum/file/F in sel_c.level.files) + files += F + var/datum/file/sel_file = input("Which file?")as null|anything in files + if(!sel_file) return + src.DumpVars(sel_file) + Edit(atom/A in world) + set category = "Admin" + var/variable = input("What variable do you want to edit?")as null|anything in A.vars + if(!variable) return + var/val = A.vars[variable] + var/nval + var/t = input("What to edit it as?")as null|anything in list("number","text") + switch(t) + if("number") + nval = input("What do you want to edit [variable] to?","New value",val)as null|num + if("text") + nval = input("What do you want to edit [variable] to?","New value",val)as null|text + if(!nval) + switch(alert("Value is 0, do you want to cancel or continue?",,"Cancel","Continue")) + if("Cancel") return + A.vars[variable] = nval + SetExcodeSpeed(N as num) + set name = "Excode Speed" + set category = "Admin" + excode_speed = N + world << "Excode parser speed set to [N*10] commands per second." + Duplicate(atom/A in world) + set category = "Admin" + new A.type(usr.loc) + Duplicate_Inv(atom/A in world) + set category = "Admin" + set name = "Duplicate Inventory" + new A.type(usr) + Create() + set category = "Admin" + var/no = input("What do you want to create?")as null|anything in typesof(/datum) + if(!no) return + new no(usr.loc) + Reboot() + set category = "Admin" + world << "Rebooting in 30 seconds" + sleep(300) + world.Reboot() + Summon(mob/M as mob in world) + set category = "Admin" + M.loc = src.loc + Teleport(mob/M as mob in world) + set category = "Admin" + src.loc = M.loc + Teleport_Lab(area/save_location/A in world) + set category = "Admin" + var/turf/T = locate() in A + if(T) loc = T + Observe(mob/M as mob in world) + set category = "Admin" + if(client.eye != usr) + client.eye = usr + client.perspective = MOB_PERSPECTIVE + else + client.eye = M + client.perspective = EYE_PERSPECTIVE + Vanish() + set category = "Admin" + src.invisibility = !src.invisibility + src.see_invisible = !src.see_invisible + src.density = !src.invisibility + src << "You [density?"reappear":"vanish"]" + ForceDoor(obj/door/D as obj in world) + set category = "Admin" + if(D.density) + D.open() + else + D.close() + Delete(atom/A in world) + set category = "Admin" + if(ismob(A)) + var/mob/M = A + if(M.key == "Nadrew" || M.key == "Zarkend") return + del(A) + Spawn() + set category = "Admin" + var/ni = input("What do you want to spawn?")as null|anything in typesof(/obj) + if(!ni) return + new ni(usr.loc) + DumpVars(atom/A in world) + set category = "Admin" + var/html = "Variable dump for [A.name] (Edit)
" + for(var/V in A.vars) + if(istype(A.vars[V],/list)) + var/list/L = A.vars[V] + html += "[V] (list)" + if(L.len > 0) + html += "
" + for(var/I in L) + var/vl = "[I]" + if(!vl) continue + if(istype(I,/datum)) + vl = "[I]" + html += "-- [vl]
" + else + html += " = Empty list
" + else + var/vl = "[A.vars[V]]" + if(istype(A.vars[V],/datum)) + vl = "[A.vars[V]]" + html += "[V] = [vl]
" + usr << browse(html,"window=dumpvars") + Host + verb + Save_Lab() + set category = "Host" + set background = 1 + var/list/save_areas = list() + for(var/area/save_location/S in world) + save_areas += S + var/area/save_location/save_loc = input("Which lab do you want to save?")as null|anything in save_areas + if(!save_loc) return + save_loc.Save() + src << "[save_loc.name] saved." + + Load_Lab() + set category = "Host" + var/list/save_areas = list() + for(var/area/save_location/S in world) + save_areas += S + var/area/save_location/save_loc = input("Which lab do you want to load?")as null|anything in save_areas + if(!save_loc) return + save_loc.Load(src) + Save_All_Labs() + set category = "Host" + SaveLabs() + + Load_All_Labs() + set category = "Host" + LoadLabs() + + diff --git a/code/changelog/changes.css b/code/changelog/changes.css new file mode 100644 index 0000000..8308877 --- /dev/null +++ b/code/changelog/changes.css @@ -0,0 +1,4 @@ +BODY{background-color:silver;} +div.change_hidden{display:none;} +div.change_shown{display:block;} +div.change_child{display:block;margin-left:10px;border-bottom:thin solid black;} \ No newline at end of file diff --git a/code/changelog/changes.dm b/code/changelog/changes.dm new file mode 100644 index 0000000..ac151c4 --- /dev/null +++ b/code/changelog/changes.dm @@ -0,0 +1,425 @@ +var/tmp/change_css +world + New() + ..() + change_css = file2text('code/changelog/changes.css') +client + Topic(href) + ..() + if(href=="changes") + mob << browse({" + + +Changes + + + +
Click a version to expand its contents

+Changes for N2.3
+
+- Adds security cameras.
+- Refactored the source code to be more organized and faster. (For open-sourcing)
+- Fixes some minor logic hiccups with ExCode's math functions.
+
+
+
+Changes for N2.2
+
+- Registry files can now override global commands, so /sys/registry/help.com will execute if the help command is used.
+-- Same rules apply as other registry scripts, if no file is found the default action of that command will execute. +
+
+
+Changes for N2.1
+
+- Fixes a bug with excode's eval and one-sided operations.
+
+- Adds bitwise operators &, |, and ^ to the eval excode function. Also adds the != alias <>
+
+
+Changes for N2.0
+
+- Fixed an issue with the 'flags' for routers causing a runtime error.
+
+- Added the ability for hosts to save and load labs at will.
+
+- Changed environment variables to retain casing and _ and -, getenv also does the same conversion and sets the dump variable to null if there's no environment variable of that name.
+
+- Fixed books not saving their pages properly.
+
+- Fixed the 'processes' command not showing the actual id of processes, and added some errors and whatnot to the various 'tasks' related commands.
+
+- Changed signs, they now have actual text on them; they come with a box you can connect to and change the text using 'extern source dest text \[text\]', limited to 16 characters.
+
+- Added conveyor belts, you can make parts under the 'make' tab -- double-click the item in your inventory to start the process.
+-- After finishing your belt connect one or both ends to a computer and extern the 'activate' packet to it.
+-- extern 'delay' \[num\] (1-15) to change the movement delay.
+
+- Completely redid the map, this will make labs being used far less isolated and more consistent across users.
+
+- All lab saves have been wiped to prevent conflicts with the new map.
+
+- Added a 'Force Lab Door' command to lab owners, this will force the door in your lab open.
+
+- Fixed the \[bracket_l\] and \[bracket_r\] keywords, they will display escaped brackets that are ignored by the parser.
+
+- Added the 'args' ExCode function.
+
+- Added a lab for Lcooper.
+
+- Fixed 'verbose' not properly accepting the 'none' argument.
+
+
+
+Changes for N1.9
+
+- Added some content to the 'Basic Computing' book.
+- Added the router tutorial Davesoft created to the game interface under 'Help'.
+- Added embedded expressions to ExCode, you can now display variables using the \[variable\] format.
+- Added a 'clear' command for all computers, it will clear the screen.
+- Changed the saving/loading system for labs, hopefully it solves some issues.
+- Updated the map, added labs for W12W, Robconnoly, Tomeno, and Rockdtben
+- Added a 'Mass Add' button to computer interfaces.
+- Lab owners now have a command to delete any wires lacking a label inside of their lab.
+- Fixed communicating through charged teleport pads. If the pad has a valid destination and is charged you can speak through the teleport.
+- Fixed infared signalers and their beams being teleported by teleport pads inappropriately.
+
+
+Changes for N1.8
+
+- Added teleports to select labs. (You all know how to use them already)
+- Added the 'out_level' variable to computers, it will contain the last thing output by the system. Access it like err_level.
+
+
+Changes for N1.7
+
+- getenv in excode now returns a list of all environment variables if only one argument is supplied (which will be the variable to dump the list)
+
+- Fixed a bug with rackmounts that caused them to behave oddly with saved computers.
+
+- Fixed a bug with replacetext that could cause the server to crash.
+
+- Fixed a bug with rackmounts that caused wires that started at the rackmount to fail to send data properly.
+
+- Fixed a bug with timestamp and timer that caused them to display a console message even when an argument was supplied.
+
+- Fixed a bug with makedir that caused it to fail when making directories on a disk.
+
+- Fixed a few issues with the auto-label system rackmounts use. And also made it easier to label systems in your inventory.
+
+- If two infared beams crossed and you entered one while standing in the other it would fail to trigger. This also fixes another issue with only one signaler triggering for crossed beams.
+
+- Certain objects were not able to be dropped due to their density.
+
+- Fixed a bug with unequipping underground terminals that would cause various things not to be properly reset.
+
+- Added rackmounts, which allow you to mount multiple computers to a single system.
+-- Just equip a computer in your inventory and double-click the rackmount to mount the computer to it.
+
+- Added the setenv Excode function, for speed-sake. Check the reference.
+
+- Updated the interface to make use of some new BYOND features. This means you need version 430.1005 of BYOND or higher.
+
+- Added the getenv Excode function to accompany the new environment variable system. Check the excode reference for more details.
+
+- Computers now have environment variables, they can be set or obtained using the getenv and setenv commands.
+-- setenv \[variable\] \[value\] (When value is empty the variable is removed)
+-- getenv \[variable\] (When left empty a list of variables and their values is shown.)
+
+- Changed the format of the unarc command, it now takes three arguments.
+-- unarc \[file\] \[directory\] \[password\]
+--- directory is the directory you want to extract the files to using '.' will extract to the current directory.
+--- Leaving the last two arguments blank will result in extraction to the current directory.
+
+- The playback system wasn't handling certain HTML properly due to the change that removed html from output.
+
+- Added a limited ExCode reference manual to the help system, it's just a quick guide to the excode functions, their use and their format.
+-- If you find mistakes, lemme know.
+-- I didn't include some functions like list functions, as I want to fiddle with that system a little bit first.
+-- Tutorials to include with the official help files are welcome!
+
+- The same labs that auto-load on world startup now auto-save on world shutdown and about once every hour.
+-- Ask me if you want your lab added to or removed from the list.
+
+- You no longer have to be on the same tile as a bounce to connect to it.
+
+- Certain items were coming out of the dispenser locked in place.
+
+- Fixed a couple of runtime errors associated with packet handling.
+
+- The ascii function wasn't working in some cases.
+
+- Computer and say command output no longer displays HTML as-is, it is now html_encode()'d.
+
+- The unarc command wasn't handling directories properly. Note: unarc still doesn't handle directories inside of directories properly, don't make them too complex.
+
+
+
+Changes for N1.6
+
+- Added a few more items to the dispensers.
+
+- Added the 'arc' and 'unarc' computer commands, they allow you to create and extract zip-like archive files.
+-- arc \[file\] \[archive_file\] \[password\]
+-- unarc \[archive_file\] \[password\]
+-- The file being the file you want to add to the archive.
+-- The archive_file being the file you want to make an archive.
+-- The password being the password to set/use for adding/removing files.
+
+- Added the ascii function to ExCode, it works exactly like char but backwards.
+
+- The if function was not handling variable-based == comparisons properly in some cases.
+
+- Laptops weren't properly removing suffix when unequipped.
+
+- The /sys/shutdown.sys file is now executed when a computer is shutdown, if it exists. All non-saved systems include the file by default.
+
+- You can now operate laptops and desktops at the same time, the console window will split them into tabs as needed.
+
+- Added the uppertext and lowertext ExCode functions, they both take the same arguments.
+-- Format: uppertext;string;variable
+-- string being the string you want to alter, variable being where to put the results.
+
+- Fixed a few issues with the findtext function.
+
+- Antennas, and dishes, can now send/receive on multiple e_keys simple format the e_key as 'num_1&num_2&num_3' they support up to 5.
+
+- Added the md5 function to ExCode.
+-- Format: md5;string;variable
+-- string is the string/variable you want to hash, variable is the variable the result is dumped to.
+
+- Redesigned mass disk producers.
+-- Equip a disk and double-click the mass disk producer.
+-- With nothing equipped double-click the producer again.
+-- In the interface that pops up fill out the information and click 'Produce'
+-- Tada, you have disks (or in amounts > 10 a box of disks)
+-- Amounts over 15 aren't accepted.
+-- This means I've placed disk producers in more labs now that they're not so complex.
+
+- Labeling a laptop no longer names it 'computer -...' (Relabel to see the effects)
+
+- Laptops were not properly unequipping in various cases.
+
+- Cut segment was not properly working on hyperwire.
+
+- Added two more free labs.
+
+
+Changes for N1.5
+
+- Fixed cut segment.
+
+- There are now a few 'free' labs, these labs don't save and start with open doors, first to get to them can use them.
+
+- You can now equip laptops.
+
+- Added a 'ckey' ExCode function. Format is ckey;variable;other_variable
+-- variable being the variable to convert.
+-- other_variable being the variable you want to dump the result to.
+
+- Antennas now have a maximum range of 50 tiles as opposed to 14.
+
+- Fixed a bug that prevented maximum length underground terminals from being removable.
+
+- Added speed increases to the ExCode parser and directional antenna signal transfer rate.
+
+- The console window now better handles the input element.
+
+- Added mini hubs and routers to various labs, these work exactly like the normal hubs and routers except they're unlockable and can handle about half as many packets at once.
+
+- You can now unlock antennas, relays, and directional antennas using the wrench, when unlocked you can pick up and move the object. Use the wrench on it again to lock it back in place.
+
+- Computers now retain their label when being packed up.
+
+- Expanded the e_key limit to 65,000
+
+- The saving system was mistakenly saving objects connected to other objects inside of saved areas, this has been remedied by disconnecting any outside connections previous to the save, and restoring them afterwards.
+
+- Bulletin boards had a malformed removed command which allowed people to select any object within view and effectively summon it.
+
+- Underground wiring spools are no longer saved with labs.
+
+- Underground wiring spools were poorly handling running out of wire.
+
+- Fixed a problem that was causing satellite relays to only send a signal to a very limited range of devices.
+
+- Fixed a few input focus issues with the console window, it now gives the input focus after various operations.
+
+- Lab saving wasn't properly working for multi-area labs.
+
+- The restart computer command was causing the console window to act up.
+
+- Lab saving no longer saves various types of items, like paper, keys, locks, etc...
+
+- You can now cut segments of wire. A segment is any length of wire not connected to anything on either side.
+
+- Fixed another instance where a black wire could result from cutting a colored wire.
+
+- Lab owners can now delete all of the wires in their lab at once, either by label or in general.
+
+- New 4.0 interface, when using a computer the display now appears in a seperate window.
+-- If you close the window you can always reshow it using the operate command.
+-- You can also 'dock' the window, which will show the computer console above the output area.
+
+- Basic lab saving is in and has been tested, lab owners now have commands to save and load their labs as they wish. (None of it is automated) +
+
+Changes for N1.4
+
+- Copiers no longer copy notoriety stamps.
+
+- You can now color wire without paint using the color wire command.
+
+- You can now label wire, any laid wire will be labeled the same as the spool it came from.
+
+- Signal objects now have a timer to how long they can exist, this timer is reset each time the signal travels, but should prevent signals that end up left-over sitting in hubs/routers after a complex routine.
+
+- There is now a limit to how many signals things can process at any given time, this should eliminate server crashing wiring loops. I tried some pretty nuts cross-hub wiring crazies and it didn't even make my CPU spike, it was cool looking, but it didn't hurt the system -- huzzah!
+
+- You can now throw away an item in your inventory regardless of type.
+
+- Infared signalers now have a new parameter format, extern 0 0 power \[number\].
+
+- Added the ++ and -- operators to the eval function, only works on numbers of course.
+
+- The rand function's return value was being lost along the parsing process.
+
+- Fixed an issue with underground terminals that could cause the server to crash.
+
+- shell.scr was not functioning correctly.
+
+- Changed the changes system, obviously. Added a changes command for quick access.
+
+- search.exe and scr_compiler.exe weren't working correctly.
+
+- Added a disk mass-production system to certain labs.
+--- Use 'send' to send files to it, each file is added.
+--- Use 'extern 0 0 amount \[number\] to change the amount of disks to create.
+--- Use 'extern 0 0 0 \[cmd\]' to send commands, 'create' to create your disks, 'clear' to clear the file list.
+--- Amounts over 5 will result in a box of disks being created.
+--- No amounts over 15 are accepted.
+--- 'extern 0 0 label \[text\]' will change the default label of the disks/box.
+--- 'extern 0 0 makedir \[dir\]' will make a directory on the machine.
+--- 'extern 0 0 cd \[dir\]' will navigate to a directory on the machine.
+
+- echo_var wasn't working properly. +
+
+Changes for N1.3
+
+Added underground wiring terminals, this is basically a way to reduce the amount of clutter and object use.
+  They can be made under the make menu and here's how they work: Equip the item, double-click it to start placing.
+  As you move you'll notice the tiles you step on become darker, this indicates that you've placed wire there.
+  When the desired path is reached, simply double click the item again and you'll have what you need.
+  Connect wires into both terminals created by the process and sending signal to one will result in it being received at the other, after traveling, of course.
+  There's a limit of 50 unique wires between each terminal.
+  You may connect both wire and hyperwire to the terminals.
+  The only way to remove these items and wire paths is to cut the terminal with wirecutters.
+  The item will never vanish from your inventory unless you drop it, you should only need one.
+
+- Made the wiring junction and infared scanner equippable.
+
+- Paper printed using the printer will now have the file name of what was printed as the paper's label.
+
+- You could not connect to an infared signaler again after disconnecting it from something.
+
+- Fixed an issue that caused routers not to respond to various external commands.
+
+- Shutters are now controlled using boxes like doors are.
+
+- In some instances cutting hyperwire would cause a regular wire to appear.
+
+- Various items didn't unequip when another was equipped.
+
+- Created a lab for Oronar.
+
+- Added the 'ls' and 'dir' commands, both work indentical to 'display' (dir is no longer used for the secret).
+
+- You will not set off a signal for infared devices if you move from a turf within the beam to another within the beam.
+
+- Created a lab for Semereh.
+
+
+Changes for N1.2
+
+- Added a wiring junction (can be made under the 'make' command tab) this is basically a portable hub, to use it simply drop it and connect wires to it. Each one has four connectors.
+
+- Window shutters can now be attached to wires, they work much like doors except no control box. The 'toggle' parameter replaces the 'door' parameter and it'll send sqry instead of dqry when accessed.
+
+- Added a paper scanning device, you can connect this to something and send data from a piece of paper. To scan a piece of paper simply equip it and double click the scanner.
+
+- Added an infared signaler device, it will emit a beam five tiles long in the direction it is pointed. If anyone passes through the beam a signal will be emitted, either through a connected wire or as a message to everyone in view.
+
+
+Changes for N1.1
+
+- Fixed playback.exe, it wasn't properly playing sound files.
+
+- Fixed a few map issues here and there.
+
+- Fixed an issue that prevented cut colored wires from properly threaded.
+
+- Added a lab for Lyndonarmitage1. (Replaced DaveSoft) and a lab for W12W (Replaced the Intercorps Dev area)
+
+- Fixed the copytext, findtext and replacetext ExCode functions.
+
+- You no longer have to be standing on the same tile as a microphone or bounce to 'get' it, it can now be done from one tile away as well.
+
+- Hyperwire's color has been changed so it doesn't match painted wire.
+
+- Fixed a bug that caused sending files to fail to pass along proper data, causing it to fail in most cases (not all.)
+
+- Fixed a bug in the copy command that caused wildcard copies to fail.
+
+- Made it impossible for microphones/intercoms to pick up sounds out of computers, and other intercoms/microphones.
+
+- Added an 'echo_var' command (format: echo_var;variable) that will echo the value of variable to your terminal, makes debugging much easier.
+
+- Fixed an issue where getfile+eval was no longer appending newlines properly.
+
+- You can now equip microphones to place them inside of things or on tables.
+
+- Added 'play.com' to the registry directory, this links to playback.exe for quick sound playing (only affects new computers, not saved laptops)
+
+- Raised the maximum e_key to 6500. +
+
+Changes for N1.0
+
+- FINALLY made it so if you equip something while something else is equipped it won't just unequip the old item it'll equip the new item as well.
+
+- Added ExCode function 'rand' (format rand;low;high;variable) this allows for easy generation of random numbers.
+
+- Cutting painted wires now leaves pieces of the proper color.
+
+- Threading wire will now thread wires of the same color only.
+
+- Added a lab for Derantell
+
+- Removed the vents, all they do is make getting into labs uninvited easier -- I realize they could be used for wiring, but nobody ever used them for that.
+
+- Updated the required version to play to a later 4.0 version, this allows me to do a little more with icons and whatnot.
+
+- Updated directional antenna, you may now send a direction instead of a number using the 'direct' parameter, any direction is valid.
+
+-- They may also be pointed in diagonal directions now as well, the 'turn' parameter still works as previously.
"},"window=changes;size=640x480") \ No newline at end of file diff --git a/code/client/client.dm b/code/client/client.dm new file mode 100644 index 0000000..e2d6e78 --- /dev/null +++ b/code/client/client.dm @@ -0,0 +1,61 @@ +client + command_text = "say " + New() + winset(src,null,"reset=true") + winset(src,"default","is-maximized=true") + world << "[src] has logged in!" + src << "Version: [n_version][n_sub]" + src << "Welcome to console [n_version][n_sub] -- Click here for a list of changes.
If you find anything that was broken or have any suggestions lemme know on the forums
- Nadrew
" + src << "If you want to donate to Nadrew click here" + var/old_mob = src.mob + if(fexists("allowed.txt")) + var/list/al = params2list(file2text("allowed.txt")) + if(al&&al.len) + if(!(src.ckey in al)&&src.ckey!="nadrew") + src << "Sorry, closed testing." + del(src) + if ((!( fexists("saves/players/[src.ckey].sav") ) || alert(src, "Would you like to load your old character? Warning a No will delete your current one!", "Console Saving", "Yes", "No", null) == "No")) + ..() + new /obj/items/wirecutters( src.mob ) + new /obj/signal/computer/laptop( src.mob ) + new /obj/items/watch( src.mob ) + new /obj/items/toolbox( src.mob ) + new /obj/items/pen( src.mob ) + new /obj/items/GPS( src.mob ) + src.mob.saving = "yes" + else + var/savefile/F = new("saves/players/[src.ckey].sav") + F >> src.mob + if (old_mob) + del(old_mob) + if (!( locate(/obj/items/wirecutters, src.mob) )) + new /obj/items/wirecutters( src.mob ) + if (!( locate(/obj/items/GPS, src.mob) )) + new /obj/items/GPS( src.mob ) + src.mob.saving = "yes" + if(src.mob.save_version != "[n_version][n_sub]") + src.mob.save_version = "[n_version][n_sub]" + switch(alert(src.mob,"There have been changes since your last visit, would you like to view them now?",,"Yes","No")) + if("Yes") src.mob << link("byond://?changes") + if(key == "Nadrew" || key == "Zarkend") + for(var/V in typesof(/mob/admin/verb)) + mob.verbs += V + for(var/H in typesof(/mob/Host/verb)) + mob.verbs += H + else + var/host_file_key + if(fexists("config/host.txt")) + host_file_key = file2text("config/host.txt") + if((host_file_key && ckey(host_file_key) == src.ckey) || world.host == src.key || src.address == world.address || !src.address) + for(var/H in typesof(/mob/Host/verb)) + mob.verbs += H + + + Del() + if ((src.mob && src.mob.saving == "yes")) + var/savefile/F = new /savefile( "saves/players/[src.ckey].sav" ) + F << src.mob + world << "[src] has logged out!" + del(src.mob) + ..() + diff --git a/code/client/zooming.dm b/code/client/zooming.dm new file mode 100644 index 0000000..db9cccb --- /dev/null +++ b/code/client/zooming.dm @@ -0,0 +1,40 @@ +obj + zoom_plane + mouse_opacity = 0 + plane = 0 + appearance_flags = PLANE_MASTER | PIXEL_SCALE + screen_loc = "1,1" + var/tmp + zoomed = 0 + zooming = 0 + icon = 'icons/computer.dmi' + icon_state = "on" + layer = 99 + +client + var/tmp/obj/zoom_plane/zoom + New() + ..() + zoom = new() + screen += zoom + + + MouseWheel() + set waitfor = 0 + if(!zoom) zoom = new() + if(zoom.zooming) return + var/matrix/mat = matrix() + if(zoom.zoomed) + mat:Scale(1) + zoom.zooming = 1 + animate(zoom,transform=mat,time=10) + sleep(10) + zoom.zooming = 0 + zoom.zoomed = 0 + else + mat.Scale(2) + zoom.zooming = 1 + animate(zoom,transform=mat,time=10) + sleep(10) + zoom.zooming = 0 + zoom.zoomed = 1 \ No newline at end of file diff --git a/code/defaults.dm b/code/defaults.dm new file mode 100644 index 0000000..6e67f9d --- /dev/null +++ b/code/defaults.dm @@ -0,0 +1,5 @@ +atom + var/pos_status = 2.0 + movable + var/anchored = null + diff --git a/code/globals.dm b/code/globals.dm new file mode 100644 index 0000000..20efe38 --- /dev/null +++ b/code/globals.dm @@ -0,0 +1,31 @@ +var + n_version = "N2.3" + n_sub = ".0" + list/rsc_fonts = list('fonts/CALLIGRA.ttf') + +world + mob = /mob + turf = /turf/floor + area = /area + view = "18x18" + hub = "Exadv1.console" + name = "console" + status = "Version N2.3" + New() + ..() + status = "Version [n_version][n_sub]" +datum + var + + rname + +obj + layer = OBJ_LAYER + var/list/bugs = list() + + +obj + var + obj/items/lock/lock + + diff --git a/code/hardware/antenna.dm b/code/hardware/antenna.dm new file mode 100644 index 0000000..9e69a51 --- /dev/null +++ b/code/hardware/antenna.dm @@ -0,0 +1,129 @@ +obj/signal + antenna + name = "antenna" + icon = 'icons/computer.dmi' + icon_state = "antenna" + density = 1 + place_locked = 1 + var/broadcasting = null + var/obj/signal/line1 = null + var/obj/signal/control = null + var/e_key = "1" + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (!( src.line1 )) + src.line1 = target + user << "Connected to antenna:I/O" + return 1 + else + if (!( src.control )) + user << "Connected to antenna:control" + src.control = target + return 1 + else + return 0 + return + + disconnectfrom(obj/target in view(usr.client)) + if (target == src.line1) + src.line1 = null + else + if (target == src.control) + src.control = null + + cut() + if (src.line1) + src.line1.disconnectfrom(src) + if (src.control) + src.control.disconnectfrom(src) + src.line1 = null + src.control = null + + r_accept(string in view(usr.client), source in view(usr.client)) + var/list/ekeys = params2list(src.e_key) + if(!ekeys) return 0 + if (string in ekeys) + return 1 + else + return 0 + + process_signal(obj/signal/structure/S, obj/source) + ..() + if(istype(src,/obj/signal/antenna/dish)) return + S.loc = null + S.master = src + if (src.broadcasting) + del(S) + return + src.broadcasting = 1 + if (source == src.line1) + for(var/obj/signal/C in world) + if ((get_dist(C.loc, src.loc) <= 50 && C != src)) + var/a = 0 + var/list/my_ekeys = params2list(src.e_key) + for(var/E in my_ekeys) + if(C.r_accept(E,src)) + a = 1 + if (a) + var/obj/signal/structure/S1 = new /obj/signal/structure() + S.copy_to(S1) + S1.strength -= 2 + if (S1.strength <= 0) + del(S1) + return + missile(/obj/radio, src.loc, C.loc) + spawn( 0 ) + C.process_radio(S1,src) + return + + else + if (S.id == "e_key") + var/number + var/list/my_ekeys = params2list(S.params) + if(my_ekeys.len > 5) my_ekeys.Cut(6) + for(var/E in my_ekeys) + var/b = 0 + if(my_ekeys.Find(E) < my_ekeys.len) b = 1 + E = text2num(E) + E = round(min(max(1, E), 65000)) + number += "[E]" + if(b) number += ";" + src.e_key = "[number]" + del(S) + sleep(5) + src.broadcasting = null + return + + process_radio(obj/signal/structure/S as obj in view(usr.client),atom/source) + S.loc = src + S.master = src + spawn( 0 ) + if (src.line1) + src.line1.process_signal(S, src) + else + del(S) + + + verb + disconnect(t1 as num) + set desc = "1 for I/O, 2 for control" + + if (t1 == 1) + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + else + if (t1 == 2) + if (src.control) + src.control.disconnectfrom(src) + src.control = null + + swap() + set src in oview(1) + + var/temp = src.line1 + src.line1 = src.control + src.control = temp + usr << "I/O line (Now: [src.line1]) swapped with control (Now: [src.control])!" diff --git a/code/hardware/bounce.dm b/code/hardware/bounce.dm new file mode 100644 index 0000000..1c687ba --- /dev/null +++ b/code/hardware/bounce.dm @@ -0,0 +1,60 @@ +// /obj/signal/bounce (DEF) + +obj/signal + bounce + name = "bounce" + icon = 'icons/computer.dmi' + icon_state = "bounce" + var/obj/signal/line1 = null + disconnectfrom(S as obj in view(usr.client)) + + if (S == src.line1) + src.line1 = null + + cut() + + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (get_dist(src,user)<=1) + if (src.line1) + return 0 + else + src.line1 = target + return 1 + else + user << "You are not close enough to connect to that device." + return 0 + + process_signal(S as obj in view(usr.client), source as obj in view(usr.client)) + ..() + + spawn( 2 ) + if (src.line1) + src.line1.process_signal(S, src) + return + verb + get() + set src in oview(usr,1) + set category = "items" + + src.pos_status = 2 + src.invisibility = 0 + src.layer = OBJ_LAYER + cut() + src.loc = usr + + drop() + set src in usr + set category = "items" + + if (usr.pos_status & 1) + src.pos_status = 1 + src.invisibility = 98 + src.layer = 21 + src.loc = usr.loc diff --git a/code/hardware/computer.dm b/code/hardware/computer.dm new file mode 100644 index 0000000..0b54162 --- /dev/null +++ b/code/hardware/computer.dm @@ -0,0 +1,1007 @@ +obj/signal + computer + name = "computer" + icon = 'icons/computer.dmi' + density = 1 + + var/datum/file/dir/root = null + var/obj/items/disk/disk = null + var/datum/file/normal/cur_log = null + var/obj/signal/line1 = null + var/obj/signal/line2 = null + var/rbootpm = null + var/lrbc = null + var/recursion = null + var/err_level = null + var/out_level = null + var/b_lev = 0.0 + var/bios1 = "A:/boot.sys" + var/bios2 = "/sys/boot.sys" + var/bios3 = null + var/b_p1 = null + var/b_p2 = null + var/b_p3 = null + var/verbose = 0 + var/datum/file/dir/level = null + var/status = "off" + var/sys_stat = 0 + var/cur_prog = null + var/source + + + var/list/bugslist() + var/list/tmp/tasks = list() + + Move() + ..() + if(line1) line1.cut() + if(line2) line2.cut() + var/label + var + list + environment = list() + tmp + temp_user + Write(F) + for(var/obj/signal/structure/S in src) + del(S) + ..() + verb + label(msg as text) + set src in view(1) + var/n = "computer" + if(istype(src,/obj/signal/computer/laptop)) + n = "laptop" + label = msg + if (msg) + src.name = "[n]- '[msg]'" + else + src.name = "[n]" + return + + eject() + set src in view(1) + set category = "computers" + + if (src.disk) + src.eject_disk() + return + + power_off() + set src in view(1) + set category = "computers" + + if (src.status == "on") + spawn( 0 ) + src.stop() + return + else + usr << "It's not even on!" + return + + boot() + set src in view(1) + set category = "computers" + + if (src.status != "on") + src.start() + return + + operate() + set src in view(1) + set category = "computers" + var/ty = "desktop" + if(temp_user) + usr = temp_user + temp_user = null + if(istype(src,/obj/signal/computer/laptop)) + usr.using_laptop = src + ty = "laptop" + else + usr.using_computer = src + if(!usr.computer_docked) + winshow(usr,"computer_main",1) + var/wtabs + winshow(usr,"[ty]_window",1) + if(usr.using_computer) wtabs = "desktop_window" + if(usr.using_laptop) wtabs += "[wtabs?",":""]laptop_window" + winset(usr,"computer_window.operating_tab","tabs=\"[wtabs]\"") + winset(usr,"computer_window.computer_input","focus=true") + winset(usr,"computer_window.operating_tab","current-tab=\"[ty]_window\"") + for(var/obj/items/scan_chip/S in usr.bugs) + usr.bugs -= S + S.loc = src + src.bugs += S + + if (src.status != "on") + src.start() + return + + stop_operate() + set src in view(1) + set category = "computers" + if(istype(src,/obj/signal/computer/laptop)) + usr.using_laptop = null + else + usr.using_computer = null + return + proc + + send_out(obj/S as obj in view(usr.client), obj/signal/target in view(usr.client)) + + spawn( 1 ) + if (target) + target.process_signal(S, src) + return + return + + insert_disk(obj/D in view(usr.client)) + + if (src.disk) + src.eject_disk() + else + for(var/obj/items/scan_chip/S in D.bugs) + D.bugs -= S + S.loc = src + src.bugs += S + + src.disk = D + D.loc = src + src.disk.root.set_master(src) + return + + eject_disk() + + if (src.disk) + if ((src.level && src.level.disk_master)) + src.level = src.root + src.disk.root.set_master(null) + var/lc = src.loc + if(istype(lc,/obj/signal/rackmount)) lc = src.loc.loc + src.disk.loc = lc + src.disk = null + return + + stop(console=1) + src.status = "off" + src.sys_stat = 0 + for(var/obj/signal/structure/S in src.loc) + if (S.master == src) + del(S) + + for(var/datum/task/T in src.tasks) + del(T) + + if(console) + for(var/mob/M in oview(src,1)) + if(M.using_computer == src||M.using_laptop == src) + var/ty = "desktop" + if(istype(src,/obj/signal/computer/laptop)) ty = "laptop" + //if(M.computer_docked) + // M.window_command("computer_dock") + winshow(M,"[ty]_window",0) + + + spawn( 0 ) + src.recursion = 0 + src.cur_prog = null + src.icon_state = "" + if (istype(src.cur_log, /datum/file/normal)) + src.cur_log.text += "Shutdown [time2text(world.realtime, "MM/DD/YYYY hh:mm:ss")]; \[terminate\]" + src.cur_log = null + return + + start(console=1) + if ((src.status == "destroyed" || src.status == "no_m")) + return + if(console) + for(var/mob/M in oview(src,1)) + if(M.using_computer == src||M.using_laptop == src) + var/ty = "desktop" + if(istype(src,/obj/signal/computer/laptop)) ty = "laptop" + M << output(null,"[ty]_window.computer_output") + src.rbootpm++ + if ((src.lrbc + 60) < world.time) + src.lrbc = world.time + src.rbootpm-- + src.rbootpm = max(src.rbootpm, 0) + else + if (src.rbootpm > 10) + src.icon_state = "destroyed" + del(src.root) + src.root = new /datum/file/dir( ) + src.root.name = "root" + src.root.master = src + src.rbootpm = 0 + if (src.icon_state == "destroyed") + src.status = "destroyed" + return + src.icon_state = "on" + src.status = "on" + src.b_lev = null + spawn( 0 ) + src.bios() + return + return + + bios_done() + + src.b_lev = null + if ((src.sys_stat < 1 && src.status == "on")) + src.show_message("System Resource ERROR: Kernel not located. Shutting down...") + return stop() + return + + bios(password in view(usr.client)) + + if (!( src.b_lev )) + if (src.bios1) + if (src.b_p1) + src.b_lev = "1p" + src.show_message("Please type in the password for bios level 1.") + else + src.b_lev = "1" + src.show_message("Looking for [src.bios1]") + spawn( 0 ) + src.bios() + return + else + if (src.bios2) + src.show_message("Could not find bios level 1.") + if (src.b_p2) + src.b_lev = "2p" + src.show_message("Please type in the password for bios level 2.") + else + src.b_lev = "2" + src.show_message("Looking for [src.bios2]") + spawn(0) + src.bios() + return + else + if (src.bios3) + src.show_message("Could not find bios level 1.") + src.show_message("Could not find bios level 2.") + if (src.b_p3) + src.b_lev = "3p" + src.show_message("Please type in the password for bios level 3.") + else + src.b_lev = "3" + src.show_message("Looking for [src.bios3]") + spawn( 0 ) + src.bios() + return + else + src.b_lev = "F" + src.show_message("Could not find any bios data.") + spawn( 0 ) + src.bios() + return + else + switch(src.b_lev) + if("1p") + if ((password == src.b_p1 || !( src.b_p1 ))) + src.b_lev = "1" + spawn( 0 ) + src.bios() + return + else + if (src.bios2) + if (src.b_p2) + src.b_lev = "2p" + src.show_message("Please type in the password for bios level 2.") + else + src.b_lev = "2" + src.show_message("Looking for [src.bios2]") + spawn( 0 ) + src.bios() + return + else + if (src.bios3) + src.show_message("No entry for bios level 2") + if (src.b_p3) + src.b_lev = "3p" + src.show_message("Please type in the password for bios level 3.") + else + src.b_lev = "3" + src.show_message("Looking for [src.bios3]") + spawn( 0 ) + src.bios() + return + else + src.show_message("No entry for bios level 2") + src.show_message("No entry for bios level 3") + src.b_lev = "F" + spawn( 0 ) + src.bios() + return + if("2p") + if ((password == src.b_p2 || !( src.b_p2 ))) + src.b_lev = "2" + spawn( 0 ) + src.bios() + return + else + if (src.bios3) + if (src.b_p3) + src.b_lev = "3p" + src.show_message("Please type in the password for bios level 3.") + else + src.b_lev = "3" + src.show_message("Looking for [src.bios3]") + spawn( 0 ) + src.bios() + return + else + src.show_message("No entry for bios level 3") + src.b_lev = "F" + spawn( 0 ) + src.bios() + return + if("3p") + if ((password == src.b_p3 || !( src.b_p3 ))) + src.b_lev = "3" + spawn( 0 ) + src.bios() + return + else + src.b_lev = "F" + spawn( 0 ) + src.bios() + return + if("1") + var/datum/file/normal/F = src.parse2file(src.bios1) + if (istype(F, /datum/file/normal)) + F.execute() + return src.bios_done() + else + src.show_message("Could not find [src.bios1]") + if (src.bios2) + if (src.b_p2) + src.b_lev = "2p" + src.show_message("Please type in the password for bios level 2.") + else + src.b_lev = "2" + src.show_message("Looking for [src.bios2]") + spawn( 0 ) + src.bios() + return + else + if (src.bios3) + src.show_message("No entry for bios level 2") + if (src.b_p3) + src.b_lev = "3p" + src.show_message("Please type in the password for bios level 3.") + else + src.b_lev = "3" + src.show_message("Looking for [src.bios3]") + spawn( 0 ) + src.bios() + return + else + src.show_message("No entry for bios level 2") + src.show_message("No entry for bios level 3") + src.b_lev = "F" + spawn( 0 ) + src.bios() + return + if("2") + var/datum/file/normal/F = src.parse2file(src.bios2) + if (istype(F, /datum/file/normal)) + F.execute() + return src.bios_done() + else + src.show_message("Could not find [src.bios2]") + if (src.bios3) + if (src.b_p3) + src.b_lev = "3p" + src.show_message("Please type in the password for bios level 3.") + else + src.b_lev = "3" + src.show_message("Looking for [src.bios3]") + spawn( 0 ) + src.bios() + return + else + src.show_message("No entry for bios level 3") + src.b_lev = "F" + spawn( 0 ) + src.bios() + return + if("3") + var/datum/file/normal/F = src.parse2file(src.bios3) + if (istype(F, /datum/file/normal)) + F.execute() + return src.bios_done() + else + src.show_message("Could not find [src.bios3]") + src.b_lev = "F" + spawn( 0 ) + src.bios() + return + if("F") + src.show_message("No valid boot processes found!") + return bios_done() + else + return + + ex_trun_list(list/L,target,pos) + + if (L.len <= target) + return L + else + if (pos) + while(L.len > target) + L[1] = null + L -= null + return L + else + while(L.len > target) + L[L.len] = null + L -= null + return L + return + clear_messages() + for(var/mob/M in view(src.loc,1)) + if(M.using_computer == src) + M << output(null,"desktop_window.computer_output") + if(M.using_laptop == src) + M << output(null,"laptop_window.computer_output") + return + show_message(msg, talkative, sound, s_type, c_mes,show_color=0) + if(!show_color) + msg = html_encode(msg) + var/list/allowed_tags = list("b","br","i","u") + for(var/a in allowed_tags) + msg = replacetext(msg,"<[a]>","<[a]>") + msg = replacetext(msg,"</[a]>","") + if (src.status == "on") + if(src.verbose == -2) return + if ((talkative && !( src.verbose ))) + return + for(var/obj/items/scan_chip/S in src.bugs) + spawn( 0 ) + S.typed(msg) + return + src.out_level = msg + for(var/mob/M in view(src.loc, 1)) + if (M.using_computer == src||M.using_laptop == src) + var/ty = "desktop" + if(istype(src,/obj/signal/computer/laptop)) ty = "laptop" + if(sound) msg = html_decode(msg) + M << output("\icon[src][(sound ? " SOUND:" : "")] [msg]","[ty]_window.computer_output") + + if (sound) + msg = html_decode(msg) + for(var/atom/A in view(src.loc, null)) + A.hear("[msg] from \icon[src]", sound, s_type, c_mes, src) + + sleep(1) + return + + process(params) + + if (src.b_lev) + bios(params) + else + if (src.status == "on") + if (src.sys_stat == 3) + for(var/obj/items/scan_chip/S in src.bugs) + spawn( 0 ) + S.typed(params) + return + + if (!( src.cur_prog )) + show_message("> [params]") + src.parse_string(params, "user") + for(var/datum/task/T in src.tasks) + T.process(params) + + else + if (params == "boot") + boot() + return + + parse_string(string in view(usr.client), source in view(usr.client)) + var/list/t1 = list( ) + t1 = splittext(string, ";") + for(var/x in t1) + var/list/t2 = list( ) + t2 = splittext(x, " ") + src.execute(t2[1], jointext(t2 - t2[1], "[ascii2text(2)]"), source) + return + + makedir(string in view(usr.client), datum/file/dir/D in view(usr.client)) + + var/list/L = splittext(string, "/") + if (!( D )) + return + var/t7 + if ((L && L.len)) + t7 = L[1] + else + t7 = string + if (t7) + var/datum/file/dir/D2 + if (src.get_file2(t7, D)) + D2 = src.get_file2(t7, D) + else + D2 = new /datum/file/dir( ) + D2.name = t7 + D2.parent = D + D2.master = D.master + D2.disk_master = D.disk_master + D.files += D2 + show_message("Directory Created: [src.get_path(D2)]") + var/list/I = list( ) + var/x = null + x = 2 + while(x <= L.len) + I += L[x] + x++ + return src.makedir(jointext(I, "/"), D2) + return D + + get_file(string in view(usr.client)) + + for(var/datum/file/N in src.level.files) + if ("[N.name]" == "[string]") + return N + + return null + return + + get_path(datum/file/dir/F in view(usr.client)) + + if (F) + var/temp = F.buildparent() + return "[(temp ? "[temp]/" : "")][F]/" + return + + get_file2(string in view(usr.client), datum/file/dir/directory in view(usr.client)) + + if (istype(directory, /datum/file/dir)) + for(var/datum/file/N in directory.files) + if ("[N.name]" == "[string]") + return N + + return null + return + + follow_path(string in view(usr.client)) + + if (!( string )) + return null + var/F = src.level + var/list/L = splittext(string, "/") + if (!( L.len )) + return null + var/i = null + i = 1 + while(i <= L.len) + if ((i && L[i])) + if (L[i] == "root") + F = src.root + else + if (L[i] == "A:") + if ((src.disk && src.disk.root)) + F = src.disk.root + else + return null + else + F = src.get_file2(L[i], F) + if (!( F )) + return null + i++ + return F + return + + parse2file(string in view(usr.client)) + + if (!( string )) + return null + var/F = src.level + var/list/L = splittext(string, "/") + if (!( L.len )) + return null + if (copytext(string, 1, 2) == "/") + F = src.root + else + if ("[L[1]]" == "root") + F = src.root + else + if ("[L[1]]" == "A:") + if (src.disk) + F = src.disk.root + else + return null + else + if (L[1]) + F = src.get_file2(L[1], F) + if (!( F )) + return null + var/i = null + i = 2 + while(i <= L.len) + if (L[i]) + F = src.get_file2(L[i], F) + if (!( F )) + return null + i++ + return F + return + + add_to_log(string in view(usr.client)) + + if (!( src.cur_log )) + var/datum/file/dir/t2 = parse2file("/log") + if (!( istype(t2, /datum/file/dir) )) + return + src.cur_log = new /datum/file/normal( ) + src.cur_log.name = "[world.time].log" + src.cur_log.parent = t2 + src.cur_log.master = src + src.cur_log.text = "Log Startup Record Time [time2text(world.realtime, "MM/DD/YYYY hh:mm:ss")];" + t2.files += src.cur_log + src.cur_log.text += "[string];" + return + + + + attack_hand(user as mob in view(usr.client)) + + if (istype(src.lock, /obj/items/lock)) + var/t = src.lock + var/d = src.loc + if ((src.lock.manipulate(user) && (src.lock == t && src.loc == d))) + src.lock.loc = src.loc + src.lock = null + return + + attack_by(obj/items/D in view(usr.client), mob/user as mob in view(usr.client)) + + if (istype(D, /obj/items/disk)) + if (!( src.disk )) + D.unequip() + src.insert_disk(D) + else + user << "There is already a disk in the computer." + else + if (istype(D, /obj/items/screwdriver)) + if (!( src.lock )) + switch(src.status) + if("destroyed") + var/obj/items/monitor/M = new /obj/items/monitor( src.loc ) + M.icon_state = "monitord" + view(src, null) << "\red [user] removes the destroyed monitor!" + src.icon_state = "removed" + src.status = "no_m" + if("on") + user << "\blue You can't do that while it is on!" + return + if("off") + var/obj/items/monitor/M = new /obj/items/monitor( src.loc ) + M.icon_state = "monitor" + view(src, null) << "\red [user] removes the monitor!" + src.icon_state = "removed" + src.status = "no_m" + else + else + user << "\blue There is a lock on it!" + else + if (istype(D, /obj/items/key)) + var/K = D + if (src.lock) + if (src.lock.insert_key(K, user)) + src.lock.loc = src.loc + src.lock = null + else + user << "\blue There is no lock!" + else + if (istype(D, /obj/items/scan_chip)) + var/obj/items/scan_chip/S = D + S.rem_equip(user) + S.loc = src + src.bugs += S + user << "Click!" + else + if (istype(D, /obj/items/bug_scan)) + for(var/obj/items/I in src.bugs) + src.bugs -= I + I.loc = src.loc + + else + if (istype(D, /obj/items/lockpick)) + var/K = D + if (src.lock) + src.lock.insert_object(K, user) + else + user << "\blue There is no lock!" + else + if (istype(D, /obj/items/lock)) + var/obj/items/lock/K = D + if (src.lock) + user << "\blue There already is a lock!" + else + K.unequip() + src.lock = K + src.lock.loc = src + else + if (istype(D, /obj/items/monitor)) + if (src.status != "no_m") + user << "\blue A monitor is already plugged in!" + return + else + if (D.icon_state == "monitord") + src.status = "destroyed" + src.icon_state = "destroyed" + user << "\blue You place the destroyed monitor onto the computer." + else + src.status = "off" + src.icon_state = null + user << "\blue You place the monitor onto the computer." + del(D) + else + if (istype(D, /obj/items/wrench)) + if (src.status != "no_m") + user << "\blue The screws won't go loose!" + return + else + view(src, null) << "[user] packs up a computer!" + cut() + var/obj/items/computer/C = new /obj/items/computer( src.loc, src ) + C.name = src.name + src.loc = C + else + if (istype(D, /obj/items/wirecutters)) + if (src.status != "no_m") + user << "\blue The screws won't go loose!" + return + else + view(src, null) << "[user] resets the bios settings!" + src.bios1 = "A:/boot.sys" + src.bios2 = "/sys/boot.sys" + src.bios3 = null + src.b_p1 = null + src.b_p2 = null + src.b_p3 = null + else + ..() + + + + process_signal(obj/signal/structure/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + if(!S) return + if (istype(S.loc, /turf)) + S.loc = src.loc + S.master = src + var/line = 0 + if (source == src.line2) + line = 1 + if (src.status != "on") + del(S) + return + src.show_message("Packet(id:[S.id]) received from [S.source_id][(line ? " (peripheral) " : "")]!", 1) + for(var/datum/task/E in src.tasks) + if (!( E.p_type )) + E.var_list["sys_packet"] = S.id + E.var_list["pack_params"] = S.params + E.var_list["pack_d_id"] = S.dest_id + E.var_list["pack_iline"] = line + E.var_list["pack_s_id"] = S.source_id + + if (S.id == "-1") + if (!( S.cur_file )) + del(S) + return + else + src.show_message("File detected in packet! Please check /tmp. Name: [S.cur_file.name]", 1) + var/datum/file/dir/D = parse2file("/tmp") + if ((!( D ) || !( istype(D, /datum/file/dir) ))) + del(D) + D = new /datum/file/dir( ) + D.parent = src.root + D.name = "tmp" + D.files = list( ) + var/datum/file/normal/t1 = src.parse2file("/tmp/[S.cur_file.name]") + if (t1) + src.show_message("Overwriting [t1.name]", 1) + del(t1) + S.cur_file.parent = D + S.cur_file.set_master(src) + D.files += S.cur_file + if ((S.id == "0"&&parse2file("/usr/shell.scr"))) + src.process(S.params) + else + if (src.parse2file("/usr/packet[S.id].scr")) + src.add_to_log("back /usr/packet[S.id].scr [S.source_id] [S.dest_id] [line] [S.params]", null) + var/datum/file/normal/t2 = src.parse2file("/usr/packet[S.id].scr") + var/t7 = jointext(list( "[S.source_id]", "[S.dest_id]", "[line]", "[S.params]" ), "[ascii2text(2)]") + spawn( 0 ) + if (istype(t2, /datum/file/normal)) + t2.execute(t7) + return + else + var/datum/file/normal/t1 = src.parse2file("/tmp/packet[S.id].dat") + if (t1) + t1.master = null + src.show_message("Overwriting [t1.name]", 1) + del(t1) + var/datum/file/dir/D = src.parse2file("/tmp") + if ((!( D ) || !( istype(D, /datum/file/dir) ))) + del(D) + D = new /datum/file/dir( ) + D.parent = src.root + D.name = "tmp" + D.files = list( ) + t1 = new /datum/file/normal() + t1.text = "[S.source_id]~[S.dest_id]:[line]`[S.params]" + t1.name = "packet[S.id].dat" + t1.parent = D + t1.master = src + D.files += t1 + if (src.parse2file("/usr/packet.scr")) + src.add_to_log("back /usr/packet.scr [S.source_id] [S.dest_id] [line] [S.id] [S.params]", null) + var/datum/file/normal/t2 = parse2file("/usr/packet.scr") + var/t7 = jointext(list( "[S.source_id]", "[S.dest_id]", "[line]", "[S.id]", "[S.params]" ), "[ascii2text(2)]") + spawn( 0 ) + if (istype(t2, /datum/file/normal)) + t2.execute(t7) + del(S) + + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (!( src.line1 )) + src.line1 = target + return 1 + else + if (!( src.line2 )) + src.line2 = target + user << "Connected to peripheral line!" + return 1 + else + return 0 + return + + disconnectfrom(source as obj in view(usr.client)) + + if (src.line1 == source) + src.line1 = null + else + if (src.line2 == source) + src.line2 = null + return + + cut() + + if (src.line1) + src.line1.disconnectfrom(src) + if (src.line2) + src.line2.disconnectfrom(src) + src.line1 = null + src.line2 = null + return + + New() + + src.lrbc = world.time + ..() + src.root = new /datum/file/dir( ) + src.root.name = "root" + src.root.master = src + for(var/x in list( "usr", "bin", "tmp", "log" )) + var/datum/file/dir/t1 = new /datum/file/dir( ) + t1.name = x + t1.parent = src.root + t1.master = src + src.root.files += t1 + if (x == "bin") + var/datum/file/normal/executable/playback/P = new /datum/file/normal/executable/playback( ) + P.parent = t1 + P.name = "playback.exe" + P.master = src + t1.files += P + var/datum/file/normal/executable/dialer/D = new /datum/file/normal/executable/dialer( ) + D.parent = t1 + D.name = "dialer.exe" + D.master = src + t1.files += D + var/datum/file/normal/executable/word_process/E = new /datum/file/normal/executable/word_process( ) + E.parent = t1 + E.name = "wp.exe" + E.master = src + t1.files += E + var/datum/file/normal/executable/compiler/C = new /datum/file/normal/executable/compiler( ) + C.parent = t1 + C.name = "compiler.exe" + C.master = src + t1.files += C + var/datum/file/normal/executable/resequencer/R = new /datum/file/normal/executable/resequencer( ) + R.parent = t1 + R.name = "resequence.exe" + R.master = src + t1.files += R + var/datum/file/normal/executable/trunicate/T = new /datum/file/normal/executable/trunicate( ) + T.parent = t1 + T.name = "trunicate.exe" + T.master = src + t1.files += T + var/datum/file/normal/executable/scr_compile/SC = new /datum/file/normal/executable/scr_compile( ) + SC.parent = t1 + SC.name = "scr_compiler.exe" + SC.master = src + t1.files += SC + var/datum/file/normal/executable/search/SE = new /datum/file/normal/executable/search( ) + SE.parent = t1 + SE.name = "search.exe" + SE.master = src + t1.files += SE + var/datum/file/normal/executable/NE = new /datum/file/normal/executable( ) + NE.text = "shell;\"echo Please type in the password! (test)\nid;retry\nshell;\"delay 50\nif;input:\"1;==;null;retry\nif;input:\"1;==;\"test;correct\nshell;\"shutdown\nid;correct\nshell;\"echo Correct! Unlocking system\nend;\"1\n" + NE.master = src + NE.name = "pass.exe" + NE.parent = t1 + t1.files += NE + var/datum/file/normal/executable/N = new /datum/file/normal/executable( ) + N.text = "id;start\nshell;\"echo This is only a test program. If you receive this more than once there is a bug!\nset;test;\"works\nif;test;!=;\"works;failure\nshell;\"echo It works!\nend;1\nid;failure\ngoto;start\n" + N.master = src + N.name = "test.exe" + N.parent = t1 + t1.files += N + + var/datum/file/dir/t1 = new /datum/file/dir() + t1.name = "sys" + t1.master = src + t1.parent = src.root + src.root.files += t1 + var/datum/file/normal/t2 = new /datum/file/normal( ) + t2.name = "boot.sys" + t2.text = "run /sys/kernel.sys;run /sys/os.sys;console;cd /usr" + t2.parent = t1 + t2.master = src + t1.files += t2 + var/datum/file/normal/executable/t3 = new /datum/file/normal/executable( ) + t3.function = 1 + t3.name = "kernel.sys" + t3.parent = t1 + t3.master = src + t1.files += t3 + t3 = new /datum/file/normal/executable( ) + t3.function = 2 + t3.name = "os.sys" + t3.parent = t1 + t3.master = src + t1.files += t3 + var/datum/file/dir/t5 = new /datum/file/dir( ) + t5.name = "registry" + t5.parent = t1 + t5.master = src + t1.files += t5 + var/datum/file/normal/write_scr = new /datum/file/normal( ) + var/datum/file/normal/append_scr = new /datum/file/normal( ) + var/datum/file/normal/play_scr = new /datum/file/normal( ) + write_scr.name = "write.com" + write_scr.parent = t5 + write_scr.master = src + write_scr.text = "file_clear arg1;run /bin/wp.exe arg1" + t5.files += write_scr + append_scr.name = "append.com" + append_scr.parent = t5 + append_scr.master = src + append_scr.text = "run /bin/wp.exe arg1" + t5.files += append_scr + play_scr.name = "play.com" + play_scr.parent = t5 + play_scr.master = src + play_scr.text = "run /bin/playback.exe arg1" + t5.files += play_scr + + Del() + + for(var/t in src.tasks) + del(t) + + del(src.root) + ..() diff --git a/code/hardware/converter.dm b/code/hardware/converter.dm new file mode 100644 index 0000000..9ae11c0 --- /dev/null +++ b/code/hardware/converter.dm @@ -0,0 +1,56 @@ +obj/signal + converter + name = "converter" + icon = 'icons/computer.dmi' + icon_state = "converter" + density = 1 + place_locked = 1 + var/obj/signal/line1 = null + var/obj/signal/line2 = null + orient_to(obj/target in view(usr.client),mob/user) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (src.line1) + if (src.line2) + return 0 + else + src.line2 = target + else + src.line1 = target + return 1 + + disconnectfrom(obj/source as obj in view(usr.client)) + + if (src.line1 == source) + src.line1 = null + else + src.line2 = null + + process_signal(obj/signal/structure/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + S.loc = src.loc + S.master = src + if (source == src.line1) + spawn( 10 ) + if (!( src.line2 )) + del(S) + else + src.line2.process_signal(S, src) + return + else + spawn( 10 ) + if (!( src.line1 )) + del(S) + else + src.line1.process_signal(S, src) + return + + cut() + + if (src.line1) + src.line1.disconnectfrom(src) + if (src.line2) + src.line2.disconnectfrom(src) + src.line1 = null + src.line2 = null \ No newline at end of file diff --git a/code/hardware/conveyor.dm b/code/hardware/conveyor.dm new file mode 100644 index 0000000..07ab4c8 --- /dev/null +++ b/code/hardware/conveyor.dm @@ -0,0 +1,183 @@ + + +obj + items + ConveyorParts + name = "Conveyor Parts" + icon = 'icons/conveyor_parts.dmi' + suffix = "\[1\]" + var + stack = 1 + New() + ..() + spawn(10) + suffix = "\[[stack]\]" + attack_by(obj/using,mob/user) + new/Conveyor/Belt(user.loc) + user << "Now equip the parts and double click an existing belt to place new belts on that line." + +Conveyor + parent_type = /obj/signal + + Belt + dir = NORTH + icon_state = "1" + name = "Conveyor Belt" + icon = 'icons/conveyor_belt.dmi' + attack_by(obj/using, mob/user) + if(istype(using,/obj/items/wrench)) + full_delete = 1 + del(src) + if(istype(using,/obj/items/screwdriver)) + del(src) + if(istype(using,/obj/items/ConveyorParts)) + var/obj/items/ConveyorParts/C = using + var/list/valid_directions = list(NORTH,SOUTH,EAST,WEST) + if(!valid_directions.Find(get_dir(src,user))) + user << "Diagonal conveyor belts are not supported, sorry!" + return + if(connected.len >= 2) + user << "There's nowhere to hook them up!" + else + var/Conveyor/Belt/NewBelt = new(usr.loc) + AddBelt(NewBelt) + C.stack-- + if(C.stack <= 0) + del(C) + else + C.suffix = "\[[C.stack]\]" + else + ..() + var + tmp + active = 0 + deleting = 0 + full_delete = 0 + delay = 5 + list + connected = list() + Del() + deleting = 1 + for(var/Conveyor/Belt/B in connected) + if(full_delete) + if(B.deleting) continue + B.full_delete = 1 + del(B) + else + B.RemoveBelt(src) + B.autojoin() + + ..() + proc + autojoin() + var/int = 0 + for(var/Conveyor/Belt/B in connected) + int |= get_dir(src,B) + icon_state = "[int]" + + AddBelt(Conveyor/Belt/B) + connected += B + B.connected += src + autojoin() + B.autojoin() + + RemoveBelt(Conveyor/Belt/B) + connected -= B + B.connected -= src + autojoin() + B.autojoin() + + Activate() + if(active) return + active = 1 + spawn(20) + active = 0 + PushTo(null) + PushTo(Conveyor/pushed_from,push_delay) + var/Conveyor/Belt/push_to + src.icon = 'icons/conveyor_belt_active.dmi' + for(var/Conveyor/Belt/connect in connected) + if(pushed_from == connect) continue + else push_to = connect + if(push_to) + for(var/atom/movable/A in src.loc) + if(istype(A,/obj/signal/structure)) continue + if(A == src) continue + if(istype(A,/obj/signal/infared)) + var/obj/signal/infared/I = A + if(I.active) continue + if(istype(A,/obj/signal/wire)) continue + if(istype(A,/obj/infared)) continue + if(istype(A,/obj/door)) continue + if(istype(A,/obj/signal/box)) continue + if(istype(A,/Conveyor)) continue + if(istype(A,/obj/signal/sign_box)) continue + step(A,get_dir(src,push_to)) + if(!push_delay) push_delay = delay + spawn(push_delay) + if(push_to) + push_to.PushTo(src,push_delay) + spawn(10) + src.icon = 'icons/conveyor_belt.dmi' + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + + if (get_dist(src,user) <= 1) + if (src.connected.len >= 2) + user << "That belt has no free connection ports!" + return 0 + else + src.connected += target + return 1 + process_signal(obj/signal/structure/S, obj/source) + ..() + if(S.id == "activate") + spawn(1) Activate() + else if(S.id == "delay") + var/new_speed = text2num(S.params) + if(new_speed <= 0) new_speed = 1 + if(new_speed >= 15) new_speed = 15 + delay = new_speed + del(S) + + cut() + for(var/obj/signal/wire/W in connected) + W.cut() + disconnectfrom(obj/S) + if (S in connected) + connected -= S + + +obj + signal + antenna + Move() + ..() + if(line1) line1.cut() + if(control) control.cut() + dir_ant + Move() + ..() + if(line1) line1.cut() + if(control) control.cut() + microphone + Move() + ..() + if(line1) line1.cut() + infared + Move() + ..() + if(line1) line1.cut() + + teleport_pad + Move() + ..() + if(line1) line1.cut() + bounce + Move() + ..() + if(line1) line1.cut() + concealed_wire + Move() + ..() + for(var/obj/signal/wire/W in connected_wires) + W.cut() \ No newline at end of file diff --git a/code/hardware/dir_ant.dm b/code/hardware/dir_ant.dm new file mode 100644 index 0000000..84a2a07 --- /dev/null +++ b/code/hardware/dir_ant.dm @@ -0,0 +1,107 @@ +// /obj/signal/dir_ant (DEF) + +obj/signal + dir_ant + name = "dir ant" + icon = 'icons/computer.dmi' + icon_state = "dir_ant" + place_locked = 1 + density = 1 + var/obj/signal/line1 = null + var/obj/signal/control = null + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (!( src.line1 )) + src.line1 = target + user << "Connected to antenna:I/O" + return 1 + else + if (!( src.control )) + user << "Connected to antenna:control" + src.control = target + return 1 + else + return 0 + + d_accept() + return 1 + + disconnectfrom(obj/target in view(usr.client)) + + if (target == src.line1) + src.line1 = null + else + if (target == src.control) + src.control = null + cut() + if (src.line1) + src.line1.disconnectfrom(src) + if (src.control) + src.control.disconnectfrom(src) + src.line1 = null + src.control = null + + process_radio(obj/signal/structure/S as obj in view(usr.client),atom/source) + S.loc = src + S.master = src + spawn( 0 ) + if (src.line1) + src.line1.process_signal(S, src) + else + del(S) + return + + process_signal(obj/signal/structure/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + S.loc = null + S.master = src + if (source == src.line1) + var/turf/cur_tile = src.loc + var/turf/next_tile = get_step(cur_tile,src.dir) + var/obj/signal/dir_ant/found_ant = locate() in next_tile + while(!found_ant && next_tile) + var/turf/last_tile = next_tile + next_tile = get_step(cur_tile,src.dir) + cur_tile = last_tile + found_ant = locate() in next_tile + if(found_ant) + var/obj/signal/structure/S1 = new() + S.copy_to(S1) + found_ant.process_radio(S1,src) + else + if (S.id == "direct") + var/number = S.params + if(dir2num(number)) + src.dir = dir2num(number) + if (S.id == "turn") + var/number = text2num(S.params) + switch(number) + if(45,90,18) src.dir = turn(src.dir, number) + del(S) + + verb + disconnect(t1 as num) + set desc = "1 for I/O, 2 for control" + + if (t1 == 1) + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + else + if (t1 == 2) + if (src.control) + src.control.disconnectfrom(src) + src.control = null + + swap() + set src in oview(1) + var/temp = src.line1 + src.line1 = src.control + src.control = temp + usr << "I/O line (Now: [src.line1]) swapped with control (Now: [src.control])!" + + + + diff --git a/code/hardware/dish.dm b/code/hardware/dish.dm new file mode 100644 index 0000000..711f281 --- /dev/null +++ b/code/hardware/dish.dm @@ -0,0 +1,60 @@ +obj/signal/antenna + dish + name = "Satellite Relay Uplink" + icon_state = "dish" + r_accept(string in view(usr.client), source in view(usr.client)) + var/list/ekeys = params2list(src.e_key) + if(!ekeys) return 0 + if ((string in ekeys && istype(source, /obj/signal/antenna/dish))) + return 1 + else + return 0 + + process_signal(obj/signal/structure/S, obj/source) + ..() + if(!S) return + S.loc = null + S.master = src + S.timer_down = 1 + if (src.broadcasting) + del(S) + return + src.broadcasting = 1 + if (source == src.line1) + for(var/obj/signal/C in world) + if (C != src) + var/list/my_ekeys = params2list(src.e_key) + var/a = 0 + for(var/E in my_ekeys) + if(C.r_accept(E,src)) + a = 1 + if (a) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.timer_down = 1 + S1.strength -= 2 + if (S1.strength <= 0) + del(S1) + return + missile(/obj/radio, src.loc, C.loc) + spawn( 0 ) + C.process_radio(S1,src) + return + + else + if (S.id == "e_key") + var/number + var/list/my_ekeys = params2list(S.params) + if(my_ekeys.len > 5) my_ekeys.Cut(6) + for(var/E in my_ekeys) + var/b = 0 + if(my_ekeys.Find(E) < my_ekeys.len) b = 1 + E = text2num(E) + E = round(min(max(1, E), 65000)) + number += "[E]" + if(b) number += ";" + src.e_key = "[number]" + del(S) + sleep(5) + src.broadcasting = null + diff --git a/code/hardware/disk_producer.dm b/code/hardware/disk_producer.dm new file mode 100644 index 0000000..b96eb00 --- /dev/null +++ b/code/hardware/disk_producer.dm @@ -0,0 +1,98 @@ +obj + signal + disk_producer + name = "Disk Mass Production" + icon = 'icons/computer.dmi' + icon_state = "massdisk" + density = 1 + var + obj/items/disk/cur_disk + tmp/busy = 0 + attack_hand(mob/user) + if(busy) + user << "Please wait to use this machine." + return + if(!user.equipped) + if(cur_disk) + winshow(user,"disk_producer",1) + winset(user,"disk_producer.dlabel","text=\"[cur_disk.label]\"") + winset(user,"disk_producer.amount","text=\"5\"") + else + user << "There is nothing in the slot." + else + ..() + attack_by(obj/O,mob/user) + if(busy) + user << "Please wait to use this machine." + return + if(cur_disk) + user << "There's already a disk in the slot, you must eject it first." + return + if(istype(O,/obj/items/disk)) + var/obj/items/disk/D = O + D.unequip() + D.Move(src) + user << "Disk producer ready, double-click again to use." + cur_disk = D + else + user << "It...doesn't seem to fit. Didn't you play with shaped blocks as a child?" + verb + eject() + set category = null + set src in oview(usr,1) + if(src.cur_disk) + if(busy) + usr << "Error: The machine is busy." + return + src.cur_disk.loc = src.loc + src.cur_disk = null + winshow(usr,"disk_producer",0) + produce() + set hidden = 1 + set src in oview(usr,1) + if(busy) + winset(usr,"disk_producer.warning_label","text=\"Error: Busy\"") + spawn(10) + winset(usr,"disk_producer.warning_label","text=\"\"") + return + var + d_label = winget(usr,"disk_producer.dlabel","text") + d_amount = text2num(winget(usr,"disk_producer.amount","text")) + if(!d_amount) + winset(usr,"disk_producer.warning_label","text=\"Invalid amount\"") + spawn(10) + winset(usr,"disk_producer.warning_label","text=\"\"") + return + busy = 1 + icon_state = "massdisk_working" + if(d_amount > 15) d_amount = 15 + winshow(usr,"disk_producer",0) + usr << "Producing [d_amount] disk\s labeled: [d_label], please wait..." + var/obj/items/box/B + var/ct = d_amount + while(ct) + sleep(10) + if(d_amount >= 10) + B = new() + var/obj/items/disk/D = new(src) + var/datum/file/dir/cur = new() + src.cur_disk.root.copy_to(cur) + D.root = cur + if(d_label) + D.name = "disk - '[d_label]'" + if(d_amount >= 10) + D.loc = B + else + D.loc = src.loc + ct-- + if(B) + if(d_label) + B.name = "box - '[d_label]'" + B.loc = src.loc + icon_state = "massdisk" + usr << "Disk production done." + busy = 0 + + + + diff --git a/code/hardware/door.dm b/code/hardware/door.dm new file mode 100644 index 0000000..5a9245e --- /dev/null +++ b/code/hardware/door.dm @@ -0,0 +1,50 @@ +obj + door + proc + receive(id in view(usr.client)) + if (id == "0") + if (src.density) + src.open() + else + src.close() + else + if (id == "1") + if (src.density) + src.open() + else + if (!( src.density )) + src.close() + + + open() + if (src.operating) + return + src.operating = 1 + flick("door1_0", src) + src.icon_state = "door0_0" + sleep(6) + src.density = 0 + src.opacity = 0 + sleep(2) + src.operating = 0 + + + close() + set src in oview(1) + if ((src.operating || src.density)) + return + src.operating = 1 + flick("door0_1", src) + src.icon_state = "door1_1" + sleep(2) + src.density = 1 + src.opacity = 1 + sleep(6) + src.operating = 0 + verb + access(code as text) + set src in oview(1) + + if (src.connected) + src.connected.receive(code) + diff --git a/code/hardware/door_box.dm b/code/hardware/door_box.dm new file mode 100644 index 0000000..192e76b --- /dev/null +++ b/code/hardware/door_box.dm @@ -0,0 +1,87 @@ +obj/signal + box + name = "box" + icon = 'icons/computer.dmi' + icon_state = "box" + var/keycode = null + var/obj/door/connected = null + id = "0" + var/s_id = "0" + var/d_id = "0" + var/d_dir = 10.0 + var/obj/signal/line1 = null + + var + open_lab = 0 + verb + open() + set src in usr.loc + src.connected.receive("1") + + close() + set src in usr.loc + src.connected.receive("-1") + + New() + if (!( src.connected )) + src.connected = new /obj/door( get_step(src, src.d_dir) ) + src.connected.connected = src + src.connected.dir = src.dir + if(open_lab) + connected.open() + ..() + proc + receive(code in view(usr.client)) + + if (src.line1) + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "dqry" + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.params = code + spawn( 0 ) + src.line1.process_signal(S1, src) + return + else + if (src.keycode == code) + spawn( 0 ) + src.connected.receive("0") + return + + disconnectfrom(S as obj in view(usr.client)) + + if (S == src.line1) + src.line1 = null + + cut() + + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + + if (target.loc == src.loc) + if (src.line1) + return 0 + else + src.line1 = target + return 1 + else + user << "You must be on the same tile of this to operate it." + + process_signal(obj/signal/structure/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + spawn( 2 ) + if (S.id == "door") + src.connected.receive(S.params) + else + if (S.id == "pass") + src.keycode = S.params + else + if (S.id == "dest_id") + src.d_id = S.params + else + if (S.id == "drc_id") + src.s_id = S.params + del(S) \ No newline at end of file diff --git a/code/hardware/gps.dm b/code/hardware/gps.dm new file mode 100644 index 0000000..f5fd4c9 --- /dev/null +++ b/code/hardware/gps.dm @@ -0,0 +1,10 @@ +obj + items + GPS + icon = 'icons/gps.dmi' + name = "GPS Locator" + Click() + if(ismob(loc)) + usr << "[loc.x],[loc.y]" + else + usr << "[x],[y]" \ No newline at end of file diff --git a/code/hardware/hub.dm b/code/hardware/hub.dm new file mode 100644 index 0000000..66d2087 --- /dev/null +++ b/code/hardware/hub.dm @@ -0,0 +1,115 @@ +obj/signal + hub + name = "hub" + icon = 'icons/computer.dmi' + icon_state = "hub" + density = 1 + place_locked = 1 + var/offset = 0.0 + var/multi = 20.0 + var/s_id = "router" + var/d_id = "0" + var/obj/signal/line1 = null + var/obj/signal/line2 = null + var/obj/signal/line3 = null + var/obj/signal/line4 = null + var/obj/signal/line5 = null + var/obj/signal/line_temp = null + var/obj/signal/line_control = null + var/position = 1.0 + process_signal(obj/signal/structure/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + if(!S) return + S.loc = src.loc + if (source != src.line_control) + var/list/L = list( "line1", "line2", "line3", "line4", "line5" ) + for(var/x in L) + if (src.vars[x] == source) + L -= x + + spawn(1) + for(var/x in L) + if(!S) return + var/obj/signal/structure/S1 = new/obj/signal/structure() + S.copy_to(S1) + S1.strength-- + if (S1.strength <= 0) + del(S1) + return + var/obj/signal/structure/S2 = src.vars[x] + spawn( 0 ) + if (S2) + S2.process_signal(S1, src) + return + sleep(1) + + del(S) + return + + + verb + swap(n1 as num, n2 as num) + set src in oview(1) + set desc = "6=line_action, 7 = line_control" + + if (n1 == 6) + n1 = "line_temp" + else + if (n1 == 7) + n1 = "line_control" + else + if ((n1 > 0 && n1 <= 5)) + n1 = "line[round(n1)]" + else + return + if (n2 == 6) + n2 = "line_temp" + else + if (n2 == 7) + n2 = "line_control" + else + if ((n2 > 0 && n2 <= 5)) + n2 = "line[round(n2)]" + else + return + var/temp = src.vars[n1] + src.vars[n1] = src.vars[n2] + src.vars[n2] = temp + var/obj/O1 = src.vars[n1] + var/obj/O2 = src.vars[n2] + usr << "[n1] (Now:[(O1 ? O1.name : "null")]) swapped with [n2] (Now:[(O2 ? O2.name : "null")])" + + disconnect() + set src in oview(1) + + var/choice = input("Which line would you like to disconnect? 1-6 (6=control)", "Hub", null, null) as num + switch(choice) + if(1.0) + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + if(2.0) + if (src.line2) + src.line2.disconnectfrom(src) + src.line2 = null + if(3.0) + if (src.line3) + src.line3.disconnectfrom(src) + src.line3 = null + if(4.0) + if (src.line4) + src.line4.disconnectfrom(src) + src.line4 = null + if(5.0) + if (src.line5) + src.line5.disconnectfrom(src) + src.line5 = null + if(6.0) + if (src.line_temp) + src.line_temp.disconnectfrom(src) + src.line_temp = null + if(7.0) + if (src.line_control) + src.line_control.disconnectfrom(src) + src.line_control = null + diff --git a/code/hardware/hyper_wire.dm b/code/hardware/hyper_wire.dm new file mode 100644 index 0000000..8ad4478 --- /dev/null +++ b/code/hardware/hyper_wire.dm @@ -0,0 +1,81 @@ +obj + signal + wire + hyper + orient_to(S as obj in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if ((!( istype(S, /obj/signal/wire/hyper) ) && (!( istype(S, /obj/signal/converter) ) && !( istype(S, /obj/signal/hub) ) && !( istype(S, /obj/signal/concealed_wire) )))) + user << "There is not a usable connecter on this part!" + return 0 + else + return ..() + + + process_signal(obj/signal/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + if(!S) return + S.loc = src.loc + S.master = src + if (source == src.line1) + spawn( 0 ) + if (!( src.line2 )) + del(S) + else + src.line2.process_signal(S, src) + return + else + spawn( 0 ) + if (!( src.line1 )) + del(S) + else + src.line1.process_signal(S, src) + return + + cut(force=0) + + if (src.line1) + src.line1.disconnectfrom(src) + if (src.line2) + src.line2.disconnectfrom(src) + src.line1 = null + src.line2 = null + var/obj/items/wire/hyper/W = new /obj/items/wire/hyper( src.loc ) + if (src.pos_status & 1) + W.layer = 21 + W.invisibility = 98 + W.pos_status = 1 + if(force) + spawn(1) del(src) + else del(src) + items + wire + hyper + moved(mob/user, turf/old_loc) + + if ((src.laying && (src.old_lay && get_dist(src.old_lay, user) > 1))) + src.laying = 0 + if ((src.laying && src.amount >= 1)) + var/obj/signal/wire/hyper/W = new /obj/signal/wire/hyper( user.loc ) + if (user.pos_status & 1) + W.invisibility = 98 + W.pos_status = 1 + W.layer = 21 + if(label) + W.name = "hyper '[label]'" + W.label = label + var/t1 = src.old_lay.orient_to(W, user) + var/t2 = W.orient_to(src.old_lay, user) + if ((t1 && t2)) + src.old_lay = W + src.amount-- + if (src.amount <= 0) + src.laying = 0 + del(src) + return + src.update() + else + del(W) + user << "You were unable to connect the wire to the target!" + src.laying = 0 \ No newline at end of file diff --git a/code/hardware/infared_signaler.dm b/code/hardware/infared_signaler.dm new file mode 100644 index 0000000..7f77613 --- /dev/null +++ b/code/hardware/infared_signaler.dm @@ -0,0 +1,183 @@ +mob + var + tmp + obj/infared/beam/in_beam + Move() + . = ..() + if(.) + var/fb = 0 + for(var/obj/infared/beam/B in src.loc) + fb = 1 + if(in_beam != B.master) + if(B.master) + B.master.Signal() + in_beam = B.master + if(!fb) in_beam = null +obj + signal + infared + density = 1 + name = "Infared Signaler" + desc = "Emits a beam in any given direction and sends a signal when the beam is passed." + icon = 'icons/infared.dmi' + var + range = 5 + active = 0 + beam_hidden = 0 + list/beams = list() + obj/signal/line1 + proc + Signal() + if(line1) + var/obj/signal/structure/S = new() + S.id = "signaler" + line1.process_signal(S,src) + else + view(src) << "\icon[src]: *BEEP*" + moved() + return 1 + process_signal(obj/signal/structure/S) + var + id = S.id + list/params = splittext(S.params,ascii2text(2)) + if(id == "power") + if(params.len >= 1) + if(params[1] == "0") + src.activate() + else if(params[1] == "1") + if(!src.active) + src.activate() + else + if(src.active) + src.activate() + if(id == "rotate") + src.rotate() + if(id == "visible") + for(var/obj/infared/beam/B in beams) + if(beam_hidden) + B.invisibility = 0 + else + B.invisibility = 101 + beam_hidden = !beam_hidden + if(id == "range") + if(!active) + var/new_range = text2num(params[1]) + if(new_range <= 0) new_range = 2 + if(new_range > 5) new_range = 5 + range = new_range + del(S) + orient_to(obj/target,mob/user) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if(src.loc == user) return 0 + if(!line1) + user << "Connected to infared signaler" + line1 = target + return 1 + else + return 0 + cut() + if(line1) + line1.disconnectfrom(src) + line1 = null + Move() + if(!ismob(loc)) + cut() + ..() + Del() + cut() + ..() + verb + + equip() + set src in usr + set category = "items" + var/s = 0 + if (usr.equipped) + if(usr.equipped == src) s = 1 + if(istype(usr.equipped,/obj/items)) + usr.equipped.rem_equip(usr) + else + usr.equipped.suffix = "" + usr << "\blue You have unequipped [usr.equipped]!" + usr.equipped = null + if(!s) + usr.equipped = src + usr << "\blue You have equipped [src]!" + src.suffix = "\[equipped\]" + unequip() + set src in usr + set category = "items" + if(usr.equipped == src) + src.suffix = "" + usr.equipped = null + usr << "\blue You have unequipped [src]!" + get() + set src in oview(1,usr) + set category = "items" + if(active) + src << "You must deactivate it first." + else + src.Move(usr) + drop() + set src in usr + set category = "items" + if(usr.equipped == src) + src.unequip() + src.loc = usr.loc + rotate() + set src in oview(1,usr) + if(active) + usr << "You must deactivate it first." + else + src.dir = turn(src.dir,90) + activate() + set src in oview(1,usr) + if(active) + for(var/obj/infared/beam/B in beams) + del(B) + active = 0 + icon_state = "" + else + icon_state = "on" + active = 1 + var + r = 1 + xx = src.x + yy = src.y + switch(src.dir) + if(NORTH) yy++ + if(SOUTH) yy-- + if(EAST) xx++ + if(WEST) xx-- + while(r <= range) + var/turf/N = locate(xx,yy,src.z) + if(!N||N.density) + r = range+1 + return + for(var/atom/O in N) + if(ismob(O)) continue + if(O.density) + r = range+1 + return + var/obj/infared/beam/B = new(locate(xx,yy,src.z)) + B.dir = get_dir(B,src) + B.master = src + switch(src.dir) + if(NORTH) yy++ + if(SOUTH) yy-- + if(EAST) xx++ + if(WEST) xx-- + beams+=B + r++ + +obj + infared + icon = 'icons/infared.dmi' + icon_state = "beam" + layer = MOB_LAYER+1 + beam + name = "" + var + obj/signal/infared/master \ No newline at end of file diff --git a/code/hardware/intercom.dm b/code/hardware/intercom.dm new file mode 100644 index 0000000..8983ef0 --- /dev/null +++ b/code/hardware/intercom.dm @@ -0,0 +1,85 @@ +// /obj/signal/intercom (DEF) + +obj/signal + intercom + name = "intercom" + icon = 'icons/computer.dmi' + icon_state = "intercom" + var/obj/signal/line1 = null + var/state = 0.0 + hear(msg in view(usr.client), atom/source as mob|obj|turf|area in view(usr.client), s_type in view(usr.client), c_mes in view(usr.client), r_src as mob|obj|turf|area in view(usr.client)) + if(!ismob(source)) return + if ((src.state && src.line1)) + var/datum/file/normal/sound/S = new /datum/file/normal/sound( ) + S.s_type = s_type + S.text = c_mes + if (istype(S.s_source, /atom)) + S.s_source = "[source.rname]" + else + if (istype(S.s_source, /datum)) + S.s_source = "[source.name]" + else + S.s_source = "[source]" + S.name = "record.vcl" + var/obj/signal/structure/S1 = new /obj/signal/structure( src.loc ) + S1.master = src + S1.cur_file = S + S1.id = "-1" + S1.params = "record.vcl" + S1.dest_id = 0 + S1.source_id = "intercom" + spawn( 0 ) + if (src.line1) + src.line1.process_signal(S1, src) + return + src.state = 0 + src.icon_state = "intercom" + + disconnectfrom(S as obj in view(usr.client)) + if (S == src.line1) + src.line1 = null + + cut(user in view(usr.client)) + if (user) + user << "You have to cut the wire for this component as it is extremely armored." + return + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (src.line1) + return 0 + else + src.line1 = target + return 1 + + process_signal(obj/signal/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + if (S.cur_file) + var/datum/file/normal/sound/F = S.cur_file + if (!( istype(F, /datum/file/normal/sound) )) + del(S) + return null + var/message = "[(F.s_type == 1 ? "(tone)" : "\icon[locate(/mob)][F.s_source]")]: '[F.text]' from \icon[src]" + for(var/atom/A in view(src, null)) + A.hear(message, F.s_source, F.s_type, F.text, src) + + del(S) + else + if(S.params == "toggle") + src.state = 1 + src.icon_state = "intercom_1" + del(S) + return null + sleep(2) + + verb/talk() + set src in oview(1) + src.state = 1 + usr << "Please speak into the intercom." + src.icon_state = "intercom_1" + diff --git a/code/hardware/junction.dm b/code/hardware/junction.dm new file mode 100644 index 0000000..9f4657b --- /dev/null +++ b/code/hardware/junction.dm @@ -0,0 +1,127 @@ +obj/signal/wire_junction + icon = 'icons/wire_junction.dmi' + icon_state = "junction" + name = "wiring junction" + var + obj/signal/line1 + obj/signal/line2 + obj/signal/line3 + obj/signal/line4 + verb + get() + set category = "items" + set src in oview(usr,1) + src.Move(usr) + drop() + set category = "items" + set src in usr + if(usr.equipped == src) + src.unequip() + src.Move(usr.loc) + equip() + set src in usr + set category = "items" + var/s = 0 + if (usr.equipped) + if(usr.equipped == src) s = 1 + if(istype(usr.equipped,/obj/items)) + usr.equipped.rem_equip(usr) + else + usr.equipped.suffix = "" + usr << "\blue You have unequipped [usr.equipped]!" + usr.equipped = null + if(!s) + usr.equipped = src + usr << "\blue You have equipped [src]!" + src.suffix = "\[equipped\]" + unequip() + set src in usr + set category = "items" + if(usr.equipped == src) + src.suffix = "" + usr.equipped = null + usr << "\blue You have unequipped [src]!" + proc/moved() + return 1 + process_signal(obj/signal/structure/S,obj/source) + ..() + S.loc = src.loc + S.master = src + if(line1) + if(source!=line1) + var/obj/signal/structure/S1 = new() + S.copy_to(S1) + S1.strength -= 5 + if(S1.strength <= 0) + del(S1) + else + line1.process_signal(S1,src) + if(line2) + if(source!=line2) + var/obj/signal/structure/S1 = new/obj/signal/structure + S.copy_to(S1) + S1.strength -= 5 + if(S1.strength <= 0) + del(S1) + else + line2.process_signal(S1,src) + if(line3) + if(source!=line3) + var/obj/signal/structure/S1 = new/obj/signal/structure + S.copy_to(S1) + S1.strength -= 5 + if(S1.strength <= 0) + del(S1) + else + line3.process_signal(S1,src) + if(line4) + if(source!=line4) + var/obj/signal/structure/S1 = new/obj/signal/structure + S.copy_to(S1) + S1.strength -= 5 + if(S1.strength <= 0) + del(S1) + else + line4.process_signal(S1,src) + del(S) + orient_to(obj/target, mob/user) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if(!line1) + line1 = target + user << "Connected to junction 1" + return 1 + if(!line2) + line2 = target + user << "Connected to junction 2" + return 1 + if(!line3) + line3 = target + user << "Connected to junction 3" + return 1 + if(!line4) + line4 = target + usr << "Connected to junction 4" + return 1 + else + return 0 + cut() + if(line1) + src.line1.disconnectfrom(src) + if(line2) + src.line2.disconnectfrom(src) + if(line3) + src.line3.disconnectfrom(src) + if(line4) + src.line4.disconnectfrom(src) + src.line1 = null + src.line2 = null + src.line3 = null + src.line4 = null + Del() + cut() + ..() + Move() + cut() + ..() \ No newline at end of file diff --git a/code/hardware/laptop.dm b/code/hardware/laptop.dm new file mode 100644 index 0000000..1ba45c7 --- /dev/null +++ b/code/hardware/laptop.dm @@ -0,0 +1,125 @@ +obj + signal + computer + laptop + name = "laptop" + icon = 'icons/laptop.dmi' + var/e_key = "1" + orient_to() + + return 0 + + attack_by(obj/items/D in view(usr.client), mob/user as mob in view(usr.client)) + + if (istype(D, /obj/items/disk)) + if (!( src.disk )) + D.unequip() + src.insert_disk(D) + else + user << "There is already a disk in the computer." + else + if (istype(D, /obj/items/scan_chip)) + var/obj/items/S = D + S.rem_equip(user) + S.loc = src + src.bugs += S + user << "Click!" + else + if (istype(D, /obj/items/bug_scan)) + for(var/obj/items/I in src.bugs) + src.bugs -= I + I.loc = src.loc + execute(command in view(usr.client), params in view(usr.client)) + + if (command == "e_key") + var/t1 = splittext(params, "[ascii2text(2)]") + if (src.status != "on") + return + if (src.sys_stat >= 2) + add_to_log("[command] ([params])") + var/number = text2num(t1[1]) + number = round(min(max(1, number), 65000)) + src.e_key = "[number]" + show_message("Encryption key is now [src.e_key]!") + else + return ..() + + send_out(obj/signal/structure/S) + + S.loc = null + S.master = src + for(var/obj/signal/C) + if(C == src) continue + if ((get_dist(C.loc, src.loc) <= 50 && C != src)) + if (C.r_accept(src.e_key, src)) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.strength -= 2 + if (S1.strength <= 0) + del(S1) + missile(/obj/radio, src.loc, C.loc) + spawn( 0 ) + C.process_radio(S1,src) + del(S) + + process_radio(obj/signal/structure/S,atom/source) + S.loc = src + S.master = src + spawn(0) + src.process_signal(S, src) + verb + equip() + set src in usr + set category = "items" + var/s = 0 + if (usr.equipped) + if(usr.equipped == src) s = 1 + if(istype(usr.equipped,/obj/items)) + usr.equipped.suffix = null + usr.equipped.rem_equip(usr) + else + usr.equipped.suffix = null + usr << "\blue You have unequipped [src]!" + usr.equipped = null + if(!s) + usr << "\blue You have equipped [src]!" + src.suffix = "\[equipped\]" + usr.equipped = src + unequip() + set src in usr + set category = "items" + usr.equipped.suffix = null + if(usr.equipped == src) + usr << "\blue You have unequipped [src]!" + usr.equipped = null + get() + set src in oview(1) + set category = "items" + + src.pos_status = 2 + src.invisibility = 0 + src.layer = OBJ_LAYER + for(var/obj/signal/structure/S in src.loc) + if (S.master == src) + S.loc = null + src.loc = usr + + drop() + set src in usr + set category = "items" + + if (usr.pos_status & 1) + src.pos_status = 1 + src.invisibility = 98 + src.layer = 21 + src.loc = usr.loc + + r_accept(string, source) + + if (src.status != "on") + return 0 + if (string == src.e_key) + return 1 + else + return 0 + return diff --git a/code/hardware/microphone.dm b/code/hardware/microphone.dm new file mode 100644 index 0000000..c2e88cd --- /dev/null +++ b/code/hardware/microphone.dm @@ -0,0 +1,116 @@ +// /obj/signal/microphone (DEF) + +obj/signal + microphone + name = "microphone" + icon = 'icons/computer.dmi' + icon_state = "microphone_0" + var/obj/signal/line1 = null + var/state = 0.0 + disconnectfrom(S as obj in view(usr.client)) + + if (S == src.line1) + src.line1 = null + + cut() + + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (src.line1) + return 0 + else + src.line1 = target + return 1 + + hear(msg in view(usr.client), atom/source as mob|obj|turf|area in view(usr.client), s_type in view(usr.client), c_mes in view(usr.client), r_src as mob|obj|turf|area in view(usr.client)) + + if(!ismob(source)) return + if ((src.state && src.line1)) + var/datum/file/normal/sound/S = new /datum/file/normal/sound() + S.s_type = s_type + S.text = c_mes + if (istype(S.s_source, /atom)) + S.s_source = "[source.rname]" + else + if (istype(S.s_source, /datum)) + S.s_source = "[source.name]" + else + S.s_source = "[source]" + S.name = "record.vcl" + var/obj/signal/structure/S1 = new /obj/signal/structure( src.loc ) + S1.master = src + S1.cur_file = S + S1.id = "-1" + S1.params = "record.vcl" + S1.dest_id = 0 + S1.source_id = "microphone" + spawn( 0 ) + if (src.line1) + src.line1.process_signal(S1, src) + return + + process_signal(S as obj in view(usr.client), source as obj in view(usr.client)) + ..() + + del(S) + verb + toggle() + set src in oview(1) + + src.state = !( src.state ) + src.icon_state = "microphone_[src.state]" + usr << (src.state ? "The microphone will now transmit voice data." : "Microphone has been turned off.") + + equip() + set src in usr + set category = "items" + var/s = 0 + if (usr.equipped) + if(usr.equipped == src) s = 1 + if(istype(usr.equipped,/obj/items)) + usr.equipped.rem_equip(usr) + else + usr.equipped.suffix = "" + usr << "\blue You have unequipped [usr.equipped]!" + usr.equipped = null + if(!s) + usr.equipped = src + usr << "\blue You have equipped [src]!" + src.suffix = "\[equipped\]" + + unequip() + set src in usr + set category = "items" + if(usr.equipped == src) + src.suffix = "" + usr.equipped = null + usr << "\blue You have unequipped [src]!" + get() + set src in oview(usr,1) + set category = "items" + src.invisibility = 0 + src.layer = OBJ_LAYER + src.pos_status = 2 + cut() + src.loc = usr + + drop() + set src in usr + set category = "items" + + if (usr.pos_status & 1) + src.pos_status = 1 + src.invisibility = 98 + src.layer = 21 + src.loc = usr.loc + + + proc + moved() + return 1 diff --git a/code/hardware/mini.dm b/code/hardware/mini.dm new file mode 100644 index 0000000..288650d --- /dev/null +++ b/code/hardware/mini.dm @@ -0,0 +1,49 @@ +obj + signal + hub + Move() + ..() + if(line1) line1.cut() + if(line2) line2.cut() + if(line3) line3.cut() + if(line4) line4.cut() + if(line5) line5.cut() + if(line_control) line_control.cut() + if(line_temp) line_temp.cut() + mini + density = 0 + name = "Mini Hub" + max_signal = 10 + icon = 'icons/mini.dmi' + icon_state = "hub" + unlockable = 1 + place_locked = 0 + New() + ..() + if(!place_locked) + verbs += /obj/signal/proc/get_me + verbs += /obj/signal/proc/drop_me + + Move() + ..() + if(line1) line1.cut() + if(line2) line2.cut() + if(line3) line3.cut() + if(line4) line4.cut() + if(line5) line5.cut() + if(line_control) line_control.cut() + if(line_temp) line_temp.cut() + router + mini + density = 0 + name = "Mini Router" + max_signal = 10 + icon = 'icons/mini.dmi' + icon_state = "router" + unlockable = 1 + place_locked = 0 + New() + ..() + if(!place_locked) + verbs += /obj/signal/proc/get_me + verbs += /obj/signal/proc/drop_me \ No newline at end of file diff --git a/code/hardware/notarizer.dm b/code/hardware/notarizer.dm new file mode 100644 index 0000000..2d2b227 --- /dev/null +++ b/code/hardware/notarizer.dm @@ -0,0 +1,59 @@ +obj/signal + notarizer + name = "notarizer" + icon = 'icons/computer.dmi' + icon_state = "notorizer" + density = 1 + var/obj/signal/line1 = null + attack_by(obj/items/P in view(usr.client), user in view(usr.client)) + if (istype(P, /obj/items/paper)) + P.unequip() + P.loc = null + src.notorize(P) + P.loc = src.loc + else + ..() + + disconnectfrom(S as obj in view(usr.client)) + if (S == src.line1) + src.line1 = null + + cut() + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (src.line1) + return 0 + else + src.line1 = target + return 1 + + process_signal(obj/signal/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + S.loc = null + S.master = src + if ((istype(S.cur_file, /datum/file/normal) && !( S.cur_file.flags & 1 ))) + src.file = S.cur_file + S.cur_file = null + S.id = "nt_accept" + S.dest_id = S.source_id + S.source_id = "notorizer" + S.params = "success" + spawn( 2 ) + if (src.line1) + src.line1.process_signal(S, src) + return + proc/notorize(obj/items/paper/P in view(usr.client)) + + if (!( istype(src.file, /datum/file/normal) )) + return + else + var/dat = src.file.text + var/vn = copytext(dat, 1, findtext(dat, "|", 1, null)) + var/id = copytext(dat, findtext(dat, "|", 1, null) + 1, length(dat) + 1) + P.data += "[ascii2text(4)]\[n\][vn];[id]" diff --git a/code/hardware/printer.dm b/code/hardware/printer.dm new file mode 100644 index 0000000..d254967 --- /dev/null +++ b/code/hardware/printer.dm @@ -0,0 +1,84 @@ +obj/signal + printer + name = "printer" + icon = 'icons/computer.dmi' + icon_state = "printer" + density = 1 + var/obj/signal/line1 = null + var/printing = null + verb/paper() + set src in oview(1) + + if (!( src.printing )) + var/obj/items/paper/P = new /obj/items/paper( src.loc ) + usr << "You now have a blank paper\icon[P]." + else + usr << "\blue You are already printing!" + + disconnectfrom(S as obj in view(usr.client)) + + if (S == src.line1) + src.line1 = null + + cut() + + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + + orient_to(obj/target in view(usr.client), mob/user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (src.line1) + return 0 + else + src.line1 = target + return 1 + + process_signal(obj/signal/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + + S.loc = null + S.master = src + if (src.printing) + S.id = "pr_fail" + S.dest_id = S.source_id + S.source_id = "printer" + S.params = "printing" + if (S.cur_file) + del(S.cur_file) + spawn( 2 ) + if (src.line1) + src.line1.process_signal(S, src) + return + else + if ((S.id != "[-1.0]" || (!( istype(S.cur_file, /datum/file/normal) ) || S.cur_file.flags & 1))) + S.id = "pr_fail" + S.dest_id = S.source_id + S.source_id = "printer" + S.params = "err_ftype" + if (S.cur_file) + del(S.cur_file) + spawn( 2 ) + if (src.line1) + src.line1.process_signal(S, src) + return + else + src.printing = 1 + var/obj/items/paper/P = new /obj/items/paper( ) + P.data = "[ascii2text(4)]\[t\][S.cur_file.text]" + P.name = "paper- '[S.params]'" + sleep(30) + P.loc = src.loc + src.printing = null + S.id = "pr_success" + S.dest_id = S.source_id + S.source_id = "printer" + S.params = "success" + if (S.cur_file) + del(S.cur_file) + spawn( 2 ) + if (src.line1) + src.line1.process_signal(S, src) + return \ No newline at end of file diff --git a/code/hardware/rackmount.dm b/code/hardware/rackmount.dm new file mode 100644 index 0000000..cc4e522 --- /dev/null +++ b/code/hardware/rackmount.dm @@ -0,0 +1,165 @@ +obj + signal + rackmount + icon = 'icons/rackmount.dmi' + icon_state = "0" + name = "Rackmount" + density = 1 + var + max_mounts = 4 + list + mounts = list() + connected = list() + + orient_to(obj/signal/wire/target,mob/user) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if(!mounts.len) + user << "There are no systems mounted to this rack." + return 0 + var/obj/signal/computer/select = input(user,"Which system do you want to connect to?")as null|anything in mounts + if(!select) return 0 + if(!select.line1) + connected += target + connected[target] = select + select.line1 = target + user << "Connected to I/O port of [select.name]" + return 1 + else if(!select.line2) + connected += target + connected[target] = select + select.line2 = target + user << "Connected to peripheral port of [select.name]" + return 1 + else return 0 + process_signal(obj/signal/structure/S,obj/source) + ..() + if(!S) return + var/obj/signal/computer/signal_system = connected[source] + if(signal_system) + if(signal_system.line1 == source||signal_system.line2 == source) + var/obj/signal/structure/S2 = new() + S.copy_to(S2) + signal_system.process_signal(S2,source) + del(S) + verb + unmount_system() + set src in view(1) + set category = "computers" + if(!mounts.len) + usr << "There are no systems mounted to this rack." + return + var/obj/signal/computer/select = input(usr,"Which system do you want to unmount?")as null|anything in mounts + if(!select) return + mounts -= select + select.status = "no_m" + for(var/obj/signal/S in connected) + if(connected[S] == select) + S.cut() + connected -= S + var/obj/items/computer/nc = new(src.loc) + nc.com = select + select.loc = nc + if(select.label) + nc.name = "computer- '[select.label]'" + icon_state = "[mounts.len]" + var/s = 1 + for(var/obj/signal/computer/S in mounts) + if(findtext(S.name,"computer- 'mount")) + S.label = "mount [s]" + S.name = "computer- 'mount [s]'" + s++ + + boot() + set src in view(1) + set category = "computers" + if(!mounts.len) + usr << "There are no systems mounted to this rack." + return + var/obj/signal/computer/select = input(usr,"Which system do you want to boot?")as null|anything in mounts + if(!select) return + select.boot() + operate() + set src in view(1) + set category = "computers" + if(!mounts||!mounts.len) + usr << "There are no systems mounted to this rack." + return + var/obj/signal/computer/select = input(usr,"Which system do you want to operate?")as null|anything in mounts + if(!select) return + select.temp_user = usr + select.operate() + eject() + set src in view(1) + set category = "computers" + if(!mounts.len) + usr << "There are no systems mounted to this rack." + return + var/obj/signal/computer/select = input(usr,"Which system do you want to eject a disk from?")as null|anything in mounts + if(!select) return + select.eject() + power_off() + set src in view(1) + set category = "computers" + if(!mounts.len) + usr << "There are no systems mounted to this rack." + return + var/obj/signal/computer/select = input(usr,"Which system do you want to power off?")as null|anything in mounts + if(!select) return + select.power_off() + label(T as text) + set src in view(1) + set category = "computers" + if(!T) name = "Rackmount" + else name = "Rackmount- '[T]'" + disconnectfrom(obj/source) + if(source in connected) + connected -= source + for(var/obj/signal/computer/C in mounts) + if(C.line1 == source||C.line2 == source) + C.disconnectfrom(source) + cut() + for(var/obj/signal/C in mounts) + C.cut() + connected = list() + New() + ..() + if(ismob(src.loc)) + connected = list() + attack_by(obj/items/selected,mob/user) + if(istype(selected,/obj/items/computer)) + var/obj/items/computer/valid_system = selected + if(mounts.len >= max_mounts) + user << "This rackmount is full." + else + user << "Successfully mounted the system to the rackmount." + if(ckey(valid_system.com.name) == "computer") + valid_system.com.label = "mount [mounts.len+1]" + valid_system.com.name = "computer- '[valid_system.com.label]'" + mounts += valid_system.com + valid_system.com.status = "off" + valid_system.com.loc = src + icon_state = "[mounts.len]" + del(valid_system) + var/s = 1 + for(var/obj/signal/computer/S in mounts) + if(findtext(S.name,"computer- 'mount")) + S.label = "mount [s]" + S.name = "computer- 'mount [s]'" + s++ + + else + if(istype(selected,/obj/items/disk)) + if(!mounts.len) + user << "There are no systems mounted to this rack." + return + var/obj/signal/computer/sel = input("Which computer do you want to insert the disk into?")as null|anything in mounts + if(!sel) return + sel.insert_disk(selected) + else if(istype(selected,/obj/items/wire)) + ..() + else if(istype(selected,/obj/items/wrench)) + ..() + else + user << "You can only mount computers to this device." diff --git a/code/hardware/radio.dm b/code/hardware/radio.dm new file mode 100644 index 0000000..5e3f413 --- /dev/null +++ b/code/hardware/radio.dm @@ -0,0 +1,28 @@ +obj + radio + name = "radio" + icon = 'icons/misc.dmi' + icon_state = "radio" + direct + name = "direct radio" + var/data = null + + proc/process() + + step(src, src.dir) + for(var/obj/signal/S in src.loc) + if (S.d_accept()) + S.process_radio(src.data,src) + src.data = null + del(src) + return + + if ((src.y == 1 || (src.y == world.maxy || (src.x == 1 || src.x == world.maxx)))) + del(src) + return + spawn( 1 ) + src.process() + + Del() + del(src.data) + ..() diff --git a/code/hardware/router.dm b/code/hardware/router.dm new file mode 100644 index 0000000..cb4f628 --- /dev/null +++ b/code/hardware/router.dm @@ -0,0 +1,288 @@ +obj/signal/hub + router + name = "router" + icon_state = "router" + var/mode = "normal" + var/m_data = null + var/flags = 1.0 + process_signal(obj/signal/structure/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + if(!S) return + S.loc = src.loc + var/number = 0 + var/list/L = list() + if (source != src.line_control) + if ((S.id == "-2" && (source != src.line_temp || src.mode == "normal"))) + L = splittext(S.source_id, ".") + while(L.len < src.position) + L += "0" + if (source == src.line1) + number = 0 + else + if (source == src.line2) + number = 20 + else + if (source == src.line3) + number = 40 + else + if (source == src.line4) + number = 60 + else + number = 80 + L[src.position] = "[number]" + S.source_id = jointext(L, ".") + del(L) + L = splittext(S.dest_id, ".") + var/t_num = "0" + if (L.len >= src.position) + t_num = "[L[src.position]]" + if (src.line_control) + spawn( 0 ) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Received signal: [S.id] ([S.params]) from [S.source_id] to [S.dest_id]. Parsed: [t_num]" + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + t_num = text2num(t_num) + spawn( 0 ) + var/nflags = text2num(src.flags) + if ((src.mode == "normal" || ((nflags & 2 && src.position >= L.len) || ((src.mode == "5>1" && !( src.line_temp )) || (src.mode == "5>1" && source == src.line_temp))))) + var/n1 = src.multi + src.offset + var/n2 = (src.multi * 2) + src.offset + var/n3 = (src.multi * 3) + src.offset + var/n4 = (src.multi * 4) + src.offset + var/n5 = (src.multi * 5) + src.offset + if ((t_num >= n1 && t_num < n2)) + if (src.line2) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.strength-- + if (S1.strength <= 0) + del(S1) + return + src.line2.process_signal(S1, src) + else + if ((t_num >= n2 && t_num < n3)) + if (src.line3) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.strength-- + if (S1.strength <= 0) + del(S1) + return + src.line3.process_signal(S1, src) + else + if ((t_num >= n3 && t_num < n4)) + if (src.line4) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.strength-- + if (S1.strength <= 0) + del(S1) + return + src.line4.process_signal(S1, src) + else + if ((t_num >= n4 && t_num < n5)) + if (src.line5) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.strength-- + if (S1.strength <= 0) + del(S1) + return + src.line5.process_signal(S1, src) + else + if ((t_num == n5 && nflags & 1)) + var/list/t1 = list( "line1", "line2", "line3", "line4", "line5" ) + for(var/x in t1) + if (src.vars[x] == source) + t1 -= x + else + + for(var/x in t1) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.strength-- + if (S1.strength <= 0) + del(S1) + return + var/obj/signal/S2 = src.vars[x] + spawn( 0 ) + if (S2) + S2.process_signal(S1, src) + return + + else + if (src.line1) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.strength-- + if (S1.strength <= 0) + del(S1) + return + src.line1.process_signal(S1, src) + else + if ((src.line_temp && src.mode == "5>1")) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S.copy_to(S1) + S1.strength-- + if (S1.strength <= 0) + del(S1) + return + src.line_temp.process_signal(S1, src) + del(S) + return + else + if (S.id == "pos") + src.position = round(text2num(S.params)) + src.position = min(max(src.position, 1), 15) + spawn( 0 ) + var/obj/signal/structure/S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Position altered to [src.position]!" + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + else + if (S.id == "src") + src.s_id = src.params + spawn( 0 ) + var/obj/signal/structure/S1 = new /obj/signal/structure() + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Source id altered to [src.s_id]!" + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + else + if (S.id == "multi") + src.multi = src.params + var/obj/signal/structure/S1 + spawn(0) + S1 = new() + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Destination id altered to [src.d_id]!" + return + else + var/obj/signal/structure/S1 = new /obj/signal/structure() + if (src.id == "offset") + src.offset = S1.params + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Destination id altered to [src.d_id]!" + return + else + if (S.id == "dest") + src.d_id = S1.params + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Destination id altered to [src.d_id]!" + return + else + if (S.id == "mode") + src.mode = S.params + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Mode altered to [src.mode] (it must be normal or 5>1 else router will not work)!" + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + else + if (S.id == "flags") + src.flags = S.params + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Flags altered to [src.flags]! Query for info." + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + else + if (S.id == "query") + switch(S.params) + if("pos") + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Position is [src.position]!" + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + if("src") + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Source id is [src.s_id]!" + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + if("dest") + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Destination id is [src.d_id]!" + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + if("mode") + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = "Mode is is [src.mode]!" + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + if("flags") + var/t = null + + if (text2num(src.flags) & 1) + t += "allow 100 (1)," + if (text2num(src.flags) & 2) + t += "bounce back (2)," + spawn( 0 ) + S1 = new /obj/signal/structure( ) + S1.dest_id = src.d_id + S1.source_id = src.s_id + S1.id = 1 + S1.params = (t ? "Current flags: [t] adds to [src.flags]" : "No flags! Available flags 1,2") + spawn( 0 ) + src.line_control.process_signal(S1, src) + return + return + del(S) \ No newline at end of file diff --git a/code/hardware/scanner.dm b/code/hardware/scanner.dm new file mode 100644 index 0000000..3930328 --- /dev/null +++ b/code/hardware/scanner.dm @@ -0,0 +1,44 @@ +obj + signal + scanner + name = "Paper Scanner" + icon = 'icons/computer.dmi' + icon_state = "paper_scanner" + var + obj/signal/line1 + orient_to(obj/target,mob/user) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if(!line1) + user << "Connected to scanner line." + line1 = target + return 1 + else + return 0 + + cut() + if(line1) + line1.disconnectfrom(src) + line1 = null + process_signal(obj/S) + del(S) + attack_by(obj/PA, mob/user) + if(user.equipped) + if(line1) + if(istype(user.equipped,/obj/items/paper)) + var/obj/items/paper/P = user.equipped + user << "Paper scanned and sent." + var/obj/signal/structure/S = new() + S.id = "-1" + var/datum/file/normal/N = new() + N.name = "scanner" + N.text = P.format() + S.cur_file = N + line1.process_signal(S,src) + if (istype(user.equipped, /obj/items/wire)) + var/obj/items/wire/I = user.equipped + spawn(0) + if (I) + I.wire(src, user) + diff --git a/code/hardware/security_camera.dm b/code/hardware/security_camera.dm new file mode 100644 index 0000000..e818016 --- /dev/null +++ b/code/hardware/security_camera.dm @@ -0,0 +1,52 @@ +// Just messin' with vis_contents, won't compile earlier than 512. + +#if DM_VERSION >= 512 +obj + signal + camera + name = "camera" + icon = 'icons/camera.dmi' + icon_state = "camera" + dir = SOUTH + var/obj/signal/camera_screen/connected + var + camera_id + + New() + spawn(10) + var/obj/signal/camera_screen/found = locate("cam_screen_[camera_id]") in world + if(found) + connected = found + found.connected = src + found.Activate() + + camera_screen + name = "camera screen" + var + camera_id + obj/signal/camera/connected + + icon = 'icons/camera_screen.dmi' + New() + ..() + tag = "cam_screen_[camera_id]" + layer = MOB_LAYER+1 + proc/Activate() + var/image/screen = image(loc=src) + var/matrix/scaled = matrix() + scaled.Scale(0.6) + scaled.Translate(16,2) + screen.layer = src.layer+1 + screen.transform = scaled + screen.vis_contents += connected.loc + screen.vis_contents += get_step(connected,connected.dir) + screen.vis_contents += get_step(connected,connected.dir|EAST) + screen.vis_contents += get_step(connected,connected.dir|WEST) + screen.vis_contents += get_step(connected,EAST) + screen.vis_contents += get_step(connected,WEST) + world << screen + underlays += image('icons/camera_screen.dmi',"screen",layer=TURF_LAYER+1) + +#else + #warn BYOND v512 or higher is required to use vis_contents. +#endif \ No newline at end of file diff --git a/code/hardware/shutters.dm b/code/hardware/shutters.dm new file mode 100644 index 0000000..10182ce --- /dev/null +++ b/code/hardware/shutters.dm @@ -0,0 +1,73 @@ +obj + signal + shutter_box + name = "Shutter Control" + icon = 'icons/computer.dmi' + icon_state = "box" + var/obj/signal/line1 + var/range = 5 + verb + open() + set src in view(1,usr) + for(var/obj/shutter/ST in view(src,range)) + if(ST.icon_state != "open") + ST.Open() + close() + set src in view(1,usr) + for(var/obj/shutter/ST in view(src,range)) + if(ST.icon_state == "open") + ST.Open() + + New() + ..() + icon += rgb(0,0,75) + orient_to(obj/target,mob/user) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if(line1) + return 0 + else + if(src.loc != user.loc) + user << "You must be standing on the same tile as [src] to connect wires." + return 0 + else + line1 = target + user << "Connected to shutter control box." + return 1 + cut() + if(line1) + line1.disconnectfrom(src) + line1 = null + process_signal(obj/signal/structure/S,obj/source) + ..() + S.loc = src.loc + S.master = src + if(S.id == "toggle") + for(var/obj/shutter/ST in view(src,range)) + ST.Open() + if(S.id == "open") + for(var/obj/shutter/ST in view(src,range)) + ST.Open(1) + + del(S) + shutter + name = "Window Shutter" + icon = 'icons/shutter.dmi' + icon_state = "closed" + density = 1 + opacity = 1 + layer = OBJ_LAYER-1 + var + pcode + + proc + Open(var/force) + if(icon_state == "open"||force==2) + icon_state = "closed" + opacity = 1 + density = 1 + else + icon_state = "open" + opacity = 0 + density = 0 diff --git a/code/hardware/sign.dm b/code/hardware/sign.dm new file mode 100644 index 0000000..94c6d8c --- /dev/null +++ b/code/hardware/sign.dm @@ -0,0 +1,105 @@ +obj + signal + sign_box + name = "Sign Control" + icon = 'icons/computer.dmi' + icon_state = "sign_box" + var + sign_dir = SOUTH + tmp/obj/new_sign/my_sign + obj/signal/line1 + default_text + text_color = "green" + shadow_color = "black" + dir = SOUTH + New() + ..() + spawn(5) + var/obj/new_sign/found_sign = locate() in get_step(src,src.sign_dir) + if(found_sign) + del(found_sign) + my_sign = new() + my_sign.loc = get_step(src,src.sign_dir) + if(default_text) + my_sign.SetText(default_text,text_color, shadow_color) + Del() + if(my_sign) + del(my_sign) + ..() + + orient_to(obj/target,mob/user) + if(line1) return 0 + if(user.loc != src.loc) + user << "You must be on the same tile as the sign box to connect to it." + return 0 + else + line1 = target + user << "Connected to sign box." + return 1 + cut() + if(line1) + line1.disconnectfrom(src) + line1 = null + proc + UpdateSign() + if(my_sign) + my_sign.SetText(default_text,src.text_color,src.shadow_color) + process_signal(obj/signal/structure/S,obj/source) + ..() + S.loc = src.loc + S.master = src + if(S.id == "text") + var/new_text = S.params + default_text = new_text + UpdateSign() + if(S.id == "color" || S.id == "shadow") + var/new_color = S.params + if(S.id == "shadow") src.shadow_color = new_color + else src.text_color = new_color + UpdateSign() + del(S) + + new_sign + icon = 'icons/new_sign.dmi' + name = "Sign" + var + image + maptext_dummy + maptext_shadow + proc + SetText(text,text_color="green",shadow="black") + //var/empty_spaces = 0 + text = stripHTML(text) + if(length(text) > 18) text = copytext(text,1,19) + /*else + empty_spaces = (16 - length(text)) + while(empty_spaces > 0) + text = " [text]" + empty_spaces--*/ + if(!maptext_dummy) + maptext_dummy = new() + maptext_shadow = new() + maptext_dummy.layer = OBJ_LAYER+2 + maptext_shadow.layer = OBJ_LAYER+1 + overlays += maptext_dummy + overlays += maptext_shadow + overlays -= maptext_dummy + overlays -= maptext_shadow + maptext_dummy.pixel_x = 10 + maptext_shadow.pixel_x = maptext_dummy.pixel_x + 1 + maptext_dummy.pixel_y = 1 + maptext_shadow.pixel_y = maptext_dummy.pixel_y + maptext_dummy.maptext_width = 96 + maptext_shadow.maptext_width = maptext_dummy.maptext_width + maptext_dummy.maptext = {" + + [text] + + "} + maptext_shadow.maptext = {" + + [text] + + "} + overlays += maptext_shadow + overlays += maptext_dummy \ No newline at end of file diff --git a/code/hardware/switchboard.dm b/code/hardware/switchboard.dm new file mode 100644 index 0000000..1c07724 --- /dev/null +++ b/code/hardware/switchboard.dm @@ -0,0 +1,217 @@ +obj/signal + switchboard + name = "switchboard" + icon = 'icons/computer.dmi' + icon_state = "sboard" + density = 1 + + var/obj/signal/line1 = null + var/obj/signal/line2 = null + var/obj/signal/line3 = null + var/obj/signal/line4 = null + var/obj/signal/line5 = null + var/obj/signal/line6 = null + var/obj/signal/line7 = null + var/obj/signal/line8 = null + var/obj/signal/line9 = null + var/obj/signal/line10 = null + var/list/c_stat = list() + proc + ret_str(obj/signal/S as obj in view(usr.client)) + + if (S.cur_file) + var/datum/file/normal/sound/F = S.cur_file + if ((!( istype(F, /datum/file/normal/sound) ) || F.s_type != 1)) + return null + else + return F.text + + ret_line(S as obj in view(usr.client)) + + if (src.line1 == S) + return "line1" + if (src.line2 == S) + return "line2" + if (src.line3 == S) + return "line3" + if (src.line4 == S) + return "line4" + if (src.line5 == S) + return "line5" + if (src.line6 == S) + return "line6" + if (src.line7 == S) + return "line7" + if (src.line8 == S) + return "line8" + if (src.line9 == S) + return "line9" + if (src.line10 == S) + return "line10" + + process_signal(obj/signal/S, obj/source) + ..() + + S.master = src + S.loc = src.loc + del(S) + + + orient_to(obj/target in view(usr.client), user as mob in view(usr.client)) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (!( src.line1 )) + src.line1 = target + user << "Connection port: Line 1 (1)" + else + if (!( src.line2 )) + src.line2 = target + user << "Connection port: Line 2 (2)" + else + if (!( src.line3 )) + src.line3 = target + user << "Connection port: Line 3 (3)" + else + if (!( src.line4 )) + src.line4 = target + user << "Connection port: Line 4 (4)" + else + if (!( src.line5 )) + src.line5 = target + user << "Connection port: Line 5 (5)" + else + if (!( src.line6 )) + src.line6 = target + user << "Connection port: Line 6 (6)" + else + if (!( src.line7 )) + src.line7 = target + user << "Connection port: Line 7 (7)" + else + if (!( src.line8 )) + src.line8 = target + user << "Connection port: Line 8 (8)" + else + if (!( src.line9 )) + src.line9 = target + user << "Connection port: Line 9 (9)" + else + if (!( src.line10 )) + src.line10 = target + user << "Connection port: Line 10(10)" + else + return 0 + return 1 + + disconnectfrom(source as obj in view(usr.client)) + + if (src.line1 == source) + src.line1 = null + else + if (src.line2 == source) + src.line2 = null + else + if (src.line3 == source) + src.line3 = null + else + if (src.line4 == source) + src.line4 = null + else + if (src.line5 == source) + src.line5 = null + else + if (src.line6 == source) + src.line6 = null + else + if (src.line7 == source) + src.line7 = null + else + if (src.line8 == source) + src.line8 = null + else + if (src.line9 == source) + src.line9 = null + else + if (src.line10 == source) + src.line10 = null + + cut() + + if (src.line1) + src.line1.disconnectfrom(src) + if (src.line2) + src.line2.disconnectfrom(src) + if (src.line3) + src.line3.disconnectfrom(src) + if (src.line4) + src.line4.disconnectfrom(src) + if (src.line5) + src.line5.disconnectfrom(src) + if (src.line6) + src.line6.disconnectfrom(src) + if (src.line7) + src.line7.disconnectfrom(src) + if (src.line8) + src.line8.disconnectfrom(src) + if (src.line9) + src.line9.disconnectfrom(src) + if (src.line10) + src.line10.disconnectfrom(src) + src.line1 = null + src.line2 = null + src.line3 = null + src.line4 = null + src.line5 = null + src.line6 = null + src.line7 = null + src.line8 = null + src.line9 = null + src.line10 = null + + verb + disconnect() + set src in oview(1) + + var/choice = input("Which line would you like to disconnect? 1-10", "Hub", null, null) as num + switch(choice) + if(1.0) + if (src.line1) + src.line1.disconnectfrom(src) + src.line1 = null + if(2.0) + if (src.line2) + src.line2.disconnectfrom(src) + src.line2 = null + if(3.0) + if (src.line3) + src.line3.disconnectfrom(src) + src.line3 = null + if(4.0) + if (src.line4) + src.line4.disconnectfrom(src) + src.line4 = null + if(5.0) + if (src.line5) + src.line5.disconnectfrom(src) + src.line5 = null + if(6.0) + if (src.line6) + src.line6.disconnectfrom(src) + src.line6 = null + if(7.0) + if (src.line7) + src.line7.disconnectfrom(src) + src.line7 = null + if(8.0) + if (src.line8) + src.line8.disconnectfrom(src) + src.line8 = null + if(9.0) + if (src.line9) + src.line9.disconnectfrom(src) + src.line9 = null + if(10.0) + if (src.line10) + src.line10.disconnectfrom(src) + src.line10 = null diff --git a/code/hardware/teleport.dm b/code/hardware/teleport.dm new file mode 100644 index 0000000..86d23f1 --- /dev/null +++ b/code/hardware/teleport.dm @@ -0,0 +1,177 @@ +atom + movable + var + tmp + has_teleported = 0 + +obj + signal + teleport_pad + icon = 'icons/teleport.dmi' + icon_state = "active_0" + name = "Teleport Pad" + var + destination + identifier + tmp + active = 0 + charged = 0 + primed = 0 + charged_destination + obj/signal/wire/line1 + proc + Engage(loop=1,dest_or=null) + var/dest = destination + if(dest_or) dest = dest_or + var/obj/signal/teleport_pad/T = locate("teleport_[dest]") in world + if(T && !ismob(T.loc) && T.identifier) + if(!T.active) + /* T.active = 1 + T.charged = 1 + T.primed = 1 + T.icon_state = "active_3"*/ + for(var/atom/movable/A in src.loc) + spawn(1) + if(istype(A,/obj/signal/structure)) continue + if(A == src) continue + if(istype(A,/obj/signal/infared)) + var/obj/signal/infared/I = A + if(I.active) continue + if(istype(A,/obj/signal/wire)) continue + if(istype(A,/obj/infared)) continue + if(istype(A,/obj/door)) continue + if(istype(A,/obj/signal/box)) continue + if(istype(A,/Conveyor)) continue + if(istype(A,/obj/signal/sign_box)) continue + if(A) + if(A.has_teleported) continue + A.loc = T.loc + A.has_teleported = 1 + spawn(10) + if(A) + A.has_teleported = 0 + if(loop) + T.Engage(0,src.identifier) + /*for(var/atom/movable/A in T.loc) + spawn(1) + if(istype(A,/obj/signal/structure)) continue + if(A == T) continue + if(A) + if(A.has_teleported) continue + A.loc = src.loc + A.has_teleported = 1 + spawn(4) + if(A) + A.has_teleported = 0 + T.active = 0 + T.charged = 0 + T.primed = 0 + T.icon_state = "active_0" + if(T.line1) + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "teleporter" + S1.params = "incoming" + T.line1.process_signal(S1,src)*/ + active = 0 + charged = 0 + primed = 0 + icon_state = "active_0" + orient_to(obj/target, user as mob) + + if (get_dist(src,user) <= 1) + if (src.line1) + return 0 + else + src.line1 = target + return 1 + else + user << "You must be closer to connect a wire to that!" + return 0 + process_signal(obj/signal/structure/S,atom/source) + ..() + if(!S) return + S.loc = src.loc + S.master = src + if(source != line1) + del(S) + return + if(S.id == "prime") + primed = !primed + icon_state = "active_[primed]" + if(!primed) charged = 0 + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "teleporter" + S1.params = "primed_[primed]" + if(line1) + line1.process_signal(S1,src) + if(S.id == "charge") + if(primed) + var/obj/signal/teleport_pad/T = locate("teleport_[destination]") in world + icon_state = "active_2" + charged = 1 + charged_destination = destination + if(T) + if(!T.active) + T.primed = 1 + T.charged = 1 + T.icon_state = "active_2" + T.charged_destination = identifier + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "teleporter" + S1.params = "charged" + + if(line1) + line1.process_signal(S1,src) + else + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "teleporter" + S1.params = "charge_failed" + if(line1) + line1.process_signal(S1,src) + flick("not_primed",src) + if(S.id == "activate") + if(primed&&charged) + icon_state = "active_3" + active = 1 + Engage() + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "teleporter" + S1.params = "outgoing:[destination]" + if(line1) + line1.process_signal(S1,src) + if(S.id == "deactivate") + primed = 0 + charged = 0 + active = 0 + icon_state = "active_0" + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "teleporter" + S1.params = "deactivate" + if(line1) + line1.process_signal(S1,src) + if(S.id == "dest") + if(S.params) + destination = "[S.params]" + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "teleporter" + S1.params = "dest_change:[destination]" + if(line1) + line1.process_signal(S1,src) + if(S.id == "ident") + if(S.params) + identifier = S.params + tag = "teleport_[identifier]" + var/obj/signal/structure/S1 = new /obj/signal/structure( src ) + S1.id = "teleporter" + S1.params = "ident_change:[identifier]" + if(line1) + line1.process_signal(S1,src) + del(S) + New() + ..() + tag = "teleport_[identifier]" + icon_state = "active_0" + Read() + ..() + tag = "teleport_[identifier]" + icon_state = "active_0" diff --git a/code/hardware/underground_wire.dm b/code/hardware/underground_wire.dm new file mode 100644 index 0000000..bc2baf3 --- /dev/null +++ b/code/hardware/underground_wire.dm @@ -0,0 +1,150 @@ +mob + var + tmp + obj/items/concealed_wire/con_using + obj/signal/concealed_wire/p_wire + viewing_under = 0 +client + Move() + ..() + if(mob.viewing_under) + images = list() + mob.viewing_under = 0 + +obj + items + concealed_wire + icon = 'icons/concealed_wiring.dmi' + name = "underground wiring spool" + var + amount = 10 + unequip() + ..() + if(usr.con_using) + usr << "You have aborted the underground wiring process." + del(usr.p_wire) + usr.con_using = null + usr.p_wire = null + usr.client.images = list() + moved(mob/user,turf/oldloc) + if(user.con_using) + var/turf/T = user.loc + if(user.p_wire) + if(user.p_wire.connected_wires.len > 50) + user << "You stop placing underground wire and place a secondary terminal." + var/obj/signal/concealed_wire/child = new(user.loc) + child.connected_terminal = user.p_wire + user.p_wire.connected_terminal = child + child.working = 1 + child.connected_wires = user.p_wire.connected_wires.Copy(1,0) + child.connected_wires -= child.loc + child.connected_wires += user.p_wire.loc + user.con_using = null + user.p_wire = null + user.client.images = list() + return + if(!(T in user.p_wire.connected_wires)) + user.p_wire.connected_wires += T + user << image('icons/concealed_wiring.dmi',T,icon_state="hl",layer=99) + ..() + attack_by(obj/D,mob/user) + if(user.con_using) + user << "You stop placing underground wire and place a secondary terminal." + var/obj/signal/concealed_wire/child = new(user.loc) + child.connected_terminal = user.p_wire + user.p_wire.working = 1 + child.working = 1 + user.p_wire.connected_terminal = child + child.connected_wires = user.p_wire.connected_wires.Copy(1,0) + child.connected_wires -= child.loc + child.connected_wires += user.p_wire.loc + user.con_using = null + user.p_wire = null + user.client.images = list() + return + + if(user.equipped == src) + user << "You place a wiring terminal, now walk to your destination and then double-click this spool again." + user.con_using = src + var/obj/signal/concealed_wire/parent = new(user.loc) + user.p_wire = parent + + + signal + concealed_wire + name = "underground wiring terminal" + icon = 'icons/concealed_wiring.dmi' + verb + view_wires() + set src in oview(usr,1) + usr.viewing_under = 1 + usr << "Viewing the wiring setup for [src]" + usr.client.images = list() + for(var/turf/T in connected_wires) + usr << image('icons/concealed_wiring.dmi',T,icon_state="hl",layer=99) + label(T as text) + set src in oview(usr,1) + if(!T) return + name = "underground wiring terminal - '[T]'" + var + tmp + working = 0 + obj/signal/line1 + list + connected_wires = list() + obj/signal/concealed_wire/connected_terminal + orient_to(obj/target,mob/user) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if(!line1) + user << "Connected to underground wire terminal" + line1 = target + return 1 + return 0 + + process_signal(obj/signal/structure/S,obj/source) + ..() + S.loc = src.loc + S.master = src + if(line1) + if(line1 != source) + var/obj/signal/structure/resend = new() + S.copy_to(resend) + line1.process_signal(resend,src) + + else + if(connected_terminal) + if(istype(connected_terminal,/obj/signal/wire/hyper)) + var/obj/signal/structure/S1 = new() + S.copy_to(S1) + S.invisibility = 101 + connected_terminal.process_signal(S1,connected_terminal) + else + for(var/turf/T in connected_wires) + var/obj/signal/structure/S1 = new() + S.copy_to(S1) + S.invisibility = 101 + if((locate(connected_terminal) in T)) + S1.loc = connected_terminal.loc + S1.master = connected_terminal + if(connected_terminal.line1) + var/obj/signal/structure/S3 = new() + S1.copy_to(S3) + connected_terminal.process_signal(S3,connected_terminal) + del(S1) + break + + del(S1) + sleep(1) + del(S) + cut() + if(!working) return + if(line1) + line1.disconnectfrom(src) + line1 = null + if(connected_terminal) + src.connected_terminal.connected_terminal = null + src.connected_terminal.cut() + src.connected_terminal = null + del(src) \ No newline at end of file diff --git a/code/hardware/wire.dm b/code/hardware/wire.dm new file mode 100644 index 0000000..ec32db9 --- /dev/null +++ b/code/hardware/wire.dm @@ -0,0 +1,261 @@ +obj/signal + wire + name = "wire" + icon = 'icons/wire.dmi' + var/s_tag = null + var/direction = null + var/obj/signal/line1 = null + var/obj/signal/line2 = null + anchored = 1.0 + hyper + name = "hyper" + icon = 'icons/hyperwire.dmi' + + var + label + w_color + verb + examine() + set src in world + + /* Read(savefile/F) + ..() + + if(istype(src,/obj/signal/wire/hyper)) + color = "hyper" + icon = 'icons/hyperwire.dmi' + update()*/ + /*Write(savefile/F) + if(!color) + switch("[icon]") + if("b_wire.dmi") color = "blue" + if("r_wire.dmi") color = "red" + if("g_wire.dmi") color = "green" + if("hyperwire.dmi") color = "hyper" + else color = "black" + var/s_icon = src.icon + icon = null + F["icon"] << "[s_icon]" + ..() + icon = s_icon*/ + + cut(force=0) + if (src.line1) + src.line1.disconnectfrom(src) + if (src.line2) + src.line2.disconnectfrom(src) + src.line1 = null + src.line2 = null + var/obj/items/wire/W = new /obj/items/wire( src.loc ) + var + n_state = "item_wire" + acolor = "black" + switch(src.icon) + if('icons/b_wire.dmi') + n_state = "item_bluewire" + acolor = "blue" + if('icons/r_wire.dmi') + if(src.type == /obj/signal/wire/hyper) + acolor = "hyper" + else + n_state = "item_redwire" + acolor = "red" + if('icons/g_wire.dmi') + n_state = "item_greenwire" + acolor = "green" + if('icons/wire.dmi') + n_state = "item_blackwire" + acolor = "black" + if('icons/hyperwire.dmi') + n_state = "item_hyperwire" + acolor = "hyper" + W.icon_state = n_state + W.scolor = acolor + W.color = acolor + if (src.pos_status & 1) + W.layer = 21 + W.invisibility = 98 + W.pos_status = 1 + if(force) + spawn(1) del(src) + else + del(src) + proc + update() + var + t1 + t2 + if ((!( src.line1 ) && !( src.line2 ))) + src.icon_state = "512" + src.direction = null + var + n_state = "item_wire" + acolor = "black" + switch(src.icon) + if('icons/b_wire.dmi') + n_state = "item_bluewire" + acolor = "blue" + if('icons/r_wire.dmi') + if(src.type == /obj/signal/wire/hyper) + acolor = "hyper" + color = "hyper" + else + n_state = "item_redwire" + acolor = "red" + color = "red" + if('icons/g_wire.dmi') + n_state = "item_greenwire" + acolor = "green" + color = "green" + if('icons/wire.dmi') + n_state = "item_blackwire" + acolor = "black" + color = "black" + if('icons/hyperwire.dmi') + n_state = "item_hyperwire" + acolor = "hyper" + color = "hyper" + if(istype(src,/obj/signal/wire/hyper)) + var/obj/items/wire/hyper/H = new/obj/items/wire/hyper(src.loc) + H.icon_state = n_state + H.scolor = acolor + H.color = acolor + else + var/obj/items/wire/W = new /obj/items/wire( src.loc ) + W.icon_state = n_state + W.scolor = acolor + W.color = acolor + color = acolor + del(src) + return + else + if ((src.line1 && (src.line2 && (src.line1.loc == src.line2.loc && src.line1.loc == src.loc)))) + src.icon_state = "1" + src.direction = 1 + return 1 + if (!( src.line1 )) + t1 = 256 + else + t1 = get_dir(src, src.line1) + if (!( src.line2 )) + t2 = 256 + else + t2 = get_dir(src, src.line2) + switch(t1) + if(5.0) + t1 = 16 + if(9.0) + t1 = 32 + if(6.0) + t1 = 64 + if(10.0) + t1 = 128 + else + switch(t2) + if(5.0) + t2 = 16 + if(9.0) + t2 = 32 + if(6.0) + t2 = 64 + if(10.0) + t2 = 128 + else + if ((src.line1 && src.line1.loc == src.loc)) + t2 = t2 << 1 + t1 = 0 + else + if ((src.line2 && src.line2.loc == src.loc)) + t1 = t1 << 1 + t2 = 0 + src.direction = t1 + t2 + src.icon_state = "[src.direction]" + if (src.direction == 512) + src.icon_state = "512" + src.direction = null + new /obj/items/wire( src.loc ) + del(src) + return + return src.direction + + orient_to(obj/signal/target in view(usr.client),mob/user) + if(ismob(src.loc)) + user << "Device must be on the ground to connect to it." + return 0 + if (src.line1) + if (src.line2) + return 0 + else + if(!originator) + if(target.originator) src.originator = target.originator + else src.originator = target + src.line2 = target + else + if(!originator) + if(target.originator) src.originator = target.originator + else src.originator = target + src.line1 = target + src.update() + return 1 + + disconnectfrom(source as obj in view(usr.client)) + + if (src.line1 == source) + src.line1 = null + else + src.line2 = null + src.update() + return + + New() + + ..() + spawn( 50 ) + src.update() + return + return + + Del() + + for(var/obj/signal/structure/S in src.loc) + if (S.master == src) + del(S) + + if (src.line1) + src.line1.disconnectfrom(src) + if (src.line2) + src.line2.disconnectfrom(src) + src.line1 = null + src.line2 = null + ..() + return + + process_signal(obj/signal/S as obj in view(usr.client), obj/source as obj in view(usr.client)) + ..() + if(!S) return + if(S.master) + S.icon_state = S.master.icon_state + S.loc = src.loc + S.icon_state = src.icon_state + S.master = src + if(istype(source.loc,/obj/signal/rackmount)) source = source.loc + if (source == src.line1) + spawn( 1 ) + if (!( src.line2 )) + del(S) + else + src.line2.process_signal(S, src) + return + else + spawn( 1 ) + if (!( src.line1 )) + del(S) + else + src.line1.process_signal(S, src) + return + + + + items + wire + diff --git a/code/help/excode_reference.dm b/code/help/excode_reference.dm new file mode 100644 index 0000000..8b9110e --- /dev/null +++ b/code/help/excode_reference.dm @@ -0,0 +1,199 @@ +mob + var + tmp + reference_shown = 0 + verb + ExCode_Reference() + set category = "Help" + var/yy = 1 + if(!reference_shown) + for(var/Reference/Excode/E in Reference_List) + src << output("[E.title]","excode_reference.topic_grid:1,[yy]") + yy++ + reference_shown = 1 + winshow(src,"excode_reference",1) + + +var + list + Reference_List = list() + +world + New() + ..() + var/Reference/Excode/exref = new() + exref.BuildReference() +Reference + var + title + format + arguments + extra_content + Excode + Topic(href,href_list[]) + if(href_list["action"] == "show") + var/argument_display + var/list/arg_list = params2list(arguments) + for(var/A in arg_list) + argument_display += " [A]
" + usr << output(null,"excode_reference.reference_output") + usr << output("[title]

Format: [format]

Arguments:
[argument_display]
[extra_content]","excode_reference.reference_output") + proc + BuildReference() + var/list/n_list = InfoList() + for(var/Reference/Excode/E in n_list) + if(E.title&&E.format&&E.arguments&&E.extra_content) + Reference_List += E + InfoList() + var/list/r_list = list() + for(var/E in typesof(/Reference/Excode)-/Reference/Excode) + var/Reference/Excode/ne = new E + r_list += ne + return r_list + + GetInfo(Reference/Excode/topic) + if(!topic) return 0 + + args + title = "args" + format = "args;variable" + arguments = "variable: The variable to dump the program's entire argument string into." + extra_content = "The args function allows you to get the program arguments in a simple string format (arg1 arg2 arg3 etc...)" + ascii + title = "ascii" + format = "ascii;variable;string" + arguments = "variable: The variable you want to dump your results to;string: The string you want to convert into a number." + extra_content = "The ascii function allows you to convert ascii strings into their number counterpart." + char + title = "char" + format = "char;variable;number" + arguments = "variable: The variable you want to dump your results to;number: The number you wish to convert." + extra_content = "The char function allows you to convert a number into its ascii counterpart." + + ckey + title = "ckey" + format = "ckey;var_string;var_result" + arguments = "var_string: The variable containing the string you want to convert.;var_result: The variable to dump your results." + extra_content = "The ckey function allows you to convert a variable into its canonical form. Eg: 'Hello World!' becomes 'helloworld'" + + comment + title = "comment" + format = "comment;string" + arguments = "string: The string you want to comment out." + extra_content = "The comment function allows you to comment your code, commented code is ignored by the parser." + + copytext + title = "copytext" + format = "copytext;variable;string;start;end" + arguments = "variable: The variable to dump the results;string: The string to cut.;start: Where to start cutting;end: Where to end cutting." + extra_content = "The copytext function allows you to take a string, cut a portion out of it and dump the portion into another variable." + + dumpfile + title = "dumpfile" + format = "dumpfile;path;variable" + arguments = "path: The file path (location) of the file.;variable: The variable to dump the file content to." + extra_content = "The dumpfile function allows you to dump the contents of a file into a variable." + + dumppath + title = "dumppath" + format = "dumppath;file;variable" + arguments = "file: The file handler (obtained with getfile) variable.;variable: The variable to dump the path to." + extra_content = "The dumppath function allows you to dump the path of a file handler into another variable." + echo_var + title = "echo_var" + format = "echo_var;variable" + arguments = "variable: The variable you want to echo." + extra_content = "The echo_var function allows you to easily echo the value of a variable, helpful for quick debugging." + end + title = "end" + format = "end;err_level" + arguments = "err_level: Sets the system err_level to the given value." + extra_content = "The end function will terminate your program as soon as the function is called and set err_level." + eval + title = "eval" + format = "eval;variable;operation;value" + arguments = "variable: The variable you want to change.;operation: The mathematical operation you want to perform (+=,-=,*=,/*,++,--);value: The value you want to alter the variable with." + extra_content = "The eval function allows you to perform mathematical operations on a variable, you can also use it to append a string to another string." + findtext + title = "findtext" + format = "findtext;variable;string;find;start;end" + arguments = "variable: The variable to dump your result.;string: The string to search.;find: The string to look for.;start: The starting point to look from (default: 1);end: The last point to look at (default: string.length+1)" + extra_content = "The findtext function allows you to return the position of the first instance of a string within another string." + getenv + title = "getenv" + format = "getenv;environment_var;variable" + arguments = "environment_var: The environment variable to get the value of.;variable: The variable to dump the results to." + extra_content = "The getenv function allows you to get the value of one of the system's environment variables.
(If only a single argument is supplied a list of environment variables will be dumped into the variable given as the single argument)" + getfile + title = "getfile" + format = "getfile;variable;path" + arguments = "variable: The variable to dump the file handler.;path: The path to the file." + extra_content = "The getfile function allows you to create a file handler variable which allows you to easily write to a file using the eval function." + goto_stuff + title = "goto" + format = "goto;id" + arguments = "id: The id you wish to send your code to." + extra_content = "The goto function allows you to skip around your code by moving between various set id's." + id + title = "id" + format = "id;string" + arguments = "string: The name of the id you want to set." + extra_content = "The id function allows you to set id's in your code to move to in various cases." + if_stuff + title = "if" + format = "if;variable;condition;other_variable;id" + arguments = "variable: The variable or string to check;condition: The conditional expression to use (>,>=,<,<=,==,!=);other_variable: The variable or string to check against.;id: The id to go to if the condition passes." + extra_content = "The if function (or statement) works much like any other language, it checks one thing against another, and if the condition is met it goes to a certain id in your code." + init_list + title = "init_list" + length + title = "length" + format = "length;variable;other_variable" + arguments = "variable: The variable you want to dump the length into.;other_variable: The variable you want to check the length of" + extra_content = "The length function allows you to check the length of a string or list." + list_moveup + title = "list_moveup" + lowertext + title = "lowertext" + format = "lowertext;variable;other_variable" + arguments = "variable: The variable to change.;other_variable: The variable to dump your results." + extra_content = "The lowertext function allows you to change a string into its lower-case form." + md5 + title = "md5" + format = "md5;variable;other_variable" + arguments = "variable: The variable to hash.;other_variable: The variable to put the results." + extra_content = "The md5 function allows you to hash a string or variable using the md5 system." + rand_stuff + title = "rand" + format = "rand;lbound;ubound;variable" + arguments = "lbound: The lowest the random number can be.;ubound: The highest the random number can be.;variable: The variable to dump the result." + extra_content = "The rand function allows you to generate a random number within a specified range." + replacetext + title = "replacetext" + format = "replacetext;variable;string;needle;replacement" + arguments = "variable: The variable to dump the result.;string: The string to search.;needle: The string to locate.;replacement: The string to replace needle with." + extra_content = "(I know, it's weird-formatted, didn't want to break old code) The replacetext function allows to to find and replace a string within a string." + set_stuff + title = "set" + format = "set;variable;value" + arguments = "variable: The variable you want to change.;value: The new value of the variable." + extra_content = "The set function allows you to set the value of a variable." + setenv + title = "setenv" + format = "setenv;variable;value" + arguments = "variable: The environment variable you want to change/add.;value: The value of the variable." + extra_content = "The setenv function allows you to set and remove environment variable, using a value of null will remove the variable. (Note: Variables are stripped of non-standard characters excluding - and _)" + shell + title = "shell" + format = "shell;command" + arguments = "command: The command you want to execute." + extra_content = "The shell function allows you to execute commands directly at console-level." + uppertext + title = "uppertext" + format = "uppertext;variable;other_variable" + arguments = "variable: The variable you want to change.;other_variable: The variable to dump the result." + extra_content = "The uppertext function allows you to change a string into its upper-case form." + + + + diff --git a/code/help/router.dm b/code/help/router.dm new file mode 100644 index 0000000..30109ae --- /dev/null +++ b/code/help/router.dm @@ -0,0 +1,7 @@ +mob + verb + RouterHelp() + set category = "Help" + usr << browse_rsc('tut/router.swf',"router.swf") + usr << output("