-
Notifications
You must be signed in to change notification settings - Fork 2
/
laptop.dm
62 lines (59 loc) · 1.55 KB
/
laptop.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
obj/item/laptop
name = "Laptop"
icon = 'laptop.dmi'
icon_state = "laptop_0"
var/datum/os/OS
var/on = 0
var/mob/console_user
var/address
var/obj/machinery/router/R
obj/item/laptop/New()
..()
address = 0
OS = new(src)
processing_items.Add(src) // Do this
// spawn while(1)
// sleep(10) / You don't want to do this like this.
// process()
/obj/item/laptop/proc/get_routers()
. = list()
for(var/obj/machinery/router/R in range(20,src.loc))
. += R
return .
obj/item/laptop/proc/receive_packet(var/obj/machinery/sender, var/datum/function/P)
if(P.name == "response")
OS.receive_message(P.arg1)
if(P.name == "MSG")
OS.receive_message(P.arg1)
if(P.name == "who")
var/datum/function/R = new()
R.name = "response"
R.arg1 = ""
for(var/obj/machinery/router/Ro in get_routers())
R.arg1 += "[ip2text(Ro.address)]\tRouter\n"
R.source_id = address
R.destination_id = P.source_id
receive_packet(src, R)
obj/item/laptop/proc/updateicon()
icon_state = "laptop_[on]"
obj/item/laptop/attack_self(mob/user as mob)
if(!on)
on = 1
user.display_console(src)
else
user.hide_console()
on = 0
return
// DO MORE SHIT HERE
obj/item/laptop/process()
// world << "LAPTOP TICK"
if(console_user) if(!(console_user in range(1,src.loc)) || winget(console_user.client, "console", "is-visible") == "false")
console_user.hide_console()
if(OS)
for(var/mob/A in OS.mob_users)
if(!(A in range(1,src)) || winget(A.client, "console", "is-visible") == "false")
A.hide_console()
obj/item/laptop/verb/reboot()
set name = "Reboot"
set src in view(1)
OS.reboot()