Just some general cleanup

Moved the spacecraft folder into the unused section, moved syndiebeacon into machinery.
Research moved into Modules.
Virus2 moved into WIP - is anyone even working on this, it looks almost done?
Computer2,optics,pda2,experimental moved unto unused.
WIP Chemistry things moved into Chemical Module
Cameras.dm moved into weapons
GameKit.dm moved into unused
BrokenInHands.dm moved into unused
Removed Grillify.dm
Moved all of the files listed as unused in the mining module to unused
Removed several empty folders in modules
Moved cloning.dm into machinery
Moved NewBan.dm into admin
Changed humanoid aliens new_life.dm into life.dm
Moved beast mob into unused
Moved hivebot into unused
Moved carpedexplosion.dm into unused
Moved ai_lockdown.dm verb into unused and removed it from the AIs verb list as it didn't actually do anything.
Removed mastercontroler2.dm
Moved savefile.dm from human to new_player

Bugfix
People spawning on the starting screen on rev/cult should be fixed.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1964 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
mport2004@gmail.com
2011-07-31 21:31:00 +00:00
parent ce470a81ba
commit 2224916ab9
94 changed files with 608 additions and 1126 deletions

View File

@@ -0,0 +1,36 @@
/proc/getbrokeninhands()
var/icon/IL = new('items_lefthand.dmi')
var/list/Lstates = IL.IconStates()
var/icon/IR = new('items_righthand.dmi')
var/list/Rstates = IR.IconStates()
var/text
for(var/A in typesof(/obj/item))
var/obj/item/O = new A( locate(1,1,1) )
if(!O) continue
var/icon/J = new(O.icon)
var/list/istates = J.IconStates()
if(!Lstates.Find(O.icon_state) && !Lstates.Find(O.item_state))
if(O.icon_state)
text += "[O.type] WANTS IN LEFT HAND CALLED\n\"[O.icon_state]\".\n"
if(!Rstates.Find(O.icon_state) && !Rstates.Find(O.item_state))
if(O.icon_state)
text += "[O.type] WANTS IN RIGHT HAND CALLED\n\"[O.icon_state]\".\n"
if(O.icon_state)
if(!istates.Find(O.icon_state))
text += "[O.type] MISSING NORMAL ICON CALLED\n\"[O.icon_state]\" IN \"[O.icon]\"\n"
if(O.item_state)
if(!istates.Find(O.item_state))
text += "[O.type] MISSING NORMAL ICON CALLED\n\"[O.item_state]\" IN \"[O.icon]\"\n"
text+="\n"
del(O)
if(text)
var/F = file("broken_icons.txt")
fdel(F)
F << text
world << "Completely successfully and written to [F]"

View File

@@ -0,0 +1,60 @@
/mob/living/silicon/ai/proc/lockdown()
set category = "AI Commands"
set name = "Lockdown"
if(usr.stat == 2)
usr <<"You cannot initiate lockdown because you are dead!"
return
src << "<b>Initiating lockdowns has been disabled due to system stress.</b>"
// Commented this out to disable Lockdowns -- TLE
/* world << "\red Lockdown initiated by [usr.name]!"
for(var/obj/machinery/firealarm/FA in world) //activate firealarms
spawn( 0 )
if(FA.lockdownbyai == 0)
FA.lockdownbyai = 1
FA.alarm()
for(var/obj/machinery/door/airlock/AL in world) //close airlocks
spawn( 0 )
if(AL.canAIControl() && AL.icon_state == "door0" && AL.lockdownbyai == 0)
AL.close()
AL.lockdownbyai = 1
var/obj/machinery/computer/communications/C = locate() in world
if(C)
C.post_status("alert", "lockdown")
*/
/* src.verbs -= /mob/living/silicon/ai/proc/lockdown
src.verbs += /mob/living/silicon/ai/proc/disablelockdown
usr << "\red Disable lockdown command enabled!"
winshow(usr,"rpane",1)
*/
/mob/living/silicon/ai/proc/disablelockdown()
set category = "AI Commands"
set name = "Disable Lockdown"
if(usr.stat == 2)
usr <<"You cannot disable lockdown because you are dead!"
return
world << "\red Lockdown cancelled by [usr.name]!"
for(var/obj/machinery/firealarm/FA in world) //deactivate firealarms
spawn( 0 )
if(FA.lockdownbyai == 1)
FA.lockdownbyai = 0
FA.reset()
for(var/obj/machinery/door/airlock/AL in world) //open airlocks
spawn ( 0 )
if(AL.canAIControl() && AL.lockdownbyai == 1)
AL.open()
AL.lockdownbyai = 0
/* src.verbs -= /mob/living/silicon/ai/proc/disablelockdown
src.verbs += /mob/living/silicon/ai/proc/lockdown
usr << "\red Disable lockdown command removed until lockdown initiated again!"
winshow(usr,"rpane",1)
*/

View File

@@ -0,0 +1 @@
mob/living/carbon/beast

View File

@@ -0,0 +1,15 @@
datum/bodypart
var
name = "unidentified bodypart"
health = 50
datum/bodypart/body
health = 100
datum/bodypart/head
health = 30
datum/bodypart/limb
datum/bodypart/tail
health = 15

View File

@@ -0,0 +1,13 @@
/*
var/mob/dead/phantasm/P = new (src.loc)
for(var/obj/O in src.contents) // Where src is a mob
if(istype(O, /obj/item)) // Only remember carried items (sanity checking, mostly)
src.u_equip(O) // Unequip the item if we're wearing it
if (src.client)
src.client.screen -= O // Clear out any overlays the item added, notably in the equip windows
O.loc = src.loc // Honestly not sure if these two steps are necessary
O.dropped(src) // but they seem to occur everywhere else in the code, so we're not taking any chances.
O.layer = initial(O.layer)
O.loc = P // Add the item to the phantasm's inventory
src.Death(0)
*/

View File

@@ -0,0 +1,83 @@
/proc/carpetsplosion(turf/location as turf,range = 10)
var/obj/effects/spreader/spreadEpicentre = new /obj/effects/spreader(location,range)
var/list/turf/spreadTurfs = list()
sleep(5)
for(var/obj/effects/spreader/spread in spreadEpicentre.spreadList)
spreadTurfs += get_turf(spread)
del(spreadEpicentre)
return
//DEBUG START
/obj/carpetnade
New()
..()
carpetsplosion(loc)
//DEBUG END
/obj/effects/spreader
var/list/obj/effects/spreader/spreadList = list()
/obj/effects/spreader/Del()
for(var/obj/effects/spreader/spread in spreadList)
if(spread != src)
del(spread)
..()
/obj/effects/spreader/New(location,var/amount = 1,obj/effects/spreader/source = src) //just a copypaste job from foam
if(amount <= 0)
del(src)
return
else
..()
for(var/direction in cardinal)
var/turf/T = get_step(src,direction)
if(!T)
continue
if(!T.Enter(src))
continue
var/obj/effects/spreader/S = locate() in T
if(S)
continue
new /obj/effects/spreader(T,amount-1,source)
source.spreadList += src
/*
/obj/effects/foam/proc/process()
if(--amount < 0)
return
while(expand) // keep trying to expand while true
for(var/direction in cardinal)
var/turf/T = get_step(src,direction)
if(!T)
continue
if(!T.Enter(src))
continue
var/obj/effects/foam/F = locate() in T
if(F)
continue
F = new(T, metal)
F.amount = amount
if(!metal)
F.create_reagents(10)
if (reagents)
for(var/datum/reagent/R in reagents.reagent_list)
F.reagents.add_reagent(R.id,1)
sleep(15)
*/

View File

@@ -0,0 +1,60 @@
/datum/computer/file/computer_program/airlock_control
name = "Airlock Master"
size = 16.0
id_tag = "TAG"
return_text()
if(..())
return
var/dat = "<a href='byond://?src=\ref[src];close=1'>Close</a> | "
dat += "<a href='byond://?src=\ref[src];quit=1'>Quit</a>"
/*
dat += "<br><TT>Frequency: "
dat += "<a href='?src=\ref[src];adj_freq=-10'>--</a> "
dat += "<a href='?src=\ref[src];adj_freq=-2'>-</a> "
dat += "[format_frequency(src.master.frequency)] "
dat += "<a href='?src=\ref[src];adj_freq=2'>+</a> "
dat += "<a href='?src=\ref[src];adj_freq=10'>++</a>"
dat += "</TT><br>"
*/
dat += "<br>ID:<a href='byond://?src=\ref[src];set_tag=1'>[src.id_tag]</a><br>"
dat += "<a href='byond://?src=\ref[src];send_command=cycle'>Cycle</a>"
dat += "</b></center>"
return dat
Topic(href, href_list)
if(..())
return
if(href_list["set_tag"])
var/t = input(usr, "Please enter new tag", src.id_tag, null) as text
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if (!t)
return
if (!in_range(src.master, usr))
return
src.id_tag = t
// if(href_list["adj_freq"])
// var/new_frequency = (src.master.frequency + text2num(href_list["adj_freq"]))
// src.master.set_frequency(new_frequency)
if(href_list["send_command"])
var/datum/signal/signal = new
signal.data["tag"] = id_tag
signal.data["command"] = href_list["send_command"]
peripheral_command("send signal", signal)
src.master.add_fingerprint(usr)
src.master.updateUsrDialog()
return

View File

@@ -0,0 +1,136 @@
/datum/computer/file/computer_program/arcade
name = "Arcade 500"
size = 8.0
var/enemy_name = "Space Villian"
var/temp = "Winners Don't Use Spacedrugs" //Temporary message, for attack messages, etc
var/player_hp = 30 //Player health/attack points
var/player_mp = 10
var/enemy_hp = 45 //Enemy health/attack points
var/enemy_mp = 20
var/gameover = 0
var/blocked = 0 //Player cannot attack/heal while set
New(obj/holding as obj)
if(holding)
src.holder = holding
if(istype(src.holder.loc,/obj/machinery/computer2))
src.master = src.holder.loc
// var/name_action = pick("Defeat ", "Annihilate ", "Save ", "Strike ", "Stop ", "Destroy ", "Robust ", "Romance ")
var/name_part1 = pick("the Automatic ", "Farmer ", "Lord ", "Professor ", "the Evil ", "the Dread King ", "the Space ", "Lord ")
var/name_part2 = pick("Melonoid", "Murdertron", "Sorcerer", "Ruin", "Jeff", "Ectoplasm", "Crushulon")
src.enemy_name = dd_replacetext((name_part1 + name_part2), "the ", "")
// src.name = (name_action + name_part1 + name_part2)
/datum/computer/file/computer_program/arcade/return_text()
if(..())
return
var/dat = "<a href='byond://?src=\ref[src];close=1'>Close</a> | "
dat += "<a href='byond://?src=\ref[src];quit=1'>Quit</a>"
dat += "<center><h4>[src.enemy_name]</h4></center>"
dat += "<br><center><h3>[src.temp]</h3></center>"
dat += "<br><center>Health: [src.player_hp] | Magic: [src.player_mp] | Enemy Health: [src.enemy_hp]</center>"
if (src.gameover)
dat += "<center><b><a href='byond://?src=\ref[src];newgame=1'>New Game</a>"
else
dat += "<center><b><a href='byond://?src=\ref[src];attack=1'>Attack</a> | "
dat += "<a href='byond://?src=\ref[src];heal=1'>Heal</a> | "
dat += "<a href='byond://?src=\ref[src];charge=1'>Recharge Power</a>"
dat += "</b></center>"
return dat
/datum/computer/file/computer_program/arcade/Topic(href, href_list)
if(..())
return
if (!src.blocked)
if (href_list["attack"])
src.blocked = 1
var/attackamt = rand(2,6)
src.temp = "You attack for [attackamt] damage!"
src.master.updateUsrDialog()
sleep(10)
src.enemy_hp -= attackamt
src.arcade_action()
else if (href_list["heal"])
src.blocked = 1
var/pointamt = rand(1,3)
var/healamt = rand(6,8)
src.temp = "You use [pointamt] magic to heal for [healamt] damage!"
src.master.updateUsrDialog()
sleep(10)
src.player_mp -= pointamt
src.player_hp += healamt
src.blocked = 1
src.master.updateUsrDialog()
src.arcade_action()
else if (href_list["charge"])
src.blocked = 1
var/chargeamt = rand(4,7)
src.temp = "You regain [chargeamt] points"
src.player_mp += chargeamt
src.master.updateUsrDialog()
sleep(10)
src.arcade_action()
if (href_list["newgame"]) //Reset everything
temp = "New Round"
player_hp = 30
player_mp = 10
enemy_hp = 45
enemy_mp = 20
gameover = 0
src.master.add_fingerprint(usr)
src.master.updateUsrDialog()
return
/datum/computer/file/computer_program/arcade/proc/arcade_action()
if ((src.enemy_mp <= 0) || (src.enemy_hp <= 0))
src.gameover = 1
src.temp = "[src.enemy_name] has fallen! Rejoice!"
src.peripheral_command("vend prize")
else if ((src.enemy_mp <= 5) && (prob(70)))
var/stealamt = rand(2,3)
src.temp = "[src.enemy_name] steals [stealamt] of your power!"
src.player_mp -= stealamt
src.master.updateUsrDialog()
if (src.player_mp <= 0)
src.gameover = 1
sleep(10)
src.temp = "You have been drained! GAME OVER"
else if ((src.enemy_hp <= 10) && (src.enemy_mp > 4))
src.temp = "[src.enemy_name] heals for 4 health!"
src.enemy_hp += 4
src.enemy_mp -= 4
else
var/attackamt = rand(3,6)
src.temp = "[src.enemy_name] attacks for [attackamt] damage!"
src.player_hp -= attackamt
if ((src.player_mp <= 0) || (src.player_hp <= 0))
src.gameover = 1
src.temp = "You have been crushed! GAME OVER"
src.blocked = 0
return

View File

@@ -0,0 +1,263 @@
/datum/computer
var/size = 4.0
var/obj/item/weapon/disk/data/holder = null
var/datum/computer/folder/holding_folder = null
folder
name = "Folder"
size = 0.0
var/gen = 0
Del()
for(var/datum/computer/F in src.contents)
del(F)
..()
proc
add_file(datum/computer/R)
if(!holder || holder.read_only || !R)
return 0
if(istype(R,/datum/computer/folder) && (src.gen>=10))
return 0
if((holder.file_used + R.size) <= holder.file_amount)
src.contents.Add(R)
R.holder = holder
R.holding_folder = src
src.holder.file_used -= src.size
src.size += R.size
src.holder.file_used += src.size
if(istype(R,/datum/computer/folder))
R:gen = (src.gen+1)
return 1
return 0
remove_file(datum/computer/R)
if(holder && !holder.read_only || !R)
// world << "Removing file [R]. File_used: [src.holder.file_used]"
src.contents.Remove(R)
src.holder.file_used -= src.size
src.size -= R.size
src.holder.file_used += src.size
src.holder.file_used = max(src.holder.file_used, 0)
// world << "Removed file [R]. File_used: [src.holder.file_used]"
return 1
return 0
file
name = "File"
var/extension = "FILE" //Differentiate between types of files, why not
proc
copy_file_to_folder(datum/computer/folder/newfolder)
if(!newfolder || (!istype(newfolder)) || (!newfolder.holder) || (newfolder.holder.read_only))
return 0
if((newfolder.holder.file_used + src.size) <= newfolder.holder.file_amount)
var/datum/computer/file/newfile = new src.type
for(var/V in src.vars)
if (issaved(src.vars[V]) && V != "holder")
newfile.vars[V] = src.vars[V]
if(!newfolder.add_file(newfile))
del(newfile)
return 1
return 0
Del()
if(holder && holding_folder)
holding_folder.remove_file(src)
..()
/datum/computer/file/computer_program
name = "blank program"
extension = "PROG"
//var/size = 4.0
//var/obj/item/weapon/disk/data/holder = null
var/obj/machinery/computer2/master = null
var/active_icon = null
var/id_tag = null
var/list/req_access = list()
New(obj/holding as obj)
if(holding)
src.holder = holding
if(istype(src.holder.loc,/obj/machinery/computer2))
src.master = src.holder.loc
Del()
if(master)
master.processing_programs.Remove(src)
..()
proc
return_text()
if((!src.holder) || (!src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(master.stat & (NOPOWER|BROKEN))
return 1
if(!(holder in src.master.contents))
//world << "Holder [holder] not in [master] of prg:[src]"
if(master.active_program == src)
master.active_program = null
return 1
if(!src.holder.root)
src.holder.root = new /datum/computer/folder
src.holder.root.holder = src
src.holder.root.name = "root"
return 0
process()
if((!src.holder) || (!src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(!(holder in src.master.contents))
if(master.active_program == src)
master.active_program = null
master.processing_programs.Remove(src)
return 1
if(!src.holder.root)
src.holder.root = new /datum/computer/folder
src.holder.root.holder = src
src.holder.root.name = "root"
return 0
receive_command(obj/source, command, datum/signal/signal)
if((!src.holder) || (!src.master) || (!source) || (source != src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(master.stat & (NOPOWER|BROKEN))
return 1
if(!(holder in src.master.contents))
if(master.active_program == src)
master.active_program = null
return 1
return 0
peripheral_command(command, datum/signal/signal)
if(master)
master.send_command(command, signal)
else
del(signal)
transfer_holder(obj/item/weapon/disk/data/newholder,datum/computer/folder/newfolder)
if((newholder.file_used + src.size) > newholder.file_amount)
return 0
if(!newholder.root)
newholder.root = new /datum/computer/folder
newholder.root.holder = newholder
newholder.root.name = "root"
if(!newfolder)
newfolder = newholder.root
if((src.holder && src.holder.read_only) || newholder.read_only)
return 0
if((src.holder) && (src.holder.root))
src.holder.root.remove_file(src)
newfolder.add_file(src)
if(istype(newholder.loc,/obj/machinery/computer2))
src.master = newholder.loc
//world << "Setting [src.holder] to [newholder]"
src.holder = newholder
return 1
//Check access per program.
allowed(mob/M)
//check if it doesn't require any access at all
if(src.check_access(null))
return 1
if(istype(M, /mob/living/silicon))
//AI can do whatever he wants
return 1
else if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
//if they are holding or wearing a card that has access, that works
if(src.check_access(H.equipped()) || src.check_access(H.wear_id))
return 1
else if(istype(M, /mob/living/carbon/monkey))
var/mob/living/carbon/monkey/george = M
//they can only hold things :(
if(george.equipped() && istype(george.equipped(), /obj/item/weapon/card/id) && src.check_access(george.equipped()))
return 1
return 0
check_access(obj/item/weapon/card/id/I)
if(!src.req_access) //no requirements
return 1
if(!istype(src.req_access, /list)) //something's very wrong
return 1
var/list/L = src.req_access
if(!L.len) //no requirements
return 1
if(!I || !istype(I, /obj/item/weapon/card/id) || !I.access) //not ID or no access
return 0
for(var/req in src.req_access)
if(!(req in I.access)) //doesn't have this access
return 0
return 1
Topic(href, href_list)
if((!src.holder) || (!src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(master.stat & (NOPOWER|BROKEN))
return 1
if(src.master.active_program != src)
return 1
if ((!usr.contents.Find(src.master) && (!in_range(src.master, usr) || !istype(src.master.loc, /turf))) && (!istype(usr, /mob/living/silicon)))
return 1
if(!(holder in src.master.contents))
if(master.active_program == src)
master.active_program = null
return 1
usr.machine = src.master
if (href_list["close"])
usr.machine = null
usr << browse(null, "window=comp2")
return 0
if (href_list["quit"])
// src.master.processing_programs.Remove(src)
if(src.master.host_program && src.master.host_program.holder && (src.master.host_program.holder in src.master.contents))
src.master.run_program(src.master.host_program)
src.master.updateUsrDialog()
return 1
else
src.master.active_program = null
src.master.updateUsrDialog()
return 1
return 0

View File

@@ -0,0 +1,150 @@
//Motherboard is just used in assembly/disassembly, doesn't exist in the actual computer object.
/obj/item/weapon/motherboard
name = "Computer mainboard"
desc = "A computer motherboard."
icon = 'module.dmi'
icon_state = "mainboard"
item_state = "electronic"
w_class = 3
var/created_name = null //If defined, result computer will have this name.
/obj/computer2frame
density = 1
anchored = 0
name = "Computer-frame"
icon = 'stock_parts.dmi'
icon_state = "0"
var/state = 0
var/obj/item/weapon/motherboard/mainboard = null
var/obj/item/weapon/disk/data/fixed_disk/hd = null
var/list/peripherals = list()
var/created_icon_state = "aiupload"
/obj/computer2frame/attackby(obj/item/P as obj, mob/user as mob)
switch(state)
if(0)
if(istype(P, /obj/item/weapon/wrench))
playsound(src.loc, 'Ratchet.ogg', 50, 1)
if(do_after(user, 20))
user << "\blue You wrench the frame into place."
src.anchored = 1
src.state = 1
if(istype(P, /obj/item/weapon/weldingtool))
playsound(src.loc, 'Welder.ogg', 50, 1)
if(do_after(user, 20))
user << "\blue You deconstruct the frame."
new /obj/item/stack/sheet/metal( src.loc, 5 )
del(src)
if(1)
if(istype(P, /obj/item/weapon/wrench))
playsound(src.loc, 'Ratchet.ogg', 50, 1)
if(do_after(user, 20))
user << "\blue You unfasten the frame."
src.anchored = 0
src.state = 0
if(istype(P, /obj/item/weapon/motherboard) && !mainboard)
playsound(src.loc, 'Deconstruct.ogg', 50, 1)
user << "\blue You place the mainboard inside the frame."
src.icon_state = "1"
src.mainboard = P
user.drop_item()
P.loc = src
if(istype(P, /obj/item/weapon/screwdriver) && mainboard)
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "\blue You screw the mainboard into place."
src.state = 2
src.icon_state = "2"
if(istype(P, /obj/item/weapon/crowbar) && mainboard)
playsound(src.loc, 'Crowbar.ogg', 50, 1)
user << "\blue You remove the mainboard."
src.state = 1
src.icon_state = "0"
mainboard.loc = src.loc
src.mainboard = null
if(2)
if(istype(P, /obj/item/weapon/screwdriver) && mainboard && (!peripherals.len))
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "\blue You unfasten the mainboard."
src.state = 1
src.icon_state = "1"
if(istype(P, /obj/item/weapon/peripheral))
if(src.peripherals.len < 3)
user.drop_item()
src.peripherals.Add(P)
P.loc = src
user << "\blue You add [P] to the frame."
else
user << "\red There is no more room for peripheral cards."
if(istype(P, /obj/item/weapon/crowbar) && src.peripherals.len)
playsound(src.loc, 'Crowbar.ogg', 50, 1)
user << "\blue You remove the peripheral boards."
for(var/obj/item/weapon/peripheral/W in src.peripherals)
W.loc = src.loc
src.peripherals.Remove(W)
if(istype(P, /obj/item/weapon/cable_coil))
if(P:amount >= 5)
playsound(src.loc, 'Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
P:amount -= 5
if(!P:amount) del(P)
user << "\blue You add cables to the frame."
src.state = 3
src.icon_state = "3"
if(3)
if(istype(P, /obj/item/weapon/wirecutters))
playsound(src.loc, 'wirecutter.ogg', 50, 1)
user << "\blue You remove the cables."
src.state = 2
src.icon_state = "2"
var/obj/item/weapon/cable_coil/A = new /obj/item/weapon/cable_coil( src.loc )
A.amount = 5
if(src.hd)
src.hd.loc = src.loc
src.hd = null
if(istype(P, /obj/item/weapon/disk/data/fixed_disk) && !src.hd)
user.drop_item()
src.hd = P
P.loc = src
user << "\blue You connect the drive to the cabling."
if(istype(P, /obj/item/weapon/crowbar) && src.hd)
playsound(src.loc, 'Crowbar.ogg', 50, 1)
user << "\blue You remove the hard drive."
src.hd.loc = src.loc
src.hd = null
if(istype(P, /obj/item/stack/sheet/glass))
if(P:amount >= 2)
playsound(src.loc, 'Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
P:use(2)
user << "\blue You put in the glass panel."
src.state = 4
src.icon_state = "4"
if(4)
if(istype(P, /obj/item/weapon/crowbar))
playsound(src.loc, 'Crowbar.ogg', 50, 1)
user << "\blue You remove the glass panel."
src.state = 3
src.icon_state = "3"
new /obj/item/stack/sheet/glass( src.loc, 2 )
if(istype(P, /obj/item/weapon/screwdriver))
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "\blue You connect the monitor."
var/obj/machinery/computer2/C= new /obj/machinery/computer2( src.loc )
C.setup_drive_size = 0
C.icon_state = src.created_icon_state
if(mainboard.created_name) C.name = mainboard.created_name
del(mainboard)
if(hd)
C.hd = hd
hd.loc = C
for(var/obj/item/weapon/peripheral/W in src.peripherals)
W.loc = C
W.host = C
C.peripherals.Add(W)
del(src)

View File

@@ -0,0 +1,414 @@
/obj/machinery/computer2
name = "computer"
desc = "A computer workstation."
icon = 'computer.dmi'
icon_state = "aiupload"
density = 1
anchored = 1.0
req_access = list() //This doesn't determine PROGRAM req access, just the access needed to install/delete programs.
var/base_icon_state = "aiupload" //Assembly creates a new computer2 and not a child typepath, so initial doesn't work!!
var/datum/radio_frequency/radio_connection
var/obj/item/weapon/disk/data/fixed_disk/hd = null
var/datum/computer/file/computer_program/active_program
var/datum/computer/file/computer_program/host_program //active is set to this when the normal active quits, if available
var/list/processing_programs = list()
var/obj/item/weapon/card/id/authid = null //For records computers etc
var/obj/item/weapon/card/id/auxid = null //For computers that need two ids for some reason.
var/obj/item/weapon/disk/data/diskette = null
var/list/peripherals = list()
//Setup for Starting program & peripherals
var/setup_starting_program = null //If set to a program path it will start with this one active.
var/setup_starting_peripheral = null //Spawn with radio card and whatever path is here.
var/setup_drive_size = 64.0 //How big is the drive (set to 0 for no drive)
var/setup_id_tag
var/setup_has_radio = 0 //Does it spawn with a radio peripheral?
var/setup_radio_tag
var/setup_frequency = 1411
/obj/item/weapon/disk/data
var/datum/computer/folder/root = null
var/file_amount = 32.0
var/file_used = 0.0
var/portable = 1
var/title = "Data Disk"
New()
src.root = new /datum/computer/folder
src.root.holder = src
src.root.name = "root"
/obj/item/weapon/disk/data/fixed_disk
name = "Storage Drive"
icon_state = "harddisk"
title = "Storage Drive"
file_amount = 80.0
portable = 0
attack_self(mob/user as mob)
return
/obj/item/weapon/disk/data/computer2test
name = "Programme Diskette"
file_amount = 128.0
New()
..()
src.root.add_file( new /datum/computer/file/computer_program/arcade(src))
src.root.add_file( new /datum/computer/file/computer_program/med_data(src))
src.root.add_file( new /datum/computer/file/computer_program/airlock_control(src))
src.root.add_file( new /datum/computer/file/computer_program/messenger(src))
src.root.add_file( new /datum/computer/file/computer_program/progman(src))
/obj/machinery/computer2/medical
name = "Medical computer"
icon_state = "dna"
setup_has_radio = 1
setup_starting_program = /datum/computer/file/computer_program/med_data
setup_starting_peripheral = /obj/item/weapon/peripheral/printer
/obj/machinery/computer2/arcade
name = "arcade machine"
icon_state = "arcade"
desc = "An arcade machine."
setup_drive_size = 16.0
setup_starting_program = /datum/computer/file/computer_program/arcade
setup_starting_peripheral = /obj/item/weapon/peripheral/prize_vendor
/obj/machinery/computer2/New()
..()
spawn(4)
if(setup_has_radio)
var/obj/item/weapon/peripheral/radio/radio = new /obj/item/weapon/peripheral/radio(src)
radio.frequency = setup_frequency
radio.code = setup_radio_tag
if(!hd && (setup_drive_size > 0))
src.hd = new /obj/item/weapon/disk/data/fixed_disk(src)
src.hd.file_amount = src.setup_drive_size
if(ispath(src.setup_starting_program))
src.active_program = new src.setup_starting_program
src.active_program.id_tag = setup_id_tag
src.hd.file_amount = max(src.hd.file_amount, src.active_program.size)
src.active_program.transfer_holder(src.hd)
if(ispath(src.setup_starting_peripheral))
new src.setup_starting_peripheral(src)
src.base_icon_state = src.icon_state
return
/obj/machinery/computer2/attack_hand(mob/user as mob)
if(..())
return
user.machine = src
var/dat
if((src.active_program) && (src.active_program.master == src) && (src.active_program.holder in src))
dat = src.active_program.return_text()
else
dat = "<TT><b>Thinktronic BIOS V1.4</b><br><br>"
dat += "Current ID: <a href='?src=\ref[src];id=auth'>[src.authid ? "[src.authid.name]" : "----------"]</a><br>"
dat += "Auxiliary ID: <a href='?src=\ref[src];id=aux'>[src.auxid ? "[src.auxid.name]" : "----------"]</a><br><br>"
var/progdat
if((src.hd) && (src.hd.root))
for(var/datum/computer/file/computer_program/P in src.hd.root.contents)
progdat += "<tr><td>[P.name]</td><td>Size: [P.size]</td>"
progdat += "<td><a href='byond://?src=\ref[src];prog=\ref[P];function=run'>Run</a></td>"
if(P in src.processing_programs)
progdat += "<td><a href='byond://?src=\ref[src];prog=\ref[P];function=unload'>Halt</a></td>"
else
progdat += "<td><a href='byond://?src=\ref[src];prog=\ref[P];function=load'>Load</a></td>"
progdat += "<td><a href='byond://?src=\ref[src];file=\ref[P];function=delete'>Del</a></td></tr>"
continue
dat += "Disk Space: \[[src.hd.file_used]/[src.hd.file_amount]\]<br>"
dat += "<b>Programs on Fixed Disk:</b><br>"
if(!progdat)
progdat = "No programs found.<br>"
dat += "<center><table cellspacing=4>[progdat]</table></center>"
else
dat += "<b>Programs on Fixed Disk:</b><br>"
dat += "<center>No fixed disk detected.</center><br>"
dat += "<br>"
progdat = null
if((src.diskette) && (src.diskette.root))
dat += "<font size=1><a href='byond://?src=\ref[src];disk=1'>Eject</a></font><br>"
for(var/datum/computer/file/computer_program/P in src.diskette.root.contents)
progdat += "<tr><td>[P.name]</td><td>Size: [P.size]</td>"
progdat += "<td><a href='byond://?src=\ref[src];prog=\ref[P];function=run'>Run</a></td>"
if(P in src.processing_programs)
progdat += "<td><a href='byond://?src=\ref[src];prog=\ref[P];function=unload'>Halt</a></td>"
else
progdat += "<td><a href='byond://?src=\ref[src];prog=\ref[P];function=load'>Load</a></td>"
progdat += "<td><a href='byond://?src=\ref[src];file=\ref[P];function=install'>Install</a></td></tr>"
continue
dat += "Disk Space: \[[src.diskette.file_used]/[src.diskette.file_amount]\]<br>"
dat += "<b>Programs on Disk:</b><br>"
if(!progdat)
progdat = "No data found.<br>"
dat += "<center><table cellspacing=4>[progdat]</table></center>"
else
dat += "<b>Programs on Disk:</b><br>"
dat += "<center>No diskette loaded.</center><br>"
dat += "</TT>"
user << browse(dat,"window=comp2")
onclose(user,"comp2")
return
/obj/machinery/computer2/Topic(href, href_list)
if(..())
return
if(!src.active_program)
if((href_list["prog"]) && (href_list["function"]))
var/datum/computer/file/computer_program/newprog = locate(href_list["prog"])
if(newprog && istype(newprog))
switch(href_list["function"])
if("run")
src.run_program(newprog)
if("load")
src.load_program(newprog)
if("unload")
src.unload_program(newprog)
if((href_list["file"]) && (href_list["function"]))
var/datum/computer/file/newfile = locate(href_list["file"])
if(!newfile)
return
switch(href_list["function"])
if("install")
if((src.hd) && (src.hd.root) && (src.allowed(usr)))
newfile.copy_file_to_folder(src.hd.root)
if("delete")
if(src.allowed(usr))
src.delete_file(newfile)
//If there is already one loaded eject, or if not and they have one insert it.
if (href_list["id"])
switch(href_list["id"])
if("auth")
if(!isnull(src.authid))
src.authid.loc = get_turf(src)
src.authid = null
else
var/obj/item/I = usr.equipped()
if (istype(I, /obj/item/weapon/card/id))
usr.drop_item()
I.loc = src
src.authid = I
if("aux")
if(!isnull(src.auxid))
src.auxid.loc = get_turf(src)
src.auxid = null
else
var/obj/item/I = usr.equipped()
if (istype(I, /obj/item/weapon/card/id))
usr.drop_item()
I.loc = src
src.auxid = I
//Same but for a data disk
else if (href_list["disk"])
if(!isnull(src.diskette))
src.diskette.loc = get_turf(src)
src.diskette = null
/* else
var/obj/item/I = usr.equipped()
if (istype(I, /obj/item/weapon/disk/data))
usr.drop_item()
I.loc = src
src.diskette = I
*/
src.add_fingerprint(usr)
src.updateUsrDialog()
return
/obj/machinery/computer2/process()
if(stat & (NOPOWER|BROKEN))
return
use_power(250)
for(var/datum/computer/file/computer_program/P in src.processing_programs)
P.process()
return
/obj/machinery/computer2/power_change()
if(stat & BROKEN)
icon_state = src.base_icon_state
src.icon_state += "b"
else if(powered())
icon_state = src.base_icon_state
stat &= ~NOPOWER
else
spawn(rand(0, 15))
icon_state = src.base_icon_state
src.icon_state += "0"
stat |= NOPOWER
/obj/machinery/computer2/attackby(obj/item/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/disk/data)) //INSERT SOME DISKETTES
if ((!src.diskette) && W:portable)
user.machine = src
user.drop_item()
W.loc = src
src.diskette = W
user << "You insert [W]."
src.updateUsrDialog()
return
else if (istype(W, /obj/item/weapon/screwdriver))
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
if(do_after(user, 20))
var/obj/computer2frame/A = new /obj/computer2frame( src.loc )
A.created_icon_state = src.base_icon_state
if (src.stat & BROKEN)
user << "\blue The broken glass falls out."
new /obj/item/weapon/shard( src.loc )
A.state = 3
A.icon_state = "3"
else
user << "\blue You disconnect the monitor."
A.state = 4
A.icon_state = "4"
for (var/obj/item/weapon/peripheral/C in src.peripherals)
C.loc = A
A.peripherals.Add(C)
if(src.diskette)
src.diskette.loc = src.loc
//TO-DO: move card reading to peripheral cards instead
if(src.authid)
src.authid.loc = src.loc
if(src.auxid)
src.auxid.loc = src.loc
if(src.hd)
src.hd.loc = A
A.hd = src.hd
A.mainboard = new /obj/item/weapon/motherboard(A)
A.mainboard.created_name = src.name
A.anchored = 1
del(src)
else
src.attack_hand(user)
return
/obj/machinery/computer2/proc/send_command(command, datum/signal/signal)
for(var/obj/item/weapon/peripheral/P in src.peripherals)
P.receive_command(src, command, signal)
del(signal)
/obj/machinery/computer2/proc/receive_command(obj/source, command, datum/signal/signal)
if(source in src.contents)
for(var/datum/computer/file/computer_program/P in src.processing_programs)
P.receive_command(src, command, signal)
del(signal)
return
/obj/machinery/computer2/proc/run_program(datum/computer/file/computer_program/program,datum/computer/file/computer_program/host)
if(!program)
return 0
// src.unload_program(src.active_program)
if(src.load_program(program))
if(host && istype(host))
src.host_program = host
else
src.host_program = null
src.active_program = program
return 1
return 0
/obj/machinery/computer2/proc/load_program(datum/computer/file/computer_program/program)
if((!program) || (!program.holder))
return 0
if(!(program.holder in src))
// world << "Not in src"
program = new program.type
program.transfer_holder(src.hd)
if(program.master != src)
program.master = src
if(program in src.processing_programs)
return 1
else
src.processing_programs.Add(program)
return 1
return 0
/obj/machinery/computer2/proc/unload_program(datum/computer/file/computer_program/program)
if((!program) || (!src.hd))
return 0
if(program in src.processing_programs)
src.processing_programs.Remove(program)
return 1
return 0
/obj/machinery/computer2/proc/delete_file(datum/computer/file/file)
//world << "Deleting [file]..."
if((!file) || (!file.holder) || (file.holder.read_only))
//world << "Cannot delete :("
return 0
if(file in src.processing_programs)
src.processing_programs.Remove(file)
if(src.active_program == file)
src.active_program = null
// file.holder.root.remove_file(file)
//world << "Now calling del on [file]..."
del(file)
return 1

View File

@@ -0,0 +1,164 @@
/datum/computer/file/computer_program/progman
name = "ProgManager"
size = 16.0
var/datum/computer/folder/current_folder
var/mode = 0
var/datum/computer/file/clipboard
return_text()
if(..())
return
if((!src.current_folder) || !(src.current_folder.holder in src.master))
src.current_folder = src.holder.root
var/dat = "<a href='byond://?src=\ref[src];close=1'>Close</a> | "
dat += "<a href='byond://?src=\ref[src];quit=1'>Quit</a>"
switch(mode)
if(0)
dat += " |<a href='byond://?src=\ref[src];create=folder'>Create Folder</a>"
//dat += " | <a href='byond://?src=\ref[src];create=file'>Create File</a>"
dat += " | <a href='byond://?src=\ref[src];file=\ref[src.current_folder];function=paste'>Paste</a>"
dat += " | <a href='byond://?src=\ref[src];top_folder=1'>Root</a>"
dat += " | <a href='byond://?src=\ref[src];mode=1'>Drive</a><br>"
dat += "<b>Contents of [current_folder] | Drive:\[[src.current_folder.holder.title]]</b><br>"
dat += "<b>Used: \[[src.current_folder.holder.file_used]/[src.current_folder.holder.file_amount]\]</b><hr>"
dat += "<table cellspacing=5>"
for(var/datum/computer/P in current_folder.contents)
if(P == src)
dat += "<tr><td>System</td><td>Size: [src.size]</td><td>SYSTEM</td></tr>"
continue
dat += "<tr><td><a href='byond://?src=\ref[src];file=\ref[P];function=open'>[P.name]</a></td>"
dat += "<td>Size: [P.size]</td>"
dat += "<td>[(istype(P,/datum/computer/folder)) ? "FOLDER" : "[P:extension]"]</td>"
dat += "<td><a href='byond://?src=\ref[src];file=\ref[P];function=delete'>Del</a></td>"
dat += "<td><a href='byond://?src=\ref[src];file=\ref[P];function=rename'>Rename</a></td>"
if(istype(P,/datum/computer/file))
dat += "<td><a href='byond://?src=\ref[src];file=\ref[P];function=copy'>Copy</a></td>"
dat += "</tr>"
dat += "</table>"
if(1)
dat += " | <a href='byond://?src=\ref[src];mode=0'>Main</a>"
dat += " | <a href='byond://?src=\ref[master];disk=1'>Eject</a><br>"
for(var/obj/item/weapon/disk/data/D in src.master)
if(D == current_folder.holder)
dat += "[D.name]<br>"
else
dat += "<a href='byond://?src=\ref[src];drive=\ref[D]'>[D.title]</a><br>"
return dat
Topic(href, href_list)
if(..())
return
if(href_list["create"])
if(current_folder)
var/datum/computer/F = null
switch(href_list["create"])
if("folder")
F = new /datum/computer/folder
if(!current_folder.add_file(F))
//world << "Couldn't add folder :("
del(F)
if("file")
F = new /datum/computer/file
if(!current_folder.add_file(F))
//world << "Couldn't add file :("
del(F)
if(href_list["file"] && href_list["function"])
var/datum/computer/F = locate(href_list["file"])
if(!F || !istype(F))
return
switch(href_list["function"])
if("open")
if(istype(F,/datum/computer/folder))
src.current_folder = F
else if(istype(F,/datum/computer/file/computer_program))
src.master.run_program(F,src)
src.master.updateUsrDialog()
return
if("delete")
src.master.delete_file(F)
if("copy")
if(istype(F,/datum/computer/file) && (!F.holder || (F.holder in src.master.contents)))
src.clipboard = F
if("paste")
if(istype(F,/datum/computer/folder))
if(!src.clipboard || !src.clipboard.holder || !(src.clipboard.holder in src.master.contents))
return
if(!istype(src.clipboard))
return
src.clipboard.copy_file_to_folder(F)
if("rename")
spawn(0)
var/t = input(usr, "Please enter new name", F.name, null) as text
t = copytext(sanitize(t), 1, 16)
if (!t)
return
if (!in_range(src.master, usr) || !(F.holder in src.master))
return
if(F.holder.read_only)
return
F.name = capitalize(lowertext(t))
src.master.updateUsrDialog()
return
/*
if(href_list["open"])
var/datum/computer/F = locate(href_list["open"])
if(!F || !istype(F))
return
if(istype(F,/datum/computer/folder))
src.current_folder = F
else if(istype(F,/datum/computer/file/computer_program))
src.master.run_program(F)
src.master.updateUsrDialog()
return
if(href_list["delete"])
var/datum/computer/F = locate(href_list["delete"])
if(!F || !istype(F))
return
src.master.delete_file(F)
*/
if(href_list["top_folder"])
src.current_folder = src.current_folder.holder.root
if(href_list["mode"])
var/newmode = text2num(href_list["mode"])
newmode = max(newmode,0)
src.mode = newmode
if(href_list["drive"])
var/obj/item/weapon/disk/data/D = locate(href_list["drive"])
if(D && istype(D) && D.root)
current_folder = D.root
src.mode = 0
src.master.add_fingerprint(usr)
src.master.updateUsrDialog()
return

View File

@@ -0,0 +1,463 @@
/datum/computer/file/computer_program/med_data
name = "Medical Records"
size = 32.0
active_icon = "dna"
req_access = list(access_medical)
var/authenticated = null
var/rank = null
var/screen = null
var/datum/data/record/active1 = null
var/datum/data/record/active2 = null
var/a_id = null
var/temp = null
/datum/computer/file/computer_program/med_data/return_text()
if(..())
return
var/dat
if (src.temp)
dat = text("<TT>[src.temp]</TT><BR><BR><A href='?src=\ref[src];temp=1'>Clear Screen</A>")
else
dat = text("Confirm Identity: <A href='?src=\ref[];id=auth'>[]</A><HR>", master, (src.master.authid ? text("[]", src.master.authid.name) : "----------"))
if (src.authenticated)
switch(src.screen)
if(1.0)
dat += {"
<A href='?src=\ref[src];search=1'>Search Records</A>
<BR><A href='?src=\ref[src];screen=2'>List Records</A>
<BR>
<BR><A href='?src=\ref[src];screen=5'>Virus Database</A>
<BR><A href='?src=\ref[src];screen=6'>Medbot Tracking</A>
<BR>
<BR><A href='?src=\ref[src];screen=3'>Record Maintenance</A>
<BR><A href='?src=\ref[src];logout=1'>{Log Out}</A><BR>
"}
if(2.0)
dat += "<B>Record List</B>:<HR>"
for(var/datum/data/record/R in data_core.general)
dat += text("<A href='?src=\ref[];d_rec=\ref[]'>[]: []<BR>", src, R, R.fields["id"], R.fields["name"])
//Foreach goto(132)
dat += text("<HR><A href='?src=\ref[];screen=1'>Back</A>", src)
if(3.0)
dat += text("<B>Records Maintenance</B><HR>\n<A href='?src=\ref[];back=1'>Backup To Disk</A><BR>\n<A href='?src=\ref[];u_load=1'>Upload From disk</A><BR>\n<A href='?src=\ref[];del_all=1'>Delete All Records</A><BR>\n<BR>\n<A href='?src=\ref[];screen=1'>Back</A>", src, src, src, src)
if(4.0)
dat += "<CENTER><B>Medical Record</B></CENTER><BR>"
if ((istype(src.active1, /datum/data/record) && data_core.general.Find(src.active1)))
dat += text("Name: [] ID: []<BR>\nSex: <A href='?src=\ref[];field=sex'>[]</A><BR>\nAge: <A href='?src=\ref[];field=age'>[]</A><BR>\nFingerprint: <A href='?src=\ref[];field=fingerprint'>[]</A><BR>\nPhysical Status: <A href='?src=\ref[];field=p_stat'>[]</A><BR>\nMental Status: <A href='?src=\ref[];field=m_stat'>[]</A><BR>", src.active1.fields["name"], src.active1.fields["id"], src, src.active1.fields["sex"], src, src.active1.fields["age"], src, src.active1.fields["fingerprint"], src, src.active1.fields["p_stat"], src, src.active1.fields["m_stat"])
else
dat += "<B>General Record Lost!</B><BR>"
if ((istype(src.active2, /datum/data/record) && data_core.medical.Find(src.active2)))
dat += text("<BR>\n<CENTER><B>Medical Data</B></CENTER><BR>\nBlood Type: <A href='?src=\ref[];field=b_type'>[]</A><BR>\n<BR>\nMinor Disabilities: <A href='?src=\ref[];field=mi_dis'>[]</A><BR>\nDetails: <A href='?src=\ref[];field=mi_dis_d'>[]</A><BR>\n<BR>\nMajor Disabilities: <A href='?src=\ref[];field=ma_dis'>[]</A><BR>\nDetails: <A href='?src=\ref[];field=ma_dis_d'>[]</A><BR>\n<BR>\nAllergies: <A href='?src=\ref[];field=alg'>[]</A><BR>\nDetails: <A href='?src=\ref[];field=alg_d'>[]</A><BR>\n<BR>\nCurrent Diseases: <A href='?src=\ref[];field=cdi'>[]</A> (per disease info placed in log/comment section)<BR>\nDetails: <A href='?src=\ref[];field=cdi_d'>[]</A><BR>\n<BR>\nImportant Notes:<BR>\n\t<A href='?src=\ref[];field=notes'>[]</A><BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>", src, src.active2.fields["b_type"], src, src.active2.fields["mi_dis"], src, src.active2.fields["mi_dis_d"], src, src.active2.fields["ma_dis"], src, src.active2.fields["ma_dis_d"], src, src.active2.fields["alg"], src, src.active2.fields["alg_d"], src, src.active2.fields["cdi"], src, src.active2.fields["cdi_d"], src, src.active2.fields["notes"])
var/counter = 1
while(src.active2.fields[text("com_[]", counter)])
dat += text("[]<BR><A href='?src=\ref[];del_c=[]'>Delete Entry</A><BR><BR>", src.active2.fields[text("com_[]", counter)], src, counter)
counter++
dat += text("<A href='?src=\ref[];add_c=1'>Add Entry</A><BR><BR>", src)
dat += text("<A href='?src=\ref[];del_r=1'>Delete Record (Medical Only)</A><BR><BR>", src)
else
dat += "<B>Medical Record Lost!</B><BR>"
dat += text("<A href='?src=\ref[src];new=1'>New Record</A><BR><BR>")
dat += text("\n<A href='?src=\ref[];print_p=1'>Print Record</A><BR>\n<A href='?src=\ref[];screen=2'>Back</A><BR>", src, src)
if(5.0)
dat += {"<CENTER><B>Virus Database</B></CENTER>
<br><a href='?src=\ref[src];vir=gbs'>GBS</a>
<br><a href='?src=\ref[src];vir=cc'>Common Cold</a>
<br><a href='?src=\ref[src];vir=f'>Flu</A>
<br><a href='?src=\ref[src];vir=jf'>Jungle Fever</a>
<br><a href='?src=\ref[src];vir=ca'>Clowning Around</a>
<br><a href='?src=\ref[src];vir=p'>Plasmatoid</a>
<br><a href='?src=\ref[src];vir=dna'>Space Rhinovirus</a>
<br><a href='?src=\ref[src];vir=bot'>Robot Transformation</a>
<br><a href='?src=\ref[src];screen=1'>Back</a>"}
if(6.0)
dat += "<center><b>Medical Robot Monitor</b></center>"
dat += "<a href='?src=\ref[src];screen=1'>Back</a>"
dat += "<br><b>Medical Robots:</b>"
var/bdat = null
for(var/obj/machinery/bot/medbot/M in world)
var/turf/bl = get_turf(M)
bdat += "[M.name] - <b>\[[bl.x],[bl.y]\]</b> - [M.on ? "Online" : "Offline"]<br>"
if(!isnull(M.reagent_glass))
bdat += "Reservoir: \[[M.reagent_glass.reagents.total_volume]/[M.reagent_glass.reagents.maximum_volume]\]"
else
bdat += "Using Internal Synthesizer."
if(!bdat)
dat += "<br><center>None detected</center>"
else
dat += "[bdat]"
else
else
dat += text("<A href='?src=\ref[];login=1'>{Log In}</A>", src)
dat += "<br><a href='byond://?src=\ref[src];quit=1'>{Quit}</a>"
return dat
/datum/computer/file/computer_program/med_data/Topic(href, href_list)
if(..())
return
if (!( data_core.general.Find(src.active1) ))
src.active1 = null
if (!( data_core.medical.Find(src.active2) ))
src.active2 = null
if (href_list["temp"])
src.temp = null
else if (href_list["logout"])
src.authenticated = null
src.screen = null
src.active1 = null
src.active2 = null
else if (href_list["login"])
if (istype(usr, /mob/living/silicon))
src.active1 = null
src.active2 = null
src.authenticated = 1
src.rank = "AI"
src.screen = 1
else if (istype(src.master.authid, /obj/item/weapon/card/id))
src.active1 = null
src.active2 = null
if (src.check_access(src.master.authid))
src.authenticated = src.master.authid.registered
src.rank = src.master.authid.assignment
src.screen = 1
if (src.authenticated)
if(href_list["screen"])
src.screen = text2num(href_list["screen"])
if(src.screen < 1)
src.screen = 1
src.active1 = null
src.active2 = null
if(href_list["vir"])
switch(href_list["vir"])
if("gbs")
src.temp = {"<b>Name:</b> GBS
<BR><b>Number of stages:</b> 5
<BR><b>Spread:</b> Airborne Transmission
<BR><b>Possible Cure:</b> Spaceacillin
<BR><b>Affected Species:</b> Human
<BR>
<BR><b>Notes:</b> If left untreated death will occur.
<BR>
<BR><b>Severity:</b> Major"}
if("cc")
src.temp = {"<b>Name:</b> Common Cold
<BR><b>Number of stages:</b> 3
<BR><b>Spread:</b> Airborne Transmission
<BR><b>Possible Cure:</b> Rest
<BR><b>Affected Species:</b> Human
<BR>
<BR><b>Notes:</b> If left untreated the subject will contract the flu.
<BR>
<BR><b>Severity:</b> Minor"}
if("f")
src.temp = {"<b>Name:</b> The Flu
<BR><b>Number of stages:</b> 3
<BR><b>Spread:</b> Airborne Transmission
<BR><b>Possible Cure:</b> Rest
<BR><b>Affected Species:</b> Human
<BR>
<BR><b>Notes:</b> If left untreated the subject will feel quite unwell.
<BR>
<BR><b>Severity:</b> Medium"}
if("jf")
src.temp = {"<b>Name:</b> Jungle Fever
<BR><b>Number of stages:</b> 1
<BR><b>Spread:</b> Airborne Transmission
<BR><b>Possible Cure:</b> None
<BR><b>Affected Species:</b> Monkey
<BR>
<BR><b>Notes:</b> Monkies with this disease will bite humans, causing humans to spontaneously to mutate into a monkey.
<BR>
<BR><b>Severity:</b> Medium"}
if("ca")
src.temp = {"<b>Name:</b> Clowning Around
<BR><b>Number of stages:</b> 4
<BR><b>Spread:</b> Airborne Transmission
<BR><b>Possible Cure:</b> Spaceacillin
<BR><b>Affected Species:</b> Human
<BR>
<BR><b>Notes:</b> Subjects are affected by rampant honking and a fondness for shenanigans. They may also spontaneously phase through closed airlocks.
<BR>
<BR><b>Severity:</b> Laughable"}
if("p")
src.temp = {"<b>Name:</b> Plasmatoid
<BR><b>Number of stages:</b> 3
<BR><b>Spread:</b> Airborne Transmission
<BR><b>Possible Cure:</b> Inaprovaline
<BR><b>Affected Species:</b> Human and Monkey
<BR>
<BR><b>Notes:</b> With this disease the victim will need plasma to breathe.
<BR>
<BR><b>Severity:</b> Major"}
if("dna")
src.temp = {"<b>Name:</b> Space Rhinovirus
<BR><b>Number of stages:</b> 4
<BR><b>Spread:</b> Airborne Transmission
<BR><b>Possible Cure:</b> Spaceacillin
<BR><b>Affected Species:</b> Human
<BR>
<BR><b>Notes:</b> This disease transplants the genetic code of the intial vector into new hosts.
<BR>
<BR><b>Severity:</b> Medium"}
if("bot")
src.temp = {"<b>Name:</b> Robot Transformation
<BR><b>Number of stages:</b> 5
<BR><b>Spread:</b> Infected food
<BR><b>Possible Cure:</b> None
<BR><b>Affected Species:</b> Human
<BR>
<BR><b>Notes:</b> This disease, actually acute nanomachine infection, converts the victim into a cyborg.
<BR>
<BR><b>Severity:</b> Major"}
if (href_list["del_all"])
src.temp = text("Are you sure you wish to delete all records?<br>\n\t<A href='?src=\ref[];temp=1;del_all2=1'>Yes</A><br>\n\t<A href='?src=\ref[];temp=1'>No</A><br>", src, src)
if (href_list["del_all2"])
for(var/datum/data/record/R in data_core.medical)
del(R)
src.temp = "All records deleted."
if (href_list["field"])
var/a1 = src.active1
var/a2 = src.active2
switch(href_list["field"])
if("fingerprint")
if (istype(src.active1, /datum/data/record))
var/t1 = input("Please input fingerprint hash:", "Med. records", src.active1.fields["id"], null) as text
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active1 != a1))
return
src.active1.fields["fingerprint"] = t1
if("sex")
if (istype(src.active1, /datum/data/record))
if (src.active1.fields["sex"] == "Male")
src.active1.fields["sex"] = "Female"
else
src.active1.fields["sex"] = "Male"
if("age")
if (istype(src.active1, /datum/data/record))
var/t1 = input("Please input age:", "Med. records", src.active1.fields["age"], null) as text
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active1 != a1))
return
src.active1.fields["age"] = t1
if("mi_dis")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please input minor disabilities list:", "Med. records", src.active2.fields["mi_dis"], null) as text
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["mi_dis"] = t1
if("mi_dis_d")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please summarize minor dis.:", "Med. records", src.active2.fields["mi_dis_d"], null) as message
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["mi_dis_d"] = t1
if("ma_dis")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please input major diabilities list:", "Med. records", src.active2.fields["ma_dis"], null) as text
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["ma_dis"] = t1
if("ma_dis_d")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please summarize major dis.:", "Med. records", src.active2.fields["ma_dis_d"], null) as message
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["ma_dis_d"] = t1
if("alg")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please state allergies:", "Med. records", src.active2.fields["alg"], null) as text
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["alg"] = t1
if("alg_d")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please summarize allergies:", "Med. records", src.active2.fields["alg_d"], null) as message
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["alg_d"] = t1
if("cdi")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please state diseases:", "Med. records", src.active2.fields["cdi"], null) as text
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["cdi"] = t1
if("cdi_d")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please summarize diseases:", "Med. records", src.active2.fields["cdi_d"], null) as message
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["cdi_d"] = t1
if("notes")
if (istype(src.active2, /datum/data/record))
var/t1 = input("Please summarize notes:", "Med. records", src.active2.fields["notes"], null) as message
if ((!( t1 ) || !( src.authenticated ) || (!src.master) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["notes"] = t1
if("p_stat")
if (istype(src.active1, /datum/data/record))
src.temp = text("<B>Physical Condition:</B><BR>\n\t<A href='?src=\ref[];temp=1;p_stat=deceased'>*Deceased*</A><BR>\n\t<A href='?src=\ref[];temp=1;p_stat=unconscious'>*Unconscious*</A><BR>\n\t<A href='?src=\ref[];temp=1;p_stat=active'>Active</A><BR>\n\t<A href='?src=\ref[];temp=1;p_stat=unfit'>Physically Unfit</A><BR>", src, src, src, src)
if("m_stat")
if (istype(src.active1, /datum/data/record))
src.temp = text("<B>Mental Condition:</B><BR>\n\t<A href='?src=\ref[];temp=1;m_stat=insane'>*Insane*</A><BR>\n\t<A href='?src=\ref[];temp=1;m_stat=unstable'>*Unstable*</A><BR>\n\t<A href='?src=\ref[];temp=1;m_stat=watch'>*Watch*</A><BR>\n\t<A href='?src=\ref[];temp=1;m_stat=stable'>Stable</A><BR>", src, src, src, src)
if("b_type")
if (istype(src.active2, /datum/data/record))
src.temp = text("<B>Blood Type:</B><BR>\n\t<A href='?src=\ref[];temp=1;b_type=an'>A-</A> <A href='?src=\ref[];temp=1;b_type=ap'>A+</A><BR>\n\t<A href='?src=\ref[];temp=1;b_type=bn'>B-</A> <A href='?src=\ref[];temp=1;b_type=bp'>B+</A><BR>\n\t<A href='?src=\ref[];temp=1;b_type=abn'>AB-</A> <A href='?src=\ref[];temp=1;b_type=abp'>AB+</A><BR>\n\t<A href='?src=\ref[];temp=1;b_type=on'>O-</A> <A href='?src=\ref[];temp=1;b_type=op'>O+</A><BR>", src, src, src, src, src, src, src, src)
else
if (href_list["p_stat"])
if (src.active1)
switch(href_list["p_stat"])
if("deceased")
src.active1.fields["p_stat"] = "*Deceased*"
if("unconscious")
src.active1.fields["p_stat"] = "*Unconscious*"
if("active")
src.active1.fields["p_stat"] = "Active"
if("unfit")
src.active1.fields["p_stat"] = "Physically Unfit"
if (href_list["m_stat"])
if (src.active1)
switch(href_list["m_stat"])
if("insane")
src.active1.fields["m_stat"] = "*Insane*"
if("unstable")
src.active1.fields["m_stat"] = "*Unstable*"
if("watch")
src.active1.fields["m_stat"] = "*Watch*"
if("stable")
src.active2.fields["m_stat"] = "Stable"
if (href_list["b_type"])
if (src.active2)
switch(href_list["b_type"])
if("an")
src.active2.fields["b_type"] = "A-"
if("bn")
src.active2.fields["b_type"] = "B-"
if("abn")
src.active2.fields["b_type"] = "AB-"
if("on")
src.active2.fields["b_type"] = "O-"
if("ap")
src.active2.fields["b_type"] = "A+"
if("bp")
src.active2.fields["b_type"] = "B+"
if("abp")
src.active2.fields["b_type"] = "AB+"
if("op")
src.active2.fields["b_type"] = "O+"
if (href_list["del_r"])
if (src.active2)
src.temp = "Are you sure you wish to delete the record (Medical Portion Only)?<br>\n\t<A href='?src=\ref[src];temp=1;del_r2=1'>Yes</A><br>\n\t<A href='?src=\ref[src];temp=1'>No</A><br>"
if (href_list["del_r2"])
if (src.active2)
del(src.active2)
if (href_list["d_rec"])
var/datum/data/record/R = locate(href_list["d_rec"])
var/datum/data/record/M = locate(href_list["d_rec"])
if (!( data_core.general.Find(R) ))
src.temp = "Record Not Found!"
return
for(var/datum/data/record/E in data_core.medical)
if ((E.fields["name"] == R.fields["name"] || E.fields["id"] == R.fields["id"]))
M = E
else
//Foreach continue //goto(2540)
src.active1 = R
src.active2 = M
src.screen = 4
if (href_list["new"])
if ((istype(src.active1, /datum/data/record) && !( istype(src.active2, /datum/data/record) )))
var/datum/data/record/R = new /datum/data/record( )
R.fields["name"] = src.active1.fields["name"]
R.fields["id"] = src.active1.fields["id"]
R.name = text("Medical Record #[]", R.fields["id"])
R.fields["b_type"] = "Unknown"
R.fields["mi_dis"] = "None"
R.fields["mi_dis_d"] = "No minor disabilities have been declared."
R.fields["ma_dis"] = "None"
R.fields["ma_dis_d"] = "No major disabilities have been diagnosed."
R.fields["alg"] = "None"
R.fields["alg_d"] = "No allergies have been detected in this patient."
R.fields["cdi"] = "None"
R.fields["cdi_d"] = "No diseases have been diagnosed at the moment."
R.fields["notes"] = "No notes."
data_core.medical += R
src.active2 = R
src.screen = 4
if (href_list["add_c"])
if (!( istype(src.active2, /datum/data/record) ))
return
var/a2 = src.active2
var/t1 = input("Add Comment:", "Med. records", null, null) as message
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src.master, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
var/counter = 1
while(src.active2.fields[text("com_[]", counter)])
counter++
src.active2.fields[text("com_[]", counter)] = text("Made by [] ([]) on [], 2053<BR>[]", src.authenticated, src.rank, time2text(world.realtime, "DDD MMM DD hh:mm:ss"), t1)
if (href_list["del_c"])
if ((istype(src.active2, /datum/data/record) && src.active2.fields[text("com_[]", href_list["del_c"])]))
src.active2.fields[text("com_[]", href_list["del_c"])] = "<B>Deleted</B>"
if (href_list["search"])
var/t1 = input("Search String: (Name or ID)", "Med. records", null, null) as text
if ((!( t1 ) || usr.stat || (!src.master) || !( src.authenticated ) || usr.restrained() || ((!in_range(src.master, usr)) && (!istype(usr, /mob/living/silicon)))))
return
src.active1 = null
src.active2 = null
t1 = lowertext(t1)
for(var/datum/data/record/R in data_core.general)
if ((lowertext(R.fields["name"]) == t1 || t1 == lowertext(R.fields["id"])))
src.active1 = R
else
if (!( src.active1 ))
src.temp = text("Could not locate record [].", t1)
else
for(var/datum/data/record/E in data_core.medical)
if ((E.fields["name"] == src.active1.fields["name"] || E.fields["id"] == src.active1.fields["id"]))
src.active2 = E
else
src.screen = 4
if (href_list["print_p"])
var/info = "<CENTER><B>Medical Record</B></CENTER><BR>"
if ((istype(src.active1, /datum/data/record) && data_core.general.Find(src.active1)))
info += text("Name: [] ID: []<BR>\nSex: []<BR>\nAge: []<BR>\nFingerprint: []<BR>\nPhysical Status: []<BR>\nMental Status: []<BR>", src.active1.fields["name"], src.active1.fields["id"], src.active1.fields["sex"], src.active1.fields["age"], src.active1.fields["fingerprint"], src.active1.fields["p_stat"], src.active1.fields["m_stat"])
else
info += "<B>General Record Lost!</B><BR>"
if ((istype(src.active2, /datum/data/record) && data_core.medical.Find(src.active2)))
info += text("<BR>\n<CENTER><B>Medical Data</B></CENTER><BR>\nBlood Type: []<BR>\n<BR>\nMinor Disabilities: []<BR>\nDetails: []<BR>\n<BR>\nMajor Disabilities: []<BR>\nDetails: []<BR>\n<BR>\nAllergies: []<BR>\nDetails: []<BR>\n<BR>\nCurrent Diseases: [] (per disease info placed in log/comment section)<BR>\nDetails: []<BR>\n<BR>\nImportant Notes:<BR>\n\t[]<BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>", src.active2.fields["b_type"], src.active2.fields["mi_dis"], src.active2.fields["mi_dis_d"], src.active2.fields["ma_dis"], src.active2.fields["ma_dis_d"], src.active2.fields["alg"], src.active2.fields["alg_d"], src.active2.fields["cdi"], src.active2.fields["cdi_d"], src.active2.fields["notes"])
var/counter = 1
while(src.active2.fields[text("com_[]", counter)])
info += text("[]<BR>", src.active2.fields[text("com_[]", counter)])
counter++
else
info += "<B>Medical Record Lost!</B><BR>"
info += "</TT>"
var/datum/signal/signal = new
signal.data["data"] = info
signal.data["title"] = "Medical Record"
src.peripheral_command("print",signal)
src.master.add_fingerprint(usr)
src.master.updateUsrDialog()
return

View File

@@ -0,0 +1,96 @@
/datum/computer/file/computer_program/messenger
name = "Messenger"
size = 8.0
var/messages = null
var/screen_name = "User"
//To-do: take screen_name from inserted id card??
//Saving log to file datum
return_text()
if(..())
return
var/dat = "<a href='byond://?src=\ref[src];close=1'>Close</a> | "
dat += "<a href='byond://?src=\ref[src];quit=1'>Quit</a><br>"
dat += "<b>SpaceMessenger V4.1.2</b><br>"
dat += "<a href='byond://?src=\ref[src];send_msg=1'>Send Message</a>"
dat += " | <a href='byond://?src=\ref[src];func_msg=clear'>Clear</a>"
dat += " | <a href='byond://?src=\ref[src];func_msg=print'>Print</a>"
dat += " | Name:<a href='byond://?src=\ref[src];set_name=1'>[src.screen_name]</a><hr>"
dat += messages
dat += "</center>"
return dat
Topic(href, href_list)
if(..())
return
if(href_list["send_msg"])
var/t = input(usr, "Please enter messenger", src.id_tag, null) as text
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if (!t)
return
if (!in_range(src.master, usr))
return
var/datum/signal/signal = new
signal.data["type"] = "message"
signal.data["data"] = t
signal.data["sender"] = src.screen_name
src.messages += "<i><b>&rarr; You:</b></i><br>[t]<br>"
peripheral_command("send signal", signal)
if(href_list["func_msg"])
switch(href_list["func_msg"])
if("clear")
src.messages = null
if("print")
var/datum/signal/signal = new
signal.data["data"] = src.messages
signal.data["title"] = "Chatlog"
peripheral_command("print", signal)
//if("save")
//TO-DO
if(href_list["set_name"])
var/t = input(usr, "Please enter screen name", src.id_tag, null) as text
t = copytext(sanitize(t), 1, 20)
if (!t)
return
if (!in_range(src.master, usr))
return
src.screen_name = t
src.master.add_fingerprint(usr)
src.master.updateUsrDialog()
return
receive_command(obj/source, command, datum/signal/signal)
if(..() || !signal)
return
if(command == "radio signal")
switch(signal.data["type"])
if("message")
var/sender = signal.data["sender"]
if(!sender)
sender = "Unknown"
src.messages += "<i><b>&larr; From [sender]:</b></i><br>[signal.data["data"]]<br>"
if(src.master.active_program == src)
playsound(src.master.loc, 'twobeep.ogg', 50, 1)
src.master.updateUsrDialog()
return

View File

@@ -0,0 +1,209 @@
/obj/item/weapon/peripheral
name = "Peripheral card"
desc = "A computer circuit board."
icon = 'module.dmi'
icon_state = "id_mod"
item_state = "electronic"
w_class = 2
var/obj/machinery/computer2/host
var/id = null
New()
..()
spawn(2)
if(istype(src.loc,/obj/machinery/computer2))
host = src.loc
host.peripherals.Add(src)
// var/setup_id = "\ref[src]"
// src.id = copytext(setup_id,4,(length(setup_id)-1) )
Del()
if(host)
host.peripherals.Remove(src)
..()
proc
receive_command(obj/source, command, datum/signal/signal)
if((source != host) || !(src in host))
return 1
if(!command)
return 1
return 0
send_command(command, datum/signal/signal)
if(!command || !host)
return
src.host.receive_command(src, command, signal)
return
/obj/item/weapon/peripheral/radio
name = "Wireless card"
var/frequency = 1419
var/code = null
var/datum/radio_frequency/radio_connection
New()
..()
if(radio_controller)
initialize()
initialize()
set_frequency(frequency)
proc
set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency)
receive_command(obj/source, command, datum/signal/signal)
if(..())
return
if(!signal || !radio_connection)
return
switch(command)
if("send signal")
src.radio_connection.post_signal(src, signal)
return
receive_signal(datum/signal/signal)
if(!signal || (signal.encryption && signal.encryption != code))
return
var/datum/signal/newsignal = new
newsignal.data = signal.data
if(src.code)
newsignal.encryption = src.code
send_command("radio signal",newsignal)
return
/obj/item/weapon/peripheral/printer
name = "Printer module"
desc = "A small printer designed to fit into a computer casing."
icon_state = "card_mod"
var/printing = 0
receive_command(obj/source,command, datum/signal/signal)
if(..())
return
if(!signal)
return
if((command == "print") && !src.printing)
src.printing = 1
var/print_data = signal.data["data"]
var/print_title = signal.data["title"]
if(!print_data)
src.printing = 0
return
spawn(50)
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( src.host.loc )
P.info = print_data
if(print_title)
P.name = "paper- '[print_title]'"
src.printing = 0
return
return
/obj/item/weapon/peripheral/prize_vendor
name = "Prize vending module"
desc = "An arcade prize dispenser designed to fit inside a computer casing."
icon_state = "power_mod"
var/last_vend = 0 //Delay between vends if manually activated(ie a dude is holding it and shaking stuff out)
receive_command(obj/source,command, datum/signal/signal)
if(..())
return
if(command == "vend prize")
src.vend_prize()
return
attack_self(mob/user as mob)
if( (last_vend + 400) < world.time)
user << "You shake something out of [src]!"
src.vend_prize()
src.last_vend = world.time
else
user << "\red [src] isn't ready to dispense a prize yet."
return
proc/vend_prize()
var/obj/item/prize
var/prizeselect = rand(1,4)
var/turf/prize_location = null
if(src.host)
prize_location = src.host.loc
else
prize_location = get_turf(src)
switch(prizeselect)
if(1)
prize = new /obj/item/weapon/spacecash( prize_location )
prize.name = "space ticket"
prize.desc = "It's almost like actual currency!"
if(2)
prize = new /obj/item/device/radio/beacon( prize_location )
prize.name = "electronic blink toy game"
prize.desc = "Blink. Blink. Blink."
if(3)
prize = new /obj/item/weapon/zippo( prize_location )
prize.name = "Burno Lighter"
prize.desc = "Almost like a decent lighter!"
if(4)
prize = new /obj/item/weapon/c_tube( prize_location )
prize.name = "toy sword"
prize.icon = 'weapons.dmi'
prize.icon_state = "sword1"
prize.desc = "A sword made of cheap plastic."
/*
/obj/item/weapon/peripheral/card_scanner
name = "ID scanner module"
icon_state = "card_mod"
var/obj/item/weapon/card/id/authid = null
attack_self(mob/user as mob)
if(authid)
user << "The card falls out."
src.authid.loc = get_turf(user)
src.authid = null
return
receive_command(obj/source,command, datum/signal/signal)
if(..())
return
if(!signal || (signal.data["ref_id"] != "\ref[src]") )
return
switch(command)
if("eject card")
if(src.authid)
src.authid.loc = src.host.loc
src.authid = null
if("add card access")
var/new_access = signal.data["access"]
if(!new_access)
return
return
*/

138
code/unused/game_kit.dm Normal file
View File

@@ -0,0 +1,138 @@
/*
CONTAINS:
THAT STUPID GAME KIT
Which I am commenting out /N
*/
/*
/obj/item/weapon/game_kit/New()
src.board_stat = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
src.selected = "CR"
/obj/item/weapon/game_kit/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/item/weapon/game_kit/MouseDrop(mob/user as mob)
if (user == usr && !usr.restrained() && !usr.stat && (usr.contents.Find(src) || in_range(src, usr)))
if (usr.hand)
if (!usr.l_hand)
spawn (0)
src.attack_hand(usr, 1, 1)
else
if (!usr.r_hand)
spawn (0)
src.attack_hand(usr, 0, 1)
/obj/item/weapon/game_kit/proc/update()
var/dat = text("<CENTER><B>Game Board</B></CENTER><BR><a href='?src=\ref[];mode=hia'>[]</a> <a href='?src=\ref[];mode=remove'>remove</a><HR><table width= 256 border= 0 height= 256 cellspacing= 0 cellpadding= 0 >", src, (src.selected ? text("Selected: []", src.selected) : "Nothing Selected"), src)
for (var/y = 1 to 8)
dat += "<tr>"
for (var/x = 1 to 8)
var/color = (y + x) % 2 ? "#ffffff" : "#999999"
var/piece = copytext(src.board_stat, ((y - 1) * 8 + x) * 2 - 1, ((y - 1) * 8 + x) * 2 + 1)
dat += "<td>"
dat += "<td style='background-color:[color]' width=32 height=32>"
if (piece != "BB")
dat += "<a href='?src=\ref[src];s_board=[x] [y]'><img src='[src.base_url]/board_[piece].png' width=32 height=32 border=0>"
else
dat += "<a href='?src=\ref[src];s_board=[x] [y]'><img src='[src.base_url]/board_none.png' width=32 height=32 border=0>"
dat += "</td>"
dat += "</tr>"
dat += "</table><HR><B>Chips:</B><BR>"
for (var/piece in list("CB", "CR"))
dat += "<a href='?src=\ref[src];s_piece=[piece]'><img src='[src.base_url]/board_[piece].png' width=32 height=32 border=0></a>"
dat += "<HR><B>Chess pieces:</B><BR>"
for (var/piece in list("WP", "WK", "WQ", "WI", "WN", "WR"))
dat += "<a href='?src=\ref[src];s_piece=[piece]'><img src='[src.base_url]/board_[piece].png' width=32 height=32 border=0></a>"
dat += "<br>"
for (var/piece in list("BP", "BK", "BQ", "BI", "BN", "BR"))
dat += "<a href='?src=\ref[src];s_piece=[piece]'><img src='[src.base_url]/board_[piece].png' width=32 height=32 border=0></a>"
src.data = dat
/obj/item/weapon/game_kit/attack_hand(mob/user as mob, unused, flag)
if (flag)
return ..()
else
user.machine = src
if (!( src.data ))
update()
user << browse(src.data, "window=game_kit")
onclose(user, "game_kit")
return
return
/obj/item/weapon/game_kit/Topic(href, href_list)
..()
if ((usr.stat || usr.restrained()))
return
if (usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf)))
if (href_list["s_piece"])
src.selected = href_list["s_piece"]
else if (href_list["mode"])
if (href_list["mode"] == "remove")
src.selected = "remove"
else
src.selected = null
else if (href_list["s_board"])
if (!( src.selected ))
src.selected = href_list["s_board"]
else
var/tx = text2num(copytext(href_list["s_board"], 1, 2))
var/ty = text2num(copytext(href_list["s_board"], 3, 4))
if ((copytext(src.selected, 2, 3) == " " && length(src.selected) == 3))
var/sx = text2num(copytext(src.selected, 1, 2))
var/sy = text2num(copytext(src.selected, 3, 4))
var/place = ((sy - 1) * 8 + sx) * 2 - 1
src.selected = copytext(src.board_stat, place, place + 2)
if (place == 1)
src.board_stat = text("BB[]", copytext(src.board_stat, 3, 129))
else
if (place == 127)
src.board_stat = text("[]BB", copytext(src.board_stat, 1, 127))
else
if (place)
src.board_stat = text("[]BB[]", copytext(src.board_stat, 1, place), copytext(src.board_stat, place + 2, 129))
place = ((ty - 1) * 8 + tx) * 2 - 1
if (place == 1)
src.board_stat = text("[][]", src.selected, copytext(src.board_stat, 3, 129))
else
if (place == 127)
src.board_stat = text("[][]", copytext(src.board_stat, 1, 127), src.selected)
else
if (place)
src.board_stat = text("[][][]", copytext(src.board_stat, 1, place), src.selected, copytext(src.board_stat, place + 2, 129))
src.selected = null
else
if (src.selected == "remove")
var/place = ((ty - 1) * 8 + tx) * 2 - 1
if (place == 1)
src.board_stat = text("BB[]", copytext(src.board_stat, 3, 129))
else
if (place == 127)
src.board_stat = text("[]BB", copytext(src.board_stat, 1, 127))
else
if (place)
src.board_stat = text("[]BB[]", copytext(src.board_stat, 1, place), copytext(src.board_stat, place + 2, 129))
else
if (length(src.selected) == 2)
var/place = ((ty - 1) * 8 + tx) * 2 - 1
if (place == 1)
src.board_stat = text("[][]", src.selected, copytext(src.board_stat, 3, 129))
else
if (place == 127)
src.board_stat = text("[][]", copytext(src.board_stat, 1, 127), src.selected)
else
if (place)
src.board_stat = text("[][][]", copytext(src.board_stat, 1, place), src.selected, copytext(src.board_stat, place + 2, 129))
src.add_fingerprint(usr)
update()
for(var/mob/M in viewers(1, src))
if ((M.client && M.machine == src))
src.attack_hand(M)
*/

View File

@@ -0,0 +1,24 @@
/mob/living/silicon/hivebot/death(gibbed)
if(src.mainframe)
src.mainframe.return_to(src)
src.stat = 2
src.canmove = 0
if(src.blind)
src.blind.layer = 0
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = 2
src.updateicon()
var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch
store_memory("Time of death: [tod]", 0)
if (src.key)
spawn(50)
if(src.key && src.stat == 2)
src.verbs += /mob/proc/ghost
return ..(gibbed)

View File

@@ -0,0 +1,140 @@
/mob/living/silicon/hivebot/emote(var/act)
var/param = null
if (findtext(act, "-", 1, null))
var/t1 = findtext(act, "-", 1, null)
param = copytext(act, t1 + 1, length(act) + 1)
act = copytext(act, 1, t1)
var/m_type = 1
var/message
switch(act)
if ("salute")
if (!src.buckled)
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> salutes to [param]."
else
message = "<B>[src]</b> salutes."
m_type = 1
if ("bow")
if (!src.buckled)
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> bows to [param]."
else
message = "<B>[src]</B> bows."
m_type = 1
if ("clap")
if (!src.restrained())
message = "<B>[src]</B> claps."
m_type = 2
if ("flap")
if (!src.restrained())
message = "<B>[src]</B> flaps his wings."
m_type = 2
if ("aflap")
if (!src.restrained())
message = "<B>[src]</B> flaps his wings ANGRILY!"
m_type = 2
if ("custom")
var/input = input("Choose an emote to display.") as text|null
if (!input)
return
input = sanitize(input)
var/input2 = input("Is this a visible or hearable emote?") in list("Visible","Hearable")
if (input2 == "Visible")
m_type = 1
else if (input2 == "Hearable")
m_type = 2
else
alert("Unable to use this emote, must be either hearable or visible.")
return
message = "<B>[src]</B> [input]"
if ("twitch")
message = "<B>[src]</B> twitches violently."
m_type = 1
if ("twitch_s")
message = "<B>[src]</B> twitches."
m_type = 1
if ("nod")
message = "<B>[src]</B> nods."
m_type = 1
if ("glare")
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> glares at [param]."
else
message = "<B>[src]</B> glares."
if ("stare")
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> stares at [param]."
else
message = "<B>[src]</B> stares."
if ("look")
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (param == A.name)
M = A
break
if (!M)
param = null
if (param)
message = "<B>[src]</B> looks at [param]."
else
message = "<B>[src]</B> looks."
m_type = 1
else
src << text("Invalid Emote: []", act)
if ((message && src.stat == 0))
if (m_type & 1)
for(var/mob/O in viewers(src, null))
O.show_message(message, m_type)
else
for(var/mob/O in hearers(src, null))
O.show_message(message, m_type)
return

View File

@@ -0,0 +1,20 @@
/mob/living/silicon/hivebot/examine()
set src in oview()
usr << "\blue *---------*"
usr << text("\blue This is \icon[src] <B>[src.name]</B>!")
if (src.stat == 2)
usr << text("\red [src.name] is powered-down.")
if (src.bruteloss)
if (src.bruteloss < 75)
usr << text("\red [src.name] looks slightly dented")
else
usr << text("\red <B>[src.name] looks severely dented!</B>")
if (src.fireloss)
if (src.fireloss < 75)
usr << text("\red [src.name] looks slightly burnt!")
else
usr << text("\red <B>[src.name] looks severely burnt!</B>")
if (src.stat == 1)
usr << text("\red [src.name] doesn't seem to be responding.")
return

View File

@@ -0,0 +1,57 @@
/obj/item/weapon/hive_module
name = "hive robot module"
icon = 'module.dmi'
icon_state = "std_module"
w_class = 2.0
item_state = "electronic"
flags = FPRINT|TABLEPASS | CONDUCT
var/list/modules = list()
/obj/item/weapon/hive_module/standard
name = "give standard robot module"
/obj/item/weapon/hive_module/engineering
name = "HiveBot engineering robot module"
/obj/item/weapon/hive_module/New()//Shit all the mods have
src.modules += new /obj/item/device/flash(src)
/obj/item/weapon/hive_module/standard/New()
..()
src.modules += new /obj/item/weapon/melee/baton(src)
src.modules += new /obj/item/weapon/extinguisher(src)
//var/obj/item/weapon/gun/mp5/M = new /obj/item/weapon/gun/mp5(src)
//M.weapon_lock = 0
//src.modules += M
/obj/item/weapon/hive_module/engineering/New()
src.modules += new /obj/item/weapon/extinguisher(src)
src.modules += new /obj/item/weapon/screwdriver(src)
src.modules += new /obj/item/weapon/weldingtool(src)
src.modules += new /obj/item/weapon/wrench(src)
src.modules += new /obj/item/device/analyzer(src)
src.modules += new /obj/item/device/flashlight(src)
var/obj/item/weapon/rcd/R = new /obj/item/weapon/rcd(src)
R.matter = 30
src.modules += R
src.modules += new /obj/item/device/t_scanner(src)
src.modules += new /obj/item/weapon/crowbar(src)
src.modules += new /obj/item/weapon/wirecutters(src)
src.modules += new /obj/item/device/multitool(src)
var/obj/item/stack/sheet/metal/M = new /obj/item/stack/sheet/metal(src)
M.amount = 50
src.modules += M
var/obj/item/stack/sheet/rglass/G = new /obj/item/stack/sheet/rglass(src)
G.amount = 50
src.modules += G
var/obj/item/weapon/cable_coil/W = new /obj/item/weapon/cable_coil(src)
W.amount = 50
src.modules += W

View File

@@ -0,0 +1,506 @@
/mob/living/silicon/hivebot/New(loc,mainframe)
src << "\blue Your icons have been generated!"
updateicon()
if(mainframe)
dependent = 1
src.real_name = mainframe:name
src.name = src.real_name
else
src.real_name = "Robot [pick(rand(1, 999))]"
src.name = src.real_name
src.radio = new /obj/item/device/radio(src)
..()
/mob/living/silicon/hivebot/proc/pick_module()
if(src.module)
return
var/mod = input("Please, select a module!", "Robot", null, null) in list("Combat", "Engineering")
if(src.module)
return
switch(mod)
if("Combat")
src.module = new /obj/item/weapon/hive_module/standard(src)
if("Engineering")
src.module = new /obj/item/weapon/hive_module/engineering(src)
src.hands.icon_state = "malf"
updateicon()
/mob/living/silicon/hivebot/blob_act()
if (src.stat != 2)
src.bruteloss += 60
src.updatehealth()
return 1
return 0
/mob/living/silicon/hivebot/Stat()
..()
statpanel("Status")
if (src.client.statpanel == "Status")
if(emergency_shuttle.online && emergency_shuttle.location < 2)
var/timeleft = emergency_shuttle.timeleft()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
/*
if(ticker.mode.name == "AI malfunction")
stat(null, "Points left until the AI takes over: [AI_points]/[AI_points_win]")
*/
stat(null, text("Charge Left: [src.energy]/[src.energy_max]"))
/mob/living/silicon/hivebot/restrained()
return 0
/mob/living/silicon/hivebot/ex_act(severity)
flick("flash", src.flash)
if (src.stat == 2 && src.client)
src.gib(1)
return
else if (src.stat == 2 && !src.client)
del(src)
return
var/b_loss = src.bruteloss
var/f_loss = src.fireloss
switch(severity)
if(1.0)
if (src.stat != 2)
b_loss += 100
f_loss += 100
src.gib(1)
return
if(2.0)
if (src.stat != 2)
b_loss += 60
f_loss += 60
if(3.0)
if (src.stat != 2)
b_loss += 30
src.bruteloss = b_loss
src.fireloss = f_loss
src.updatehealth()
/mob/living/silicon/hivebot/meteorhit(obj/O as obj)
for(var/mob/M in viewers(src, null))
M.show_message(text("\red [src] has been hit by [O]"), 1)
//Foreach goto(19)
if (src.health > 0)
src.bruteloss += 30
if ((O.icon_state == "flaming"))
src.fireloss += 40
src.updatehealth()
return
/mob/living/silicon/hivebot/bullet_act(flag)
/*
if (flag == PROJECTILE_BULLET)
if (src.stat != 2)
src.bruteloss += 60
src.updatehealth()
else if (flag == PROJECTILE_MEDBULLET)
if (src.stat != 2)
src.bruteloss += 30
src.updatehealth()
else if (flag == PROJECTILE_WEAKBULLET)
if (src.stat != 2)
src.bruteloss += 15
src.updatehealth()
else if (flag == PROJECTILE_MPBULLET)
if (src.stat != 2)
src.bruteloss += 20
src.updatehealth()
else if (flag == PROJECTILE_SLUG)
if (src.stat != 2)
src.bruteloss += 40
src.updatehealth()
else if (flag == PROJECTILE_BAG)
if (src.stat != 2)
src.bruteloss += 2
src.updatehealth()
else if (flag == PROJECTILE_TASER)
return
else if (flag == PROJECTILE_WAVE)
if (src.stat != 2)
src.bruteloss += 25
src.updatehealth()
return
else if(flag == PROJECTILE_LASER)
if (src.stat != 2)
src.bruteloss += 20
src.updatehealth()
else if(flag == PROJECTILE_PULSE)
if (src.stat != 2)
src.bruteloss += 40
src.updatehealth()
*/
return
/mob/living/silicon/hivebot/Bump(atom/movable/AM as mob|obj, yes)
spawn( 0 )
if ((!( yes ) || src.now_pushing))
return
src.now_pushing = 1
if(ismob(AM))
var/mob/tmob = AM
if(istype(tmob, /mob/living/carbon/human) && tmob.mutations & FAT)
if(prob(20))
for(var/mob/M in viewers(src, null))
if(M.client)
M << M << "\red <B>[src] fails to push [tmob]'s fat ass out of the way.</B>"
src.now_pushing = 0
//src.unlock_medal("That's No Moon, That's A Gourmand!", 1)
return
src.now_pushing = 0
..()
if (!istype(AM, /atom/movable))
return
if (!src.now_pushing)
src.now_pushing = 1
if (!AM.anchored)
var/t = get_dir(src, AM)
step(AM, t)
src.now_pushing = null
return
return
/mob/living/silicon/hivebot/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/weldingtool) && W:welding)
if (W:remove_fuel(0))
src.bruteloss -= 30
if(src.bruteloss < 0) src.bruteloss = 0
src.updatehealth()
src.add_fingerprint(user)
for(var/mob/O in viewers(user, null))
O.show_message(text("\red [user] has fixed some of the dents on [src]!"), 1)
else
user << "Need more welding fuel!"
return
/mob/living/silicon/hivebot/attack_alien(mob/living/carbon/alien/humanoid/M as mob)
if (M.a_intent == "grab")
if (M == src)
return
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M )
G.assailant = M
if (M.hand)
M.l_hand = G
else
M.r_hand = G
G.layer = 20
G.affecting = src
src.grabbed_by += G
G.synch()
playsound(src.loc, 'thudswoosh.ogg', 50, 1, -1)
for(var/mob/O in viewers(src, null))
O.show_message(text("\red [] has grabbed [] passively!", M, src), 1)
else if (M.a_intent == "hurt")
var/damage = rand(5, 10)
if (prob(90))
/*
if (M.class == "combat")
damage += 15
if(prob(20))
src.weakened = max(src.weakened,4)
src.stunned = max(src.stunned,4)
*/
playsound(src.loc, 'slash.ogg', 25, 1, -1)
for(var/mob/O in viewers(src, null))
O.show_message(text("\red <B>[] has slashed at []!</B>", M, src), 1)
if(prob(8))
flick("noise", src.flash)
src.bruteloss += damage
src.updatehealth()
else
playsound(src.loc, 'slashmiss.ogg', 25, 1, -1)
for(var/mob/O in viewers(src, null))
O.show_message(text("\red <B>[] took a swipe at []!</B>", M, src), 1)
return
else if (M.a_intent == "disarm")
if(!(src.lying))
var/randn = rand(1, 100)
if (randn <= 40)
src.stunned = 5
step(src,get_dir(M,src))
spawn(5) step(src,get_dir(M,src))
playsound(src.loc, 'slash.ogg', 50, 1, -1)
for(var/mob/O in viewers(src, null))
O.show_message(text("\red <B>[] has pushed back []!</B>", M, src), 1)
else
playsound(src.loc, 'slashmiss.ogg', 25, 1, -1)
for(var/mob/O in viewers(src, null))
O.show_message(text("\red <B>[] attempted to push back []!</B>", M, src), 1)
return
/mob/living/silicon/hivebot/attack_hand(mob/user)
..()
return
/mob/living/silicon/hivebot/proc/allowed(mob/M)
//check if it doesn't require any access at all
if(src.check_access(null))
return 1
return 0
/mob/living/silicon/hivebot/proc/check_access(obj/item/weapon/card/id/I)
if(!istype(src.req_access, /list)) //something's very wrong
return 1
var/list/L = src.req_access
if(!L.len) //no requirements
return 1
if(!I || !istype(I, /obj/item/weapon/card/id) || !I.access) //not ID or no access
return 0
for(var/req in src.req_access)
if(!(req in I.access)) //doesn't have this access
return 0
return 1
/mob/living/silicon/hivebot/proc/updateicon()
src.overlays = null
if(src.stat == 0)
src.overlays += "eyes"
else
src.overlays -= "eyes"
/mob/living/silicon/hivebot/proc/installed_modules()
if(!src.module)
src.pick_module()
return
var/dat = "<HEAD><TITLE>Modules</TITLE><META HTTP-EQUIV='Refresh' CONTENT='10'></HEAD><BODY>\n"
dat += {"<A HREF='?src=\ref[src];mach_close=robotmod'>Close</A>
<BR>
<BR>
<B>Activated Modules</B>
<BR>
Module 1: [module_state_1 ? "<A HREF=?src=\ref[src];mod=\ref[module_state_1]>[module_state_1]<A>" : "No Module"]<BR>
Module 2: [module_state_2 ? "<A HREF=?src=\ref[src];mod=\ref[module_state_2]>[module_state_2]<A>" : "No Module"]<BR>
Module 3: [module_state_3 ? "<A HREF=?src=\ref[src];mod=\ref[module_state_3]>[module_state_3]<A>" : "No Module"]<BR>
<BR>
<B>Installed Modules</B><BR><BR>"}
for (var/obj in src.module.modules)
if(src.activated(obj))
dat += text("[obj]: <B>Activated</B><BR>")
else
dat += text("[obj]: <A HREF=?src=\ref[src];act=\ref[obj]>Activate</A><BR>")
/*
if(src.activated(obj))
dat += text("[obj]: \[<B>Activated</B> | <A HREF=?src=\ref[src];deact=\ref[obj]>Deactivate</A>\]<BR>")
else
dat += text("[obj]: \[<A HREF=?src=\ref[src];act=\ref[obj]>Activate</A> | <B>Deactivated</B>\]<BR>")
*/
src << browse(dat, "window=robotmod&can_close=0")
/mob/living/silicon/hivebot/Topic(href, href_list)
..()
if (href_list["mach_close"])
var/t1 = text("window=[href_list["mach_close"]]")
src.machine = null
src << browse(null, t1)
return
if (href_list["mod"])
var/obj/item/O = locate(href_list["mod"])
O.attack_self(src)
if (href_list["act"])
var/obj/item/O = locate(href_list["act"])
if(activated(O))
src << "Already activated"
return
if(!src.module_state_1)
src.module_state_1 = O
O.layer = 20
src.contents += O
else if(!src.module_state_2)
src.module_state_2 = O
O.layer = 20
src.contents += O
else if(!src.module_state_3)
src.module_state_3 = O
O.layer = 20
src.contents += O
else
src << "You need to disable a module first!"
src.installed_modules()
if (href_list["deact"])
var/obj/item/O = locate(href_list["deact"])
if(activated(O))
if(src.module_state_1 == O)
src.module_state_1 = null
src.contents -= O
else if(src.module_state_2 == O)
src.module_state_2 = null
src.contents -= O
else if(src.module_state_3 == O)
src.module_state_3 = null
src.contents -= O
else
src << "Module isn't activated."
else
src << "Module isn't activated"
src.installed_modules()
return
/mob/living/silicon/hivebot/proc/uneq_active()
if(isnull(src.module_active))
return
if(src.module_state_1 == src.module_active)
if (src.client)
src.client.screen -= module_state_1
src.contents -= module_state_1
src.module_active = null
src.module_state_1 = null
src.inv1.icon_state = "inv1"
else if(src.module_state_2 == src.module_active)
if (src.client)
src.client.screen -= module_state_2
src.contents -= module_state_2
src.module_active = null
src.module_state_2 = null
src.inv2.icon_state = "inv2"
else if(src.module_state_3 == src.module_active)
if (src.client)
src.client.screen -= module_state_3
src.contents -= module_state_3
src.module_active = null
src.module_state_3 = null
src.inv3.icon_state = "inv3"
/mob/living/silicon/hivebot/proc/activated(obj/item/O)
if(src.module_state_1 == O)
return 1
else if(src.module_state_2 == O)
return 1
else if(src.module_state_3 == O)
return 1
else
return 0
/mob/living/silicon/hivebot/proc/radio_menu()
var/dat = {"
<TT>
Microphone: [src.radio.broadcasting ? "<A href='byond://?src=\ref[src.radio];talk=0'>Engaged</A>" : "<A href='byond://?src=\ref[src.radio];talk=1'>Disengaged</A>"]<BR>
Speaker: [src.radio.listening ? "<A href='byond://?src=\ref[src.radio];listen=0'>Engaged</A>" : "<A href='byond://?src=\ref[src.radio];listen=1'>Disengaged</A>"]<BR>
Frequency:
<A href='byond://?src=\ref[src.radio];freq=-10'>-</A>
<A href='byond://?src=\ref[src.radio];freq=-2'>-</A>
[format_frequency(src.radio.frequency)]
<A href='byond://?src=\ref[src.radio];freq=2'>+</A>
<A href='byond://?src=\ref[src.radio];freq=10'>+</A><BR>
-------
</TT>"}
src << browse(dat, "window=radio")
onclose(src, "radio")
return
/mob/living/silicon/hivebot/Move(a, b, flag)
if (src.buckled)
return
if (src.restrained())
src.pulling = null
var/t7 = 1
if (src.restrained())
for(var/mob/M in range(src, 1))
if ((M.pulling == src && M.stat == 0 && !( M.restrained() )))
t7 = null
if ((t7 && (src.pulling && ((get_dist(src, src.pulling) <= 1 || src.pulling.loc == src.loc) && (src.client && src.client.moving)))))
var/turf/T = src.loc
. = ..()
if (src.pulling && src.pulling.loc)
if(!( isturf(src.pulling.loc) ))
src.pulling = null
return
else
if(Debug)
diary <<"src.pulling disappeared? at [__LINE__] in mob.dm - src.pulling = [src.pulling]"
diary <<"REPORT THIS"
/////
if(src.pulling && src.pulling.anchored)
src.pulling = null
return
if (!src.restrained())
var/diag = get_dir(src, src.pulling)
if ((diag - 1) & diag)
else
diag = null
if ((get_dist(src, src.pulling) > 1 || diag))
if (ismob(src.pulling))
var/mob/M = src.pulling
var/ok = 1
if (locate(/obj/item/weapon/grab, M.grabbed_by))
if (prob(75))
var/obj/item/weapon/grab/G = pick(M.grabbed_by)
if (istype(G, /obj/item/weapon/grab))
for(var/mob/O in viewers(M, null))
O.show_message(text("\red [G.affecting] has been pulled from [G.assailant]'s grip by [src]"), 1)
del(G)
else
ok = 0
if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
ok = 0
if (ok)
var/t = M.pulling
M.pulling = null
step(src.pulling, get_dir(src.pulling.loc, T))
M.pulling = t
else
if (src.pulling)
step(src.pulling, get_dir(src.pulling.loc, T))
else
src.pulling = null
. = ..()
if ((src.s_active && !( s_active in src.contents ) ))
src.s_active.close(src)
return
/mob/living/silicon/hivebot/verb/cmd_return_mainframe()
set category = "Robot Commands"
set name = "Recall to Mainframe."
return_mainframe()
/mob/living/silicon/hivebot/proc/return_mainframe()
if(mainframe)
mainframe.return_to(src)
else
src << "\red You lack a dedicated mainframe!"
return

View File

@@ -0,0 +1,46 @@
/mob/living/silicon/hivebot
name = "Robot"
icon = 'hivebot.dmi'
icon_state = "basic"
health = 80
var/health_max = 80
robot_talk_understand = 2
//HUD
var/obj/screen/cells = null
var/obj/screen/inv1 = null
var/obj/screen/inv2 = null
var/obj/screen/inv3 = null
//3 Modules can be activated at any one time.
var/obj/item/weapon/robot_module/module = null
var/module_active = null
var/module_state_1 = null
var/module_state_2 = null
var/module_state_3 = null
var/obj/item/device/radio/radio = null
var/list/req_access = list(access_robotics)
var/energy = 4000
var/energy_max = 4000
var/jetpack = 0
var/mob/living/silicon/hive_mainframe/mainframe = null
var/dependent = 0
var/shell = 1
/mob/living/silicon/hive_mainframe
name = "Robot Mainframe"
voice_name = "synthesized voice"
icon_state = "hive_main"
health = 200
var/health_max = 200
robot_talk_understand = 2
anchored = 1
var/online = 1
var/mob/living/silicon/hivebot = null
var/hivebot_name = null
var/force_mind = 0

250
code/unused/hivebot/hud.dm Normal file
View File

@@ -0,0 +1,250 @@
/obj/hud/proc/hivebot_hud()
src.adding = list( )
src.other = list( )
src.intents = list( )
src.mon_blo = list( )
src.m_ints = list( )
src.mov_int = list( )
src.vimpaired = list( )
src.darkMask = list( )
src.g_dither = new src.h_type( src )
src.g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH"
src.g_dither.name = "Mask"
src.g_dither.icon_state = "dither12g"
src.g_dither.layer = 18
src.g_dither.mouse_opacity = 0
src.alien_view = new src.h_type(src)
src.alien_view.screen_loc = "WEST,SOUTH to EAST,NORTH"
src.alien_view.name = "Alien"
src.alien_view.icon_state = "alien"
src.alien_view.layer = 18
src.alien_view.mouse_opacity = 0
src.blurry = new src.h_type( src )
src.blurry.screen_loc = "WEST,SOUTH to EAST,NORTH"
src.blurry.name = "Blurry"
src.blurry.icon_state = "blurry"
src.blurry.layer = 17
src.blurry.mouse_opacity = 0
src.druggy = new src.h_type( src )
src.druggy.screen_loc = "WEST,SOUTH to EAST,NORTH"
src.druggy.name = "Druggy"
src.druggy.icon_state = "druggy"
src.druggy.layer = 17
src.druggy.mouse_opacity = 0
// station explosion cinematic
src.station_explosion = new src.h_type( src )
src.station_explosion.icon = 'station_explosion.dmi'
src.station_explosion.icon_state = "start"
src.station_explosion.layer = 20
src.station_explosion.mouse_opacity = 0
src.station_explosion.screen_loc = "1,3"
var/obj/screen/using
//Radio
using = new src.h_type( src )
using.name = "radio"
using.dir = SOUTHWEST
using.icon = 'screen1_robot.dmi'
using.icon_state = "radio"
using.screen_loc = ui_movi
using.layer = 20
src.adding += using
//Generic overlays
using = new src.h_type(src) //Right hud bar
using.dir = SOUTH
using.icon = 'screen1_robot.dmi'
using.screen_loc = "EAST+1,SOUTH to EAST+1,NORTH"
using.layer = 19
src.adding += using
using = new src.h_type(src) //Lower hud bar
using.dir = EAST
using.icon = 'screen1_robot.dmi'
using.screen_loc = "WEST,SOUTH-1 to EAST,SOUTH-1"
using.layer = 19
src.adding += using
using = new src.h_type(src) //Corner Button
using.dir = NORTHWEST
using.icon = 'screen1_robot.dmi'
using.screen_loc = "EAST+1,SOUTH-1"
using.layer = 19
src.adding += using
//Module select
using = new src.h_type( src )
using.name = "module1"
using.dir = SOUTHWEST
using.icon = 'screen1_robot.dmi'
using.icon_state = "inv1"
using.screen_loc = ui_inv1
using.layer = 20
src.adding += using
mymob:inv1 = using
using = new src.h_type( src )
using.name = "module2"
using.dir = SOUTHWEST
using.icon = 'screen1_robot.dmi'
using.icon_state = "inv2"
using.screen_loc = ui_inv2
using.layer = 20
src.adding += using
mymob:inv2 = using
using = new src.h_type( src )
using.name = "module3"
using.dir = SOUTHWEST
using.icon = 'screen1_robot.dmi'
using.icon_state = "inv3"
using.screen_loc = ui_inv3
using.layer = 20
src.adding += using
mymob:inv3 = using
//End of module select
//Intent
using = new src.h_type( src )
using.name = "act_intent"
using.dir = SOUTHWEST
using.icon = 'screen1_robot.dmi'
using.icon_state = (mymob.a_intent == "hurt" ? "harm" : mymob.a_intent)
using.screen_loc = ui_acti
using.layer = 20
src.adding += using
action_intent = using
using = new src.h_type( src )
using.name = "arrowleft"
using.icon = 'screen1_robot.dmi'
using.icon_state = "s_arrow"
using.dir = WEST
using.screen_loc = ui_iarrowleft
using.layer = 19
src.adding += using
using = new src.h_type( src )
using.name = "arrowright"
using.icon = 'screen1_robot.dmi'
using.icon_state = "s_arrow"
using.dir = EAST
using.screen_loc = ui_iarrowright
using.layer = 19
src.adding += using
//End of Intent
//Cell
mymob:cells = new /obj/screen( null )
mymob:cells.icon = 'screen1_robot.dmi'
mymob:cells.icon_state = "charge-empty"
mymob:cells.name = "cell"
mymob:cells.screen_loc = ui_toxin
//Health
mymob.healths = new /obj/screen( null )
mymob.healths.icon = 'screen1_robot.dmi'
mymob.healths.icon_state = "health0"
mymob.healths.name = "health"
mymob.healths.screen_loc = ui_health
//Installed Module
mymob.hands = new /obj/screen( null )
mymob.hands.icon = 'screen1_robot.dmi'
mymob.hands.icon_state = "nomod"
mymob.hands.name = "module"
mymob.hands.screen_loc = ui_dropbutton
//Module Panel
using = new src.h_type( src )
using.name = "panel"
using.icon = 'screen1_robot.dmi'
using.icon_state = "panel"
using.screen_loc = ui_throw
using.layer = 19
src.adding += using
//Store
mymob.throw_icon = new /obj/screen(null)
mymob.throw_icon.icon = 'screen1_robot.dmi'
mymob.throw_icon.icon_state = "store"
mymob.throw_icon.name = "store"
mymob.throw_icon.screen_loc = ui_hand
//Temp
mymob.bodytemp = new /obj/screen( null )
mymob.bodytemp.icon_state = "temp0"
mymob.bodytemp.name = "body temperature"
mymob.bodytemp.screen_loc = ui_temp
//does nothing (fire and oxy)
mymob.oxygen = new /obj/screen( null )
mymob.oxygen.icon = 'screen1_robot.dmi'
mymob.oxygen.icon_state = "oxy0"
mymob.oxygen.name = "oxygen"
mymob.oxygen.screen_loc = ui_oxygen
mymob.fire = new /obj/screen( null )
mymob.fire.icon = 'screen1_robot.dmi'
mymob.fire.icon_state = "fire0"
mymob.fire.name = "fire"
mymob.fire.screen_loc = ui_fire
mymob.pullin = new /obj/screen( null )
mymob.pullin.icon = 'screen1_robot.dmi'
mymob.pullin.icon_state = "pull0"
mymob.pullin.name = "pull"
mymob.pullin.screen_loc = ui_pull
mymob.blind = new /obj/screen( null )
mymob.blind.icon = 'screen1_robot.dmi'
mymob.blind.icon_state = "black"
mymob.blind.name = " "
mymob.blind.screen_loc = "1,1 to 15,15"
mymob.blind.layer = 0
mymob.flash = new /obj/screen( null )
mymob.flash.icon = 'screen1_robot.dmi'
mymob.flash.icon_state = "blank"
mymob.flash.name = "flash"
mymob.flash.screen_loc = "1,1 to 15,15"
mymob.flash.layer = 17
mymob.sleep = new /obj/screen( null )
mymob.sleep.icon = 'screen1_robot.dmi'
mymob.sleep.icon_state = "sleep0"
mymob.sleep.name = "sleep"
mymob.sleep.screen_loc = ui_sleep
mymob.rest = new /obj/screen( null )
mymob.rest.icon = 'screen1_robot.dmi'
mymob.rest.icon_state = "rest0"
mymob.rest.name = "rest"
mymob.rest.screen_loc = ui_rest
mymob.zone_sel = new /obj/screen/zone_sel( null )
mymob.zone_sel.overlays = null
mymob.zone_sel.overlays += image("icon" = 'zone_sel.dmi', "icon_state" = text("[]", mymob.zone_sel.selecting))
mymob.client.screen = null
mymob.client.screen += list(mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.fire, mymob.hands, mymob.healths, mymob:cells, mymob.pullin, mymob.blind, mymob.flash, mymob.rest, mymob.sleep) //, mymob.mach )
mymob.client.screen += src.adding + src.other
return

229
code/unused/hivebot/life.dm Normal file
View File

@@ -0,0 +1,229 @@
/mob/living/silicon/hivebot/Life()
set invisibility = 0
set background = 1
if (src.monkeyizing)
return
if (src.stat != 2)
use_power()
src.blinded = null
clamp_values()
handle_regular_status_updates()
if(client)
src.shell = 0
handle_regular_hud_updates()
update_items()
if(dependent)
mainframe_check()
update_canmove()
/mob/living/silicon/hivebot
proc
clamp_values()
stunned = max(min(stunned, 10),0)
paralysis = max(min(paralysis, 1), 0)
weakened = max(min(weakened, 15), 0)
sleeping = max(min(sleeping, 1), 0)
bruteloss = max(bruteloss, 0)
toxloss = 0
oxyloss = 0
fireloss = max(fireloss, 0)
use_power()
if (src.energy)
if(src.energy <= 0)
death()
else if (src.energy <= 10)
src.module_active = null
src.module_state_1 = null
src.module_state_2 = null
src.module_state_3 = null
src.energy -=1
else
if(src.module_state_1)
src.energy -=1
if(src.module_state_2)
src.energy -=1
if(src.module_state_3)
src.energy -=1
src.energy -=1
src.blinded = 0
src.stat = 0
else
src.blinded = 1
src.stat = 1
update_canmove()
if(paralysis || stunned || weakened || buckled) canmove = 0
else canmove = 1
handle_regular_status_updates()
health = src.health_max - (fireloss + bruteloss)
if(health <= 0)
death()
if (src.stat != 2) //Alive.
if (src.paralysis || src.stunned || src.weakened) //Stunned etc.
if (src.stunned > 0)
src.stunned--
src.stat = 0
if (src.weakened > 0)
src.weakened--
src.lying = 0
src.stat = 0
if (src.paralysis > 0)
src.paralysis--
src.blinded = 0
src.lying = 0
src.stat = 1
else //Not stunned.
src.lying = 0
src.stat = 0
else //Dead.
src.blinded = 1
src.stat = 2
src.density = !( src.lying )
if ((src.sdisabilities & 1))
src.blinded = 1
if ((src.sdisabilities & 4))
src.ear_deaf = 1
if (src.eye_blurry > 0)
src.eye_blurry--
src.eye_blurry = max(0, src.eye_blurry)
if (src.druggy > 0)
src.druggy--
src.druggy = max(0, src.druggy)
return 1
handle_regular_hud_updates()
if (src.stat == 2 || src.mutations & XRAY)
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = 2
else if (src.stat != 2)
src.sight &= ~SEE_MOBS
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_OBJS
src.see_in_dark = 8
src.see_invisible = 2
if (src.healths)
if (src.stat != 2)
switch(health)
if(health_max to INFINITY)
src.healths.icon_state = "health0"
if(src.health_max*0.80 to src.health_max)
src.healths.icon_state = "health1"
if(src.health_max*0.60 to src.health_max*0.80)
src.healths.icon_state = "health2"
if(src.health_max*0.40 to src.health_max*0.60)
src.healths.icon_state = "health3"
if(src.health_max*0.20 to src.health_max*0.40)
src.healths.icon_state = "health4"
if(0 to health_max*0.20)
src.healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
else
src.healths.icon_state = "health7"
if (src.cells)
switch(src.energy)
if(src.energy_max*0.75 to INFINITY)
src.cells.icon_state = "charge4"
if(0.5*src.energy_max to 0.75*src.energy_max)
src.cells.icon_state = "charge3"
if(0.25*src.energy_max to 0.5*src.energy_max)
src.cells.icon_state = "charge2"
if(0 to 0.25*src.energy_max)
src.cells.icon_state = "charge1"
else
src.cells.icon_state = "charge0"
switch(src.bodytemperature) //310.055 optimal body temp
if(335 to INFINITY)
src.bodytemp.icon_state = "temp2"
if(320 to 335)
src.bodytemp.icon_state = "temp1"
if(300 to 320)
src.bodytemp.icon_state = "temp0"
if(260 to 300)
src.bodytemp.icon_state = "temp-1"
else
src.bodytemp.icon_state = "temp-2"
if(src.pullin) src.pullin.icon_state = "pull[src.pulling ? 1 : 0]"
src.client.screen -= src.hud_used.blurry
src.client.screen -= src.hud_used.druggy
src.client.screen -= src.hud_used.vimpaired
if ((src.blind && src.stat != 2))
if ((src.blinded))
src.blind.layer = 18
else
src.blind.layer = 0
if (src.disabilities & 1)
src.client.screen += src.hud_used.vimpaired
if (src.eye_blurry)
src.client.screen += src.hud_used.blurry
if (src.druggy)
src.client.screen += src.hud_used.druggy
if (src.stat != 2)
if (src.machine)
if (!( src.machine.check_eye(src) ))
src.reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
update_items()
if (src.client)
src.client.screen -= src.contents
src.client.screen += src.contents
if(src.module_state_1)
src.module_state_1:screen_loc = ui_inv1
if(src.module_state_2)
src.module_state_2:screen_loc = ui_inv2
if(src.module_state_3)
src.module_state_3:screen_loc = ui_inv3
mainframe_check()
if(mainframe)
if(mainframe.stat == 2)
mainframe.return_to(src)
else
death()

View File

@@ -0,0 +1,15 @@
/mob/living/silicon/hivebot/Login()
..()
update_clothing()
if (!isturf(src.loc))
src.client.eye = src.loc
src.client.perspective = EYE_PERSPECTIVE
if (src.stat == 2)
src.verbs += /mob/proc/ghost
if(src.real_name == "Hiveborg")
src.real_name += " "
src.real_name += "-[rand(1, 999)]"
src.name = src.real_name
return

View File

@@ -0,0 +1,178 @@
/mob/living/silicon/hive_mainframe/New()
Namepick()
/mob/living/silicon/hive_mainframe/Life()
if (src.stat == 2)
return
else
src.updatehealth()
if (src.health <= 0)
death()
return
if(src.force_mind)
if(!src.mind)
if(src.client)
src.mind = new
src.mind.key = src.key
src.mind.current = src
src.force_mind = 0
/mob/living/silicon/hive_mainframe/Stat()
..()
statpanel("Status")
if (src.client.statpanel == "Status")
if(emergency_shuttle.online && emergency_shuttle.location < 2)
var/timeleft = emergency_shuttle.timeleft()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
/*
if(ticker.mode.name == "AI malfunction")
stat(null, "Points left until the AI takes over: [AI_points]/[AI_points_win]")
*/
/mob/living/silicon/hive_mainframe/updatehealth()
if (src.nodamage == 0)
src.health = 100 - src.fireloss - src.bruteloss
else
src.health = 100
src.stat = 0
/mob/living/silicon/hive_mainframe/death(gibbed)
src.stat = 2
src.canmove = 0
if(src.blind)
src.blind.layer = 0
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = 2
src.lying = 1
src.icon_state = "hive_main-crash"
var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch
mind.store_memory("Time of death: [tod]", 0)
if (src.key)
spawn(50)
if(src.key && src.stat == 2)
src.verbs += /mob/proc/ghost
return ..(gibbed)
/mob/living/silicon/hive_mainframe/say_understands(var/other)
if (istype(other, /mob/living/carbon/human))
return 1
if (istype(other, /mob/living/silicon/robot))
return 1
if (istype(other, /mob/living/silicon/hivebot))
return 1
if (istype(other, /mob/living/silicon/ai))
return 1
return ..()
/mob/living/silicon/hive_mainframe/say_quote(var/text)
var/ending = copytext(text, length(text))
if (ending == "?")
return "queries, \"[text]\"";
else if (ending == "!")
return "declares, \"[copytext(text, 1, length(text))]\"";
return "states, \"[text]\"";
/mob/living/silicon/hive_mainframe/proc/return_to(var/mob/user)
if(user.mind)
user.mind.transfer_to(src)
spawn(20)
user:shell = 1
user:real_name = "Robot [pick(rand(1, 999))]"
user:name = user:real_name
return
/mob/living/silicon/hive_mainframe/verb/cmd_deploy_to()
set category = "Mainframe Commands"
set name = "Deploy to shell."
deploy_to()
/mob/living/silicon/hive_mainframe/verb/deploy_to()
if(usr.stat == 2)
usr << "You can't deploy because you are dead!"
return
var/list/bodies = new/list()
for(var/mob/living/silicon/hivebot/H in world)
if(H.z == src.z)
if(H.shell)
if(!H.stat)
bodies += H
var/target_shell = input(usr, "Which body to control?") as null|anything in bodies
if (!target_shell)
return
else if(src.mind)
spawn(30)
target_shell:mainframe = src
target_shell:dependent = 1
target_shell:real_name = src.name
target_shell:name = target_shell:real_name
src.mind.transfer_to(target_shell)
return
/client/proc/MainframeMove(n,direct,var/mob/living/silicon/hive_mainframe/user)
return
/obj/hud/proc/hive_mainframe_hud()
return
/mob/living/silicon/hive_mainframe/Login()
..()
update_clothing()
for(var/S in src.client.screen)
del(S)
src.flash = new /obj/screen( null )
src.flash.icon_state = "blank"
src.flash.name = "flash"
src.flash.screen_loc = "1,1 to 15,15"
src.flash.layer = 17
src.blind = new /obj/screen( null )
src.blind.icon_state = "black"
src.blind.name = " "
src.blind.screen_loc = "1,1 to 15,15"
src.blind.layer = 0
src.client.screen += list( src.blind, src.flash )
if(!isturf(src.loc))
src.client.eye = src.loc
src.client.perspective = EYE_PERSPECTIVE
if (src.stat == 2)
src.verbs += /mob/proc/ghost
return
/mob/living/silicon/hive_mainframe/proc/Namepick()
var/randomname = pick(ai_names)
var/newname = input(src,"You are the a Mainframe Unit. Would you like to change your name to something else?", "Name change",randomname)
if (length(newname) == 0)
newname = randomname
if (newname)
if (length(newname) >= 26)
newname = copytext(newname, 1, 26)
newname = dd_replacetext(newname, ">", "'")
src.real_name = newname
src.name = newname

View File

@@ -0,0 +1,18 @@
/mob/living/silicon/hivebot/say_understands(var/other)
if (istype(other, /mob/living/silicon/ai))
return 1
if (istype(other, /mob/living/carbon/human))
return 1
if (istype(other, /mob/living/silicon/robot))
return 1
return ..()
/mob/living/silicon/hivebot/say_quote(var/text)
var/ending = copytext(text, length(text))
if (ending == "?")
return "queries, \"[text]\"";
else if (ending == "!")
return "declares, \"[copytext(text, 1, length(text))]\"";
return "states, \"[text]\"";

View File

@@ -0,0 +1,235 @@
/*********************NEW AUTOLATHE / CRAFT LATHE***********************/
var/list/datum/craftlathe_item/CRAFT_ITEMS = list()
var/CRAFT_ITEMS_SETUP = 1 //this should probably be a pre-game thing, but i'll do it so the first lathe2 that's created will set-up the recipes.
proc/check_craftlathe_recipe(var/list/param_recipe)
if(param_recipe.len != 9)
return
var/i
var/match = 0 //this one counts if there is at least one non-"" ingredient.
for(var/datum/craftlathe_item/CI in CRAFT_ITEMS)
match = 0
for(i = 1; i <= 9; i++)
if(CI.recipe[i] != param_recipe[i])
match = 0 //use this so it passes by the match > 0 check below, otherwise i'd need a new variable to tell the return CI below that the check failed
break
if(CI.recipe[i] != "")
match++
if(match > 0)
return CI
return 0
/datum/craftlathe_item
var/id = "" //must be unique for each item type. used to create recipes
var/name = "unknown" //what the lathe will show as it's contents
var/list/recipe = list("","","","","","","","","") //the 9 items here represent what items need to be placed in the lathe to produce this item.
var/item_type = null //this is used on items like sheets which are added when inserted into the lathe.
var/amount = 1
var/amount_attackby = 1
/datum/craftlathe_item/New(var/param_id,var/param_name,var/param_amount,var/param_ammount_per_attackby,var/list/param_recipe,var/param_type = null)
..()
id = param_id
name = param_name
recipe = param_recipe
item_type = param_type
amount = param_amount;
amount_attackby = param_ammount_per_attackby
return
//this proc checks the recipe you give in it's parameter with the entire list of available items. If any match, it returns the item from CRAFT_ITEMS. the returned item should not be changed!!
/obj/machinery/autolathe2
name = "Craft lathe"
icon_state = "autolathe"
density = 1
anchored = 1
var/datum/craftlathe_item/selected = null
var/datum/craftlathe_item/make = null
var/list/datum/craftlathe_item/craft_contents = list()
var/list/current_recipe = list("","","","","","","","","")
/obj/machinery/autolathe2/New()
..()
if(CRAFT_ITEMS_SETUP)
CRAFT_ITEMS_SETUP = 0
build_recipes()
return
/obj/machinery/autolathe2/attack_hand(mob/user as mob)
var/dat
dat = text("<h3>Craft Lathe</h3>")
dat += text("<table><tr><td valign='top'>")
dat += text("<b>Materials</b><p>")
var/datum/craftlathe_item/CI
var/i
for(i = 1; i <= craft_contents.len; i++)
CI = craft_contents[i]
if (CI == selected)
dat += text("[CI.name] ([CI.amount])<br>")
else
dat += text("<A href='?src=\ref[src];select=[i]'>[CI.name]</a> ([CI.amount])<br>")
dat += text("</td><td valign='top'>")
dat += text("<b>Crafting Table</b><p>")
dat += text(" <table bgcolor='#cccccc' cellpadding='4' cellspacing='0'>")
var/j = 0
var/k = 0
for (i = 0; i < 3; i++)
dat += text(" <tr>")
for (j = 1; j <= 3; j++)
k = i * 3 + j
if (current_recipe[k])
dat += text(" <td><A href='?src=\ref[src];remove=[k]'>[current_recipe[k]]</a></td>")
else
dat += text(" <td><A href='?src=\ref[src];add=[k]'>----</a></td>")
dat += text(" </tr>")
dat += text(" </table>")
dat += text("<br><br>")
dat += text("<b>Will make: </b>")
if (make)
dat += text("<A href='?src=\ref[src];make=[1]'>[make.name]</a>")
else
dat += text("nothing useful")
dat += text("</td></tr></table>")
user << browse("[dat]", "window=craft")
/obj/machinery/autolathe2/Topic(href, href_list)
if(..())
return
usr.machine = src
src.add_fingerprint(usr)
if(href_list["remove"])
var/n = text2num(href_list["remove"])
if(!n || n < 1 || n > 9)
return
current_recipe[n] = ""
if(href_list["select"])
var/n = text2num(href_list["select"])
if(!n || n < 1 || n > 9)
return
selected = craft_contents[n]
if(href_list["add"])
var/n = text2num(href_list["add"])
if(!n || n < 1 || n > 9)
return
if(selected)
current_recipe[n] = selected.id
if(href_list["make"])
var/datum/craftlathe_item/MAKE = check_craftlathe_recipe(src.current_recipe)
if(MAKE)
for (var/datum/craftlathe_item/CI2 in craft_contents)
if(CI2.id == MAKE.id)
CI2.amount += CI2.amount_attackby
src.updateUsrDialog()
return
craft_contents += new/datum/craftlathe_item(MAKE.id,MAKE.name,MAKE.amount,MAKE.amount_attackby,MAKE.recipe,MAKE.item_type)
var/datum/craftlathe_item/CI = check_craftlathe_recipe(src.current_recipe)
if(CI)
make = CI
else
make = null
src.updateUsrDialog()
/obj/machinery/autolathe2/attackby(obj/item/weapon/W as obj, mob/user as mob)
usr.machine = src
src.add_fingerprint(usr)
for (var/datum/craftlathe_item/CI in CRAFT_ITEMS)
if(W.type == CI.item_type)
for (var/datum/craftlathe_item/CI2 in craft_contents)
if(CI2.item_type == W.type)
CI2.amount += CI2.amount_attackby
rmv_item(W)
return
craft_contents += new/datum/craftlathe_item(CI.id,CI.name,CI.amount,CI.amount_attackby,CI.recipe,CI.item_type)
rmv_item(W)
return
src.updateUsrDialog()
return
/obj/machinery/autolathe2/proc/rmv_item(obj/item/W as obj)
if(istype(W,/obj/item/stack))
var/obj/item/stack/S = W
S.amount--
if (S.amount <= 0)
del(S)
else
del(W)
/obj/machinery/autolathe2/proc/build_recipes()
//Parameters: ID, Name, Amount, Amount_added_per_attackby, Recipe, Object type
CRAFT_ITEMS += new/datum/craftlathe_item("METAL","Metal",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/metal)
CRAFT_ITEMS += new/datum/craftlathe_item("R METAL","Reinforced Metal",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/r_metal)
CRAFT_ITEMS += new/datum/craftlathe_item("GLASS","Glass",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/glass)
CRAFT_ITEMS += new/datum/craftlathe_item("R GLASS","Reinforced Glass",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/rglass)
CRAFT_ITEMS += new/datum/craftlathe_item("GOLD","Gold",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/gold)
CRAFT_ITEMS += new/datum/craftlathe_item("SILVER","Silver",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/silver)
CRAFT_ITEMS += new/datum/craftlathe_item("DIAMOND","Diamond",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/diamond)
CRAFT_ITEMS += new/datum/craftlathe_item("PLASMA","Plasma",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/plasma)
CRAFT_ITEMS += new/datum/craftlathe_item("URANIUM","Uranium",1,1,list("","","","","","","","",""),/obj/item/weapon/ore/uranium)
CRAFT_ITEMS += new/datum/craftlathe_item("CLOWN","Bananium",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/clown)
CRAFT_ITEMS += new/datum/craftlathe_item("ADMAMANTINE","Adamantine",1,1,list("","","","","","","","",""),/obj/item/stack/sheet/adamantine)
CRAFT_ITEMS += new/datum/craftlathe_item("SCREWS","Screws",9,9,list("","","","","METAL","","","METAL",""))
CRAFT_ITEMS += new/datum/craftlathe_item("COGS","Cogs",9,9,list("","METAL","","METAL","METAL","METAL","","METAL",""))
CRAFT_ITEMS += new/datum/craftlathe_item("SWITCH","Switch",12,12,list("METAL","","METAL","METAL","METAL","","METAL","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("KEYBOARD","Keyboard",1,1,list("","","","SWITCH","SWITCH","SWITCH","SWITCH","SWITCH","SWITCH"))
CRAFT_ITEMS += new/datum/craftlathe_item("M PANEL","Metal Panel",10,10,list("","","","","METAL","METAL","","METAL","METAL"))
CRAFT_ITEMS += new/datum/craftlathe_item("CASE","Equipment Case",1,1,list("M PANEL","M PANEL","M PANEL","M PANEL","","M PANEL","M PANEL","M PANEL","M PANEL"))
CRAFT_ITEMS += new/datum/craftlathe_item("G PANEL","Glass Panel",10,10,list("","","","","GLASS","GLASS","","GLASS","GLASS"))
CRAFT_ITEMS += new/datum/craftlathe_item("SCREEN","Screen",1,1,list("","GLASS","","GLASS","PLASMA","GLASS","","GLASS",""))
CRAFT_ITEMS += new/datum/craftlathe_item("EL SILVER","Electronics Silver",30,30,list("","","","","SILVER","","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("EL GOLD","Electronics Gold",6,6,list("","","","","GOLD","","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("TINTED GL","Tinted Glass",2,2,list("","METAL","","","GLASS","","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("TANK VALVE","Tank Transfer Valuve",1,1,list("","PIPE","","","PIPE","SWITCH","","PIPE",""))
CRAFT_ITEMS += new/datum/craftlathe_item("PIPE","Pipe",1,1,list("","M PANEL","","","M PANEL","","","M PANEL",""))
CRAFT_ITEMS += new/datum/craftlathe_item("CB FRAME","Circuitboard Frame",1,1,list("","","","M PANEL","G PANEL","M PANEL","G PANEL","M PANEL","G PANEL"))
CRAFT_ITEMS += new/datum/craftlathe_item("ROM","ROM Module",1,1,list("EL SILVER","EL SILVER","EL SILVER","EL SILVER","","EL SILVER","EL SILVER","EL SILVER","EL SILVER"))
CRAFT_ITEMS += new/datum/craftlathe_item("RAM","RAM Module",1,1,list("EL SILVER","EL SILVER","EL SILVER","EL SILVER","EL GOLD","EL SILVER","EL SILVER","EL SILVER","EL SILVER"))
CRAFT_ITEMS += new/datum/craftlathe_item("PROCESSOR","Processor",1,1,list("EL GOLD","EL SILVER","EL GOLD","EL SILVER","EL SILVER","EL SILVER","EL SILVER","EL GOLD","EL SILVER"))
CRAFT_ITEMS += new/datum/craftlathe_item("ANTENNA","Antenna",1,1,list("","","EL SILVER","","","EL SILVER","EL SILVER","EL SILVER","EL SILVER"))
CRAFT_ITEMS += new/datum/craftlathe_item("OP RECEPTOR","Optic Receptor",1,1,list("G PANEL","G PANEL","G PANEL","","EL GOLD","","G PANEL","G PANEL","G PANEL"))
CRAFT_ITEMS += new/datum/craftlathe_item("THERMAL OP R","Thermal Optic Receptor",1,1,list("","OP RECEPTOR","","ROM","DIAMOND","DIAMOND","","OP RECEPTOR",""))
CRAFT_ITEMS += new/datum/craftlathe_item("MASON OP R","Mason Optic Receptor",1,1,list("","OP RECEPTOR","","ROM","EL SILVER","EL SILVER","","OP RECEPTOR",""))
CRAFT_ITEMS += new/datum/craftlathe_item("EAR FRAME","Earpiece Frame",1,1,list("M PANEL","M PANEL","M PANEL","M PANEL","","M PANEL","M PANEL","M PANEL",""))
CRAFT_ITEMS += new/datum/craftlathe_item("RADIO M","Radio Module",1,1,list("","ANTENNA","","","ROM","","CB FRAME","CB FRAME","CB FRAME"))
CRAFT_ITEMS += new/datum/craftlathe_item("EARPIECE","Radio Earpiece",1,1,list("","","","","RADIO M","","","EAR FRAME",""))
CRAFT_ITEMS += new/datum/craftlathe_item("EARMUFFS","Earmuffs",1,1,list("","M PANEL","","EAR FRAME","","EAR FRAME","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("GLASSES FRAME","Glasses Frame",1,1,list("M PANEL","","M PANEL","M PANEL","","M PANEL","M PANEL","M PANEL","M PANEL"))
CRAFT_ITEMS += new/datum/craftlathe_item("MASONS","Mason Scanners",1,1,list("","","","MASON OP R","GLASSES FRAME","MASON OP R","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("THERMALS","Thermal Scanners",1,1,list("","","","THERMAL OP R","GLASSES FRAME","THERMAL OP R","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("SUNGLASSES","Sunglasses",1,1,list("","","","TINTED GL","GLASSES FRAME","TINTED GL","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("HELMET FR","Helmet Frame",1,1,list("METAL","METAL","METAL","METAL","","METAL","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("HELMET","Security Helmet",1,1,list("R METAL","R METAL","R METAL","R METAL","HELMET FR","R METAL","","GLASS",""))
CRAFT_ITEMS += new/datum/craftlathe_item("HOS HELMET","HoS Helmet",1,1,list("SILVER","GOLD","SILVER","SILVER","HELMET","SILVER","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("HARDHAT","Hardhat",1,1,list("","FLASHLIGHT","","","HELMET FR","","","",""))
CRAFT_ITEMS += new/datum/craftlathe_item("SWAT HELMET","SWAT Helmet",1,1,list("","","","","HELMET","","R GLASS","R GLASS","R GLASS"))
CRAFT_ITEMS += new/datum/craftlathe_item("WELDING HELM","Welding Helmet",1,1,list("","","","","HELMET FR","","TINTED GL","TINTED GL","TINTED GL"))
CRAFT_ITEMS += new/datum/craftlathe_item("SPACE HELMET","Space Helmet",1,1,list("R METAL","SILVER","R METAL","SILVER","HELMET FR","SILVER","R GLASS","R GLASS","R GLASS"))
CRAFT_ITEMS += new/datum/craftlathe_item("RIG HELMET","RIG Helmet",1,1,list("R METAL","SILVER","R METAL","SILVER","SPACE HELMET","SILVER","R GLASS","R GLASS","R GLASS"))
CRAFT_ITEMS += new/datum/craftlathe_item("GAS MASK","Gas Mask",1,1,list("","","","","HELMET FR","TANK VALVE","","G PANEL",""))
CRAFT_ITEMS += new/datum/craftlathe_item("ARMOR FRAME","Armor Frame",1,1,list("R METAL","","R METAL","R METAL","R METAL","R METAL","R METAL","R METAL","R METAL"))
CRAFT_ITEMS += new/datum/craftlathe_item("ARMOR","Armored Vest",1,1,list("R METAL","","R METAL","R METAL","ARMOR FRAME","R METAL","R METAL","R METAL","R METAL"))
CRAFT_ITEMS += new/datum/craftlathe_item("HOS ARMOR","HoS Armor",1,1,list("DIAMOND","","DIAMOND","URANIUM","ARMOR","URANIUM","URANIUM","R METAL","URANIUM"))
CRAFT_ITEMS += new/datum/craftlathe_item("CAP ARMOR","Captain Armor",1,1,list("DIAMOND","","DIAMOND","URANIUM","HOS ARMOR","URANIUM","URANIUM","R METAL","URANIUM"))
CRAFT_ITEMS += new/datum/craftlathe_item("SPACE S FR","Space Suit Frame",1,1,list("SILVER","","SILVER","SILVER","SILVER","SILVER","SILVER","SILVER","SILVER"))
CRAFT_ITEMS += new/datum/craftlathe_item("SPACE SUIT","Space Suit",1,1,list("SILVER","","SILVER","RAM","SPACE S FR","RADIO M","SILVER","SILVEr","SILVER"))
CRAFT_ITEMS += new/datum/craftlathe_item("RIG SUIT","RIG Suit",1,1,list("SILVER","","SILVER","SILVER","SPACE SUIT","SILVER","SILVER","SILVER","SILVER"))
//TODO: Flashlight, type paths
return
return

View File

@@ -0,0 +1,78 @@
/**********************Gas extractor**************************/
/obj/machinery/mineral/gasextractor
name = "Gas extractor"
desc = "A machine which extracts gasses from ores"
icon = 'computer.dmi'
icon_state = "aiupload"
var/obj/machinery/mineral/input = null
var/obj/machinery/mineral/output = null
var/message = "";
var/processing = 0
var/newtoxins = 0
density = 1
anchored = 1.0
/obj/machinery/mineral/gasextractor/New()
..()
spawn( 5 )
for (var/dir in cardinal)
src.input = locate(/obj/machinery/mineral/input, get_step(src, dir))
if(src.input) break
for (var/dir in cardinal)
src.output = locate(/obj/machinery/mineral/output, get_step(src, dir))
if(src.output) break
return
return
/obj/machinery/mineral/gasextractor/attack_hand(user as mob)
if(processing == 1)
user << "The machine is processing"
return
var/dat
dat = text("input connection status: ")
if (input)
dat += text("<b><font color='green'>CONNECTED</font></b>")
else
dat += text("<b><font color='red'>NOT CONNECTED</font></b>")
dat += text("<br>output connection status: ")
if (output)
dat += text("<b><font color='green'>CONNECTED</font></b>")
else
dat += text("<b><font color='red'>NOT CONNECTED</font></b>")
dat += text("<br><br><A href='?src=\ref[src];extract=[input]'>Extract gas</A>")
dat += text("<br><br>Message: [message]")
user << browse("[dat]", "window=purifier")
/obj/machinery/mineral/gasextractor/Topic(href, href_list)
if(..())
return
usr.machine = src
src.add_fingerprint(usr)
if(href_list["extract"])
if (src.output)
if (locate(/obj/machinery/portable_atmospherics/canister,output.loc))
newtoxins = 0
processing = 1
var/obj/item/weapon/ore/O
while(locate(/obj/item/weapon/ore/plasma, input.loc) && locate(/obj/machinery/portable_atmospherics/canister,output.loc))
O = locate(/obj/item/weapon/ore/plasma, input.loc)
if (istype(O,/obj/item/weapon/ore/plasma))
var/obj/machinery/portable_atmospherics/canister/C
C = locate(/obj/machinery/portable_atmospherics/canister,output.loc)
C.air_contents.toxins += 100
newtoxins += 100
del(O)
sleep(5);
processing = 0;
message = "Canister filled with [newtoxins] units of toxins"
else
message = "No canister found"
src.updateUsrDialog()
return

View File

@@ -0,0 +1,88 @@
/**********************Mineral purifier (not used, replaced with mineral processing unit)**************************/
/obj/machinery/mineral/purifier
name = "Ore Purifier"
desc = "A machine which makes building material out of ores"
icon = 'computer.dmi'
icon_state = "aiupload"
var/obj/machinery/mineral/input = null
var/obj/machinery/mineral/output = null
var/processed = 0
var/processing = 0
density = 1
anchored = 1.0
/obj/machinery/mineral/purifier/attack_hand(user as mob)
if(processing == 1)
user << "The machine is processing"
return
var/dat
dat = text("input connection status: ")
if (input)
dat += text("<b><font color='green'>CONNECTED</font></b>")
else
dat += text("<b><font color='red'>NOT CONNECTED</font></b>")
dat += text("<br>output connection status: ")
if (output)
dat += text("<b><font color='green'>CONNECTED</font></b>")
else
dat += text("<b><font color='red'>NOT CONNECTED</font></b>")
dat += text("<br><br><A href='?src=\ref[src];purify=[input]'>Purify</A>")
dat += text("<br><br>found: <font color='green'><b>[processed]</b></font>")
user << browse("[dat]", "window=purifier")
/obj/machinery/mineral/purifier/Topic(href, href_list)
if(..())
return
usr.machine = src
src.add_fingerprint(usr)
if(href_list["purify"])
if (src.output)
processing = 1;
var/obj/item/weapon/ore/O
processed = 0;
while(locate(/obj/item/weapon/ore, input.loc))
O = locate(/obj/item/weapon/ore, input.loc)
if (istype(O,/obj/item/weapon/ore/iron))
new /obj/item/stack/sheet/metal(output.loc)
del(O)
if (istype(O,/obj/item/weapon/ore/diamond))
new /obj/item/stack/sheet/diamond(output.loc)
del(O)
if (istype(O,/obj/item/weapon/ore/plasma))
new /obj/item/stack/sheet/plasma(output.loc)
del(O)
if (istype(O,/obj/item/weapon/ore/gold))
new /obj/item/stack/sheet/gold(output.loc)
del(O)
if (istype(O,/obj/item/weapon/ore/silver))
new /obj/item/stack/sheet/silver(output.loc)
del(O)
if (istype(O,/obj/item/weapon/ore/uranium))
new /obj/item/weapon/ore/uranium(output.loc)
del(O)
/*if (istype(O,/obj/item/weapon/ore/adamantine))
new /obj/item/weapon/ore/adamantine(output.loc)
del(O)*/ //Dunno what this area does so I'll keep it commented out for now -Durandan
processed++
sleep(5);
processing = 0;
src.updateUsrDialog()
return
/obj/machinery/mineral/purifier/New()
..()
spawn( 5 )
for (var/dir in cardinal)
src.input = locate(/obj/machinery/mineral/input, get_step(src, dir))
if(src.input) break
for (var/dir in cardinal)
src.output = locate(/obj/machinery/mineral/output, get_step(src, dir))
if(src.output) break
return
return

View File

@@ -0,0 +1,174 @@
/**********************Random mine generator************************/
//this item is intended to give the effect of entering the mine, so that light gradually fades
/obj/mine_generator
name = "Random mine generator"
anchored = 1
unacidable = 1
var/turf/last_loc
var/turf/target_loc
var/turf/start_loc
var/randXParam //the value of these two parameters are generated by the code itself and used to
var/randYParam //determine the random XY parameters
var/mineDirection = 3
/*
0 = none
1 = N
2 = NNW
3 = NW
4 = WNW
5 = W
6 = WSW
7 = SW
8 = SSW
9 = S
10 = SSE
11 = SE
12 = ESE
13 = E
14 = ENE
15 = NE
16 = NNE
*/
/obj/mine_generator/New()
last_loc = src.loc
var/i
for(i = 0; i < 50; i++)
gererateTargetLoc()
//target_loc = locate(last_loc.x + rand(5), last_loc.y + rand(5), src.z)
fillWithAsteroids()
del(src)
return
/obj/mine_generator/proc/gererateTargetLoc() //this proc determines where the next square-room will end.
switch(mineDirection)
if(1)
randXParam = 0
randYParam = 4
if(2)
randXParam = 1
randYParam = 3
if(3)
randXParam = 2
randYParam = 2
if(4)
randXParam = 3
randYParam = 1
if(5)
randXParam = 4
randYParam = 0
if(6)
randXParam = 3
randYParam = -1
if(7)
randXParam = 2
randYParam = -2
if(8)
randXParam = 1
randYParam = -3
if(9)
randXParam = 0
randYParam = -4
if(10)
randXParam = -1
randYParam = -3
if(11)
randXParam = -2
randYParam = -2
if(12)
randXParam = -3
randYParam = -1
if(13)
randXParam = -4
randYParam = 0
if(14)
randXParam = -3
randYParam = 1
if(15)
randXParam = -2
randYParam = 2
if(16)
randXParam = -1
randYParam = 3
target_loc = last_loc
if (randXParam > 0)
target_loc = locate(target_loc.x+rand(randXParam),target_loc.y,src.z)
if (randYParam > 0)
target_loc = locate(target_loc.x,target_loc.y+rand(randYParam),src.z)
if (randXParam < 0)
target_loc = locate(target_loc.x-rand(-randXParam),target_loc.y,src.z)
if (randYParam < 0)
target_loc = locate(target_loc.x,target_loc.y-rand(-randXParam),src.z)
if (mineDirection == 1 || mineDirection == 5 || mineDirection == 9 || mineDirection == 13) //if N,S,E,W, turn quickly
if(prob(50))
mineDirection += 2
else
mineDirection -= 2
if(mineDirection < 1)
mineDirection += 16
else
if(prob(50))
if(prob(50))
mineDirection += 1
else
mineDirection -= 1
if(mineDirection < 1)
mineDirection += 16
return
/obj/mine_generator/proc/fillWithAsteroids()
if(last_loc)
start_loc = last_loc
if(start_loc && target_loc)
var/x1
var/y1
var/turf/line_start = start_loc
var/turf/column = line_start
if(start_loc.x <= target_loc.x)
if(start_loc.y <= target_loc.y) //GOING NORTH-EAST
for(y1 = start_loc.y; y1 <= target_loc.y; y1++)
for(x1 = start_loc.x; x1 <= target_loc.x; x1++)
new/turf/simulated/floor/plating/airless/asteroid(column)
column = get_step(column,EAST)
line_start = get_step(line_start,NORTH)
column = line_start
last_loc = target_loc
return
else //GOING NORTH-WEST
for(y1 = start_loc.y; y1 >= target_loc.y; y1--)
for(x1 = start_loc.x; x1 <= target_loc.x; x1++)
new/turf/simulated/floor/plating/airless/asteroid(column)
column = get_step(column,WEST)
line_start = get_step(line_start,NORTH)
column = line_start
last_loc = target_loc
return
else
if(start_loc.y <= target_loc.y) //GOING SOUTH-EAST
for(y1 = start_loc.y; y1 <= target_loc.y; y1++)
for(x1 = start_loc.x; x1 >= target_loc.x; x1--)
new/turf/simulated/floor/plating/airless/asteroid(column)
column = get_step(column,EAST)
line_start = get_step(line_start,SOUTH)
column = line_start
last_loc = target_loc
return
else //GOING SOUTH-WEST
for(y1 = start_loc.y; y1 >= target_loc.y; y1--)
for(x1 = start_loc.x; x1 >= target_loc.x; x1--)
new/turf/simulated/floor/plating/airless/asteroid(column)
column = get_step(column,WEST)
line_start = get_step(line_start,SOUTH)
column = line_start
last_loc = target_loc
return
return

View File

@@ -0,0 +1,338 @@
/**********************Rail track**************************/
/obj/machinery/rail_track
name = "Rail track"
icon = 'Mining.dmi'
icon_state = "rail"
dir = 2
var/id = null //this is needed for switches to work Set to the same on the whole length of the track
anchored = 1
/**********************Rail intersection**************************/
/obj/machinery/rail_track/intersections
name = "Rail track intersection"
icon_state = "rail_intersection"
/obj/machinery/rail_track/intersections/attack_hand(user as mob)
switch (dir)
if (1) dir = 5
if (5) dir = 4
if (4) dir = 9
if (9) dir = 2
if (2) dir = 10
if (10) dir = 8
if (8) dir = 6
if (6) dir = 1
return
/obj/machinery/rail_track/intersections/NSE
name = "Rail track T intersection"
icon_state = "rail_intersection_NSE"
dir = 2
/obj/machinery/rail_track/intersections/NSE/attack_hand(user as mob)
switch (dir)
if (1) dir = 5
if (2) dir = 5
if (5) dir = 9
if (9) dir = 2
return
/obj/machinery/rail_track/intersections/SEW
name = "Rail track T intersection"
icon_state = "rail_intersection_SEW"
dir = 8
/obj/machinery/rail_track/intersections/SEW/attack_hand(user as mob)
switch (dir)
if (8) dir = 6
if (4) dir = 6
if (6) dir = 5
if (5) dir = 8
return
/obj/machinery/rail_track/intersections/NSW
name = "Rail track T intersection"
icon_state = "rail_intersection_NSW"
dir = 2
/obj/machinery/rail_track/intersections/NSW/attack_hand(user as mob)
switch (dir)
if (1) dir = 10
if (2) dir = 10
if (10) dir = 6
if (6) dir = 2
return
/obj/machinery/rail_track/intersections/NEW
name = "Rail track T intersection"
icon_state = "rail_intersection_NEW"
dir = 8
/obj/machinery/rail_track/intersections/NEW/attack_hand(user as mob)
switch (dir)
if (4) dir = 9
if (8) dir = 9
if (9) dir = 10
if (10) dir = 8
return
/**********************Rail switch**************************/
/obj/machinery/rail_switch
name = "Rail switch"
icon = 'Mining.dmi'
icon_state = "rail"
dir = 2
icon = 'recycling.dmi'
icon_state = "switch-off"
var/obj/machinery/rail_track/track = null
var/id //used for to change the track pieces
/obj/machinery/rail_switch/New()
spawn(10)
src.track = locate(/obj/machinery/rail_track, get_step(src, NORTH))
if(track)
id = track.id
return
/obj/machinery/rail_switch/attack_hand(user as mob)
user << "You switch the rail track's direction"
for (var/obj/machinery/rail_track/T in world)
if (T.id == src.id)
var/obj/machinery/rail_car/C = locate(/obj/machinery/rail_car, T.loc)
if (C)
switch (T.dir)
if(1)
switch(C.direction)
if("N") C.direction = "S"
if("S") C.direction = "N"
if("E") C.direction = "S"
if("W") C.direction = "S"
if(2)
switch(C.direction)
if("N") C.direction = "S"
if("S") C.direction = "N"
if("E") C.direction = "S"
if("W") C.direction = "S"
if(4)
switch(C.direction)
if("N") C.direction = "E"
if("S") C.direction = "E"
if("E") C.direction = "W"
if("W") C.direction = "E"
if(8)
switch(C.direction)
if("N") C.direction = "E"
if("S") C.direction = "E"
if("E") C.direction = "W"
if("W") C.direction = "E"
if(5)
switch(C.direction)
if("N") C.direction = "S"
if("S") C.direction = "E"
if("E") C.direction = "S"
if("W") C.direction = "S"
if(6)
switch(C.direction)
if("N") C.direction = "S"
if("S") C.direction = "W"
if("E") C.direction = "S"
if("W") C.direction = "S"
if(9)
switch(C.direction)
if("N") C.direction = "E"
if("S") C.direction = "E"
if("E") C.direction = "N"
if("W") C.direction = "E"
if(10)
switch(C.direction)
if("N") C.direction = "W"
if("S") C.direction = "W"
if("E") C.direction = "W"
if("W") C.direction = "N"
return
/**********************Rail car**************************/
/obj/machinery/rail_car
name = "Rail car"
icon = 'Storage.dmi'
icon_state = "miningcar"
var/direction = "S" //S = south, N = north, E = east, W = west. Determines whichw ay it'll look first
var/moving = 0;
anchored = 1
density = 1
var/speed = 0
var/slowing = 0
var/atom/movable/load = null //what it's carrying
/obj/machinery/rail_car/attack_hand(user as mob)
if (moving == 0)
processing_items.Add(src)
moving = 1
else
processing_items.Remove(src)
moving = 0
return
/*
for (var/client/C)
C << "Dela."
*/
/obj/machinery/rail_car/MouseDrop_T(var/atom/movable/C, mob/user)
if(user.stat)
return
if (!istype(C) || C.anchored || get_dist(user, src) > 1 || get_dist(src,C) > 1 )
return
if(ismob(C))
load(C)
/obj/machinery/rail_car/proc/load(var/atom/movable/C)
if(get_dist(C, src) > 1)
return
//mode = 1
C.loc = src.loc
sleep(2)
C.loc = src
load = C
C.pixel_y += 9
if(C.layer < layer)
C.layer = layer + 0.1
overlays += C
if(ismob(C))
var/mob/M = C
if(M.client)
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
//mode = 0
//send_status()
/obj/machinery/rail_car/proc/unload(var/dirn = 0)
if(!load)
return
overlays = null
load.loc = src.loc
load.pixel_y -= 9
load.layer = initial(load.layer)
if(ismob(load))
var/mob/M = load
if(M.client)
M.client.perspective = MOB_PERSPECTIVE
M.client.eye = src
if(dirn)
step(load, dirn)
load = null
// in case non-load items end up in contents, dump every else too
// this seems to happen sometimes due to race conditions
// with items dropping as mobs are loaded
for(var/atom/movable/AM in src)
AM.loc = src.loc
AM.layer = initial(AM.layer)
AM.pixel_y = initial(AM.pixel_y)
if(ismob(AM))
var/mob/M = AM
if(M.client)
M.client.perspective = MOB_PERSPECTIVE
M.client.eye = src
/obj/machinery/rail_car/relaymove(var/mob/user)
if(user.stat)
return
if(load == user)
unload(0)
return
/obj/machinery/rail_car/process()
if (moving == 1)
if (slowing == 1)
if (speed > 0)
speed--;
if (speed == 0)
slowing = 0
else
if (speed < 10)
speed++;
var/i = 0
for (i = 0; i < speed; i++)
if (moving == 1)
switch (direction)
if ("S")
for (var/obj/machinery/rail_track/R in locate(src.x,src.y-1,src.z))
if (R.dir == 10)
direction = "W"
if (R.dir == 9)
direction = "E"
if (R.dir == 2 || R.dir == 1 || R.dir == 10 || R.dir == 9)
for (var/mob/living/M in locate(src.x,src.y-1,src.z))
step(M,get_dir(src,R))
step(src,get_dir(src,R))
break
else
moving = 0
speed = 0
if ("N")
for (var/obj/machinery/rail_track/R in locate(src.x,src.y+1,src.z))
if (R.dir == 5)
direction = "E"
if (R.dir == 6)
direction = "W"
if (R.dir == 5 || R.dir == 1 || R.dir == 6 || R.dir == 2)
for (var/mob/living/M in locate(src.x,src.y+1,src.z))
step(M,get_dir(src,R))
step(src,get_dir(src,R))
break
else
moving = 0
speed = 0
if ("E")
for (var/obj/machinery/rail_track/R in locate(src.x+1,src.y,src.z))
if (R.dir == 6)
direction = "S"
if (R.dir == 10)
direction = "N"
if (R.dir == 4 || R.dir == 8 || R.dir == 10 || R.dir == 6)
for (var/mob/living/M in locate(src.x+1,src.y,src.z))
step(M,get_dir(src,R))
step(src,get_dir(src,R))
break
else
moving = 0
speed = 0
if ("W")
for (var/obj/machinery/rail_track/R in locate(src.x-1,src.y,src.z))
if (R.dir == 9)
direction = "N"
if (R.dir == 5)
direction = "S"
if (R.dir == 8 || R.dir == 9 || R.dir == 5 || R.dir == 4)
for (var/mob/living/M in locate(src.x-1,src.y,src.z))
step(M,get_dir(src,R))
step(src,get_dir(src,R))
break
else
moving = 0
speed = 0
sleep(1)
else
processing_items.Remove(src)
moving = 0
return

View File

@@ -0,0 +1,173 @@
/**********************Spaceship builder area definitions**************************/
/area/shipbuilder
requires_power = 0
luminosity = 1
sd_lighting = 0
/area/shipbuilder/station
name = "shipbuilder station"
icon_state = "teleporter"
/area/shipbuilder/ship1
name = "shipbuilder ship1"
icon_state = "teleporter"
/area/shipbuilder/ship2
name = "shipbuilder ship2"
icon_state = "teleporter"
/area/shipbuilder/ship3
name = "shipbuilder ship3"
icon_state = "teleporter"
/area/shipbuilder/ship4
name = "shipbuilder ship4"
icon_state = "teleporter"
/area/shipbuilder/ship5
name = "shipbuilder ship5"
icon_state = "teleporter"
/area/shipbuilder/ship6
name = "shipbuilder ship6"
icon_state = "teleporter"
/**********************Spaceship builder**************************/
/obj/machinery/spaceship_builder
name = "Robotic Fabricator"
icon = 'surgery.dmi'
icon_state = "fab-idle"
density = 1
anchored = 1
var/metal_amount = 0
var/operating = 0
var/area/currentShuttleArea = null
var/currentShuttleName = null
/obj/machinery/spaceship_builder/proc/buildShuttle(var/shuttle)
var/shuttleat = null
var/shuttleto = "/area/shipbuilder/station"
var/req_metal = 0
switch(shuttle)
if("hopper")
shuttleat = "/area/shipbuilder/ship1"
currentShuttleName = "Planet hopper"
req_metal = 25000
if("bus")
shuttleat = "/area/shipbuilder/ship2"
currentShuttleName = "Blnder Bus"
req_metal = 60000
if("dinghy")
shuttleat = "/area/shipbuilder/ship3"
currentShuttleName = "Space dinghy"
req_metal = 100000
if("van")
shuttleat = "/area/shipbuilder/ship4"
currentShuttleName = "Boxvan MMDLVI"
req_metal = 120000
if("secvan")
shuttleat = "/area/shipbuilder/ship5"
currentShuttleName = "Boxvan MMDLVI - Security edition"
req_metal = 125000
if("station4")
shuttleat = "/area/shipbuilder/ship6"
currentShuttleName = "Space station 4"
req_metal = 250000
if (metal_amount - req_metal < 0)
return
if (!shuttleat)
return
var/area/from = locate(shuttleat)
var/area/dest = locate(shuttleto)
if(!from || !dest)
return
currentShuttleArea = shuttleat
from.move_contents_to(dest)
return
/obj/machinery/spaceship_builder/proc/scrapShuttle()
var/shuttleat = "/area/shipbuilder/station"
var/shuttleto = currentShuttleArea
if (!shuttleto)
return
var/area/from = locate(shuttleat)
var/area/dest = locate(shuttleto)
if(!from || !dest)
return
currentShuttleArea = null
currentShuttleName = null
from.move_contents_to(dest)
return
/obj/machinery/spaceship_builder/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(operating == 1)
user << "The machine is processing"
return
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
usr << "\red You don't have the dexterity to do this!"
return
if (istype(W, /obj/item/stack/sheet/metal))
var/obj/item/stack/sheet/metal/M = W
user << "\blue You insert all the metal into the machine."
metal_amount += M.amount * 100
del(M)
else
return attack_hand(user)
return
/obj/machinery/spaceship_builder/attack_hand(user as mob)
if(operating == 1)
user << "The machine is processing"
return
var/dat
dat = text("<b>Ship fabricator</b><br><br>")
dat += text("Current ammount of <font color='gray'>Metal: <b>[metal_amount]</b></font><br><hr>")
if (currentShuttleArea)
dat += text("<b>Currently building</b><br><br>[currentShuttleName]<br><br>")
dat += text("<b>Build the shuttle to your liking.</b><br>This shuttle will be sent to the station in the event of an emergency along with a centcom emergency shuttle.")
dat += text("<br><br><br><A href='?src=\ref[src];scrap=1'>Scrap current shuttle</A>")
else
dat += text("<b>Available ships to build:</b><br><br>")
dat += text("<A href='?src=\ref[src];ship=hopper'>Planet hopper</A> - Tiny, Slow, 25000 metal<br>")
dat += text("<A href='?src=\ref[src];ship=bus'>Blunder Bus</A> - Small, Decent speed, 60000 metal<br>")
dat += text("<A href='?src=\ref[src];ship=dinghy'>Space dinghy</A> - Medium size, Decent speed, 100000 metal<br>")
dat += text("<A href='?src=\ref[src];ship=van'>Boxvan MMDLVIr</A> - Medium size, Decent speed, 120000 metal<br>")
dat += text("<A href='?src=\ref[src];ship=secvan'>Boxvan MMDLVI - Security eidition</A> - Large, Rather slow, 125000 metal<br>")
dat += text("<A href='?src=\ref[src];ship=station4'>Space station 4</A> - Huge, Slow, 250000 metal<br>")
user << browse("[dat]", "window=shipbuilder")
/obj/machinery/spaceship_builder/Topic(href, href_list)
if(..())
return
usr.machine = src
src.add_fingerprint(usr)
if(href_list["ship"])
buildShuttle(href_list["ship"])
if(href_list["scrap"])
scrapShuttle(href_list["ship"])
src.updateUsrDialog()
return

View File

@@ -0,0 +1,191 @@
//It's not a very big change, but I think melee will benefit from it.
//Currently will only be restricted to special training weapons to test the balancedness of the system.
//1)Knockdown, stun and weaken chances are separate and dependant on the part of the body you're aiming at
//eg a mop will be better applied to legs since it has a higher base knockdown chance than the other disabling states
//while an energy gun would be better applied to the chest because of the stunning chance.
//2)Weapons also have a parry chance which is checked every time the one wielding the weapon is attacked in melee
//in the area is currently aiming at and is able to defend himself.
//More ideas to come.
//NOTES: doesn't work with armor yet
/obj/item/weapon/training //subclass of weapons that is currently the only one that uses the alternate combat system
name = "training weapon"
desc = "A weapon for training the advanced fighting technicues"
var/chance_parry = 0
var/chance_weaken = 0
var/chance_stun = 0
var/chance_knockdown = 0
var/chance_knockout = 0
var/chance_disarm = 0
//chances - 5 is low, 10 is medium, 15 is good
/obj/item/weapon/training/axe //hard-hitting, but doesn't have much in terms of disabling people (except by killing)
name = "training axe"
icon_state = "training_axe"
/*combat stats*/
force = 15
chance_parry = 5
chance_weaken = 10
chance_stun = 5
chance_knockdown = 5
chance_knockout = 5
chance_disarm = 0
/obj/item/weapon/training/sword //not bad attack, good at parrying and disarming
name = "training sword"
icon_state = "training_sword"
/*combat stats*/
force = 10
chance_parry = 15
chance_weaken = 5
chance_stun = 0
chance_knockdown = 5
chance_knockout = 0
chance_disarm = 15
/obj/item/weapon/training/staff //not bad attack either, good at tripping and parrying
name = "training staff"
icon_state = "training_staff"
/*combat stats*/
force = 10
chance_parry = 15
chance_weaken = 5
chance_stun = 0
chance_knockdown = 15
chance_knockout = 0
chance_disarm = 5
/obj/item/weapon/training/mace //worst attack, but has a good chance of stun, knockout or weaken
name = "training mace"
icon_state = "training_mace"
/*combat stats*/
force = 5
chance_parry = 0
chance_weaken = 15
chance_stun = 10
chance_knockdown = 0
chance_knockout = 10
chance_disarm = 0
/obj/item/weapon/training/attack(target as mob, mob/user as mob)
var/target_area = attack_location(user.zone_sel.selecting)
for(var/mob/O in viewers(src,7))
O << "\red \b [user.name] attacks [target.name] in the [target_area] with [src.name]!"
if(!target.stat && target.zone_sel.selecting == target_area) //parrying occurs here
if(istype(target.r_hand,/obj/item/weapon/training)
if(prob(target.r_hand:chance_parry))
for(var/mob/O in viewers(src,7))
O << "\red \b [target.name] deftly parries the attack with [target.r_hand.name]!"
return
if(istype(target.l_hand,/obj/item/weapon/training)
if(prob(target.l_hand:chance_parry))
for(var/mob/O in viewers(src,7))
O << "\red \b [target.name] deftly parries the attack with [target.l_hand.name]!"
return
target.bruteloss -= src.force
var/modifier_knockdown = 1.0
var/modifier_knockout = 1.0
var/modifier_stun = 1.0
var/modifier_weaken = 1.0
var/modifier_disarm = 0.0
switch(target_area)
if("eyes")
modifier_weaken = 2.0
modifier_stun = 0.5
modifier_knockdown = 0.0
if("head")
modifier_stun = 0.8
modifier_knockout = 1.5
modifier_weaken = 1.2
modifier_knockdown = 0.0
if("chest")
if("right arm","r_arm")
if("left arm","l_arm")
if("right hand","r_hand")
if("left hand","l_hand")
if("groin")
if("right leg","r_leg")
if("left leg","l_leg")
if("right foot","r_foot")
if("left foot","l_foot")
/proc/attack_location(var/initloc = "chest") //proc to randomise actual hit loc based on where you're aiming at
var/resultloc = "chest" //also forgot hands/feet. bleh
var/percentage = rand(1,100)
switch(initloc)
if("eyes")
switch(percentage)
if(1 to 10)
resultloc = "eyes"
if(11 to 30)
resultloc = "head"
if(31 to 100)
resultloc = "chest"
if("head")
switch(percentage)
if(1 to 5)
resultloc = "eyes"
if(6 to 40)
resultloc = "head"
if(41 to 100)
resultloc = "chest"
if("chest")
switch(percentage)
if(1 to 80)
resultloc = "chest"
if(81 to 84)
resultloc = "right arm"
if(85 to 88)
resultloc = "left arm"
if(89 to 92)
resultloc = "right leg"
if(93 to 96)
resultloc = "left leg"
if(97 to 98)
resultloc = "groin"
if(99 to 100)
resultloc = "head"
if("l_arm")
switch(percentage)
if(1 to 60)
resultloc = "left arm"
if(61 to 100)
resultloc = "chest"
if("r_arm")
switch(percentage)
if(1 to 60)
resultloc = "right arm"
if(61 to 100)
resultloc = "chest"
if("groin")
switch(percentage)
if(1 to 35)
resultloc = "groin"
if(36 to 50)
resultloc = "left leg"
if(51 to 65)
resultloc = "right leg"
if(66 to 100)
resultloc = "chest"
if("l_leg")
switch(percentage)
if(1 to 60)
resultloc = "left leg"
if(61 to 70)
resultloc = "groin"
if(71 to 100)
resultloc = "chest"
if("r_leg")
switch(percentage)
if(1 to 60)
resultloc = "right leg"
if(61 to 70)
resultloc = "groin"
if(71 to 100)
resultloc = "chest"
return resultloc

178
code/unused/optics/beam.dm Normal file
View File

@@ -0,0 +1,178 @@
// the laser beam
/obj/beam/laser
name = "laser beam"
icon = 'beam.dmi'
icon_state = "full"
density = 0
mouse_opacity = 0
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
flags = TABLEPASS
var/wavelength // the (vaccuum) wavelength of the beam
var/width = 1 // 1=thin, 2=medium, 3=wide
var/obj/beam/laser/next
var/obj/beam/laser/prev
var/obj/master
New(var/atom/newloc, var/dirn, var/lambda, var/omega=1, var/half=0)
if(!isturf(loc))
return
//world << "creating beam at ([newloc.x],[newloc.y]) with [dirn] [lambda] [omega] [half]"
icon_state = "[omega]-[half ? "half" : "full"]"
dir = dirn
set_wavelength(lambda)
..(newloc)
spawn(0)
src.propagate()
src.verbs -= /atom/movable/verb/pull
proc/propagate()
var/turf/T = get_step(src, dir)
if(T)
if(T.Enter(src))
next = new(T, dir, wavelength, width, 0)
next.prev = src
next.master = src.master
else
spawn(5)
propagate()
proc/remove()
if(next)
next.remove()
del(src)
proc/blocked(var/atom/A)
return density || opacity
/*
/turf/Enter(atom/movable/mover as mob|obj)
if (!mover || !isturf(mover.loc))
return 1
//First, check objects to block exit that are not on the border
for(var/obj/obstacle in mover.loc)
if((obstacle.flags & ~ON_BORDER) && (mover != obstacle) && (forget != obstacle))
if(!obstacle.CheckExit(mover, src))
mover.Bump(obstacle, 1)
return 0
//Now, check objects to block exit that are on the border
for(var/obj/border_obstacle in mover.loc)
if((border_obstacle.flags & ON_BORDER) && (mover != border_obstacle) && (forget != border_obstacle))
if(!border_obstacle.CheckExit(mover, src))
mover.Bump(border_obstacle, 1)
return 0
//Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in src)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != border_obstacle))
mover.Bump(border_obstacle, 1)
return 0
//Then, check the turf itself
if (!src.CanPass(mover, src))
mover.Bump(src, 1)
return 0
//Finally, check objects/mobs to block entry that are not on the border
for(var/atom/movable/obstacle in src)
if(obstacle.flags & ~ON_BORDER)
if(!obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != obstacle))
mover.Bump(obstacle, 1)
return 0
return 1 //Nothing found to block so return success!
*/
HasEntered(var/atom/movable/AM)
if(istype(AM, /obj/beam))
return
if(blocked(AM))
remove(src)
if(prev)
prev.propagate()
else if(master)
master:turn_on()
proc/set_wavelength(var/lambda)
var/w = round(lambda,1) // integer wavelength
wavelength = lambda
// first look for cached version of the icon at this wavelength
var/icon/cached = beam_icons["[w]"]
if(cached)
icon = cached
return
// no cached version, so generate a new one
// this maps a wavelength in the range 380-780 nm to an R,G,B,A value
var/red = 0
var/green = 0
var/blue = 0
var/alpha = 0
switch(w)
if(380 to 439)
red = (440-w) / 60
green = 0
blue = 1
if(440 to 489)
red = 0
green = (w-440) / 50
blue = 1
if(490 to 509)
red = 0
green = 1
blue = (510 - w) / 20
if(510 to 579)
red = (w-510) / 70
green = 1
blue = 0
if(580 to 644)
red = 1
green = (645-w) / 65
blue = 0
if(645 to 780)
red = 1
green = 0
blue = 0
// colour is done, now calculate intensity
switch(w)
if(380 to 419)
alpha = 0.75*(w-380)/40
if(420 to 700)
alpha = 0.75
if(701 to 780)
alpha = 0.75*(780-w)/80
// remap alpha by intensity gamma
if(alpha != 0)
alpha = alpha**0.80
var/icon/I = icon('beam.dmi')
I.MapColors(red,0,0,0, 0,green,0,0, 0,0,blue,0, 0,0,0,alpha, 0,0,0,0)
icon = I
beam_icons["[w]"] = I
// global cache of beam icons
// this is an assoc list mapping (integer) wavelength to icons
var/list/beam_icons = new()

View File

@@ -0,0 +1,73 @@
// A laser pointer. Emits a (tunable) low-power laser beam
// Used for alignment and testing of the optics system
/obj/item/device/laser_pointer
name = "laser pointer"
desc = "A portable low-power laser used for optical system alignment. The label reads: 'Danger: Class IIIa laser device. Avoid direct eye exposure."
icon = 'optics.dmi'
icon_state = "pointer0"
var/on = 0 // true if operating
var/wavelength = 632 // operation wavelength (nm)
var/gain_peak = 632 // gain peak (nm)
var/gain_width = 35 // gain bandwidth (nm)
var/peak_output = 0.005 // max output 5 mW
layer = OBJ_LAYER + 0.1
w_class = 4
m_amt = 500
g_amt = 100
w_amt = 200
var/obj/beam/laser/beam // the created beam
flags = FPRINT | CONDUCT | TABLEPASS
attack_ai()
return
attack_paw()
return
attack_self(var/mob/user)
on = !on
if(on)
turn_on()
else
turn_off()
updateicon()
verb/rotate()
set name = "Rotate"
set src in view(1)
turn_off()
dir = turn(dir, -90)
if(on) turn_on()
Move(var/atom/newloc,var/newdir)
. = ..(newloc,newdir)
if(on && . && isturf(newloc))
turn_off()
turn_on()
return .
proc/turn_on()
if(!isturf(loc))
return
beam = new(loc, dir, wavelength, 1, 1)
beam.master = src
proc/turn_off()
if(beam)
beam.remove()
dropped()
turn_off()
turn_on()
proc/updateicon()
icon_state = "pointer[on]"

View File

@@ -0,0 +1,83 @@
// Mirror object
// Part of the optics system
//
// reflects laser beams
// 16 directional states 0/22.5/45/67.5deg to allow for 0/45deg beam angles
// ideas:
// frame/stand icon w/ mirror directional overlay
// two sets of overlay icons for 0/45 and 22.5/67.5 deg angles
// can rotate cw/acw - need screwdriver to loosen/tighten mirror
// use wrench to anchor/unanchor frame
// if touched, gets dirty - fingerprints, which reduce reflectivity
// if dirty and hit with high-power beam, mirror may shatter
// some kind of dust accumulation with HasProximity? Could check for mob w/o labcoat etc.
// can clean with acetone+wipes
/obj/optical/mirror
icon = 'optical.dmi'
icon_state = "mirrorA"
dir = 1
desc = "A large, optical-grade mirror firmly mounted on a stand."
flags = FPRINT
anchored = 0
var/rotatable = 0 // true if mirror can be rotated
var/angle = 0 // normal of mirror, 0-15. 0=N, 1=NNE, 2=NE, 3=ENE, 4=E etc
New()
..()
set_angle()
//set the angle from icon_state and dir
proc/set_angle()
switch(dir)
if(1)
angle = 0
if(5)
angle = 2
if(4)
angle = 4
if(6)
angle = 6
if(2)
angle = 8
if(10)
angle = 10
if(8)
angle = 12
if(9)
angle = 14
if(icon_state == "mirrorB") // 22.5deg turned states
angle++
return
// set the dir and icon_state from the angle
proc/set_dir()
if(angle%2 == 1)
icon_state = "mirrorB"
else
icon_state = "mirrorA"
switch(round(angle/2)*2)
if(0)
dir = 1
if(2)
dir = 5
if(4)
dir = 4
if(6)
dir = 6
if(8)
dir = 2
if(10)
dir = 10
if(12)
dir = 8
if(14)
dir = 9
return

445
code/unused/pda2/base_os.dm Normal file
View File

@@ -0,0 +1,445 @@
/datum/computer/file/pda_program/os
proc
receive_os_command(list/command_list)
if((!src.holder) || (!src.master) || (!command_list) || !(command_list["command"]))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(!(holder in src.master.contents))
if(master.active_program == src)
master.active_program = null
return 1
return 0
//Main os program: Provides old pda interface and four programs including file browser, notes, messenger, and atmos scan
main_os
name = "ThinkOS 7"
size = 8.0
var/mode = 0
//Note vars
var/note = "Congratulations, your station has chosen the Thinktronic 5150 Personal Data Assistant!"
var/note_mode = 0 //0 For note editor, 1 for note browser
var/datum/computer/file/text/note_file = null //If set, save to this file.
//Messenger vars
var/list/detected_pdas = list()
var/message_on = 1
var/message_silent = 0 //To beep or not to beep, that is the question
var/message_mode = 0 //0 for pda list, 1 for messages
var/message_tone = "beep" //Custom ringtone
var/message_note = null //Current messages in memory (Store as separate file only later??)
//File browser vars
var/datum/computer/folder/browse_folder = null
var/datum/computer/file/clipboard = null //Current file to copy
receive_os_command(list/command_list)
if(..())
return
//world << "[command_list["command"]]"
return
return_text()
if(..())
return
var/dat = src.return_text_header()
switch(src.mode)
if(0)
dat += "<h2>PERSONAL DATA ASSISTANT</h2>"
dat += "Owner: [src.master.owner]<br><br>"
dat += "<h4>General Functions</h4>"
dat += "<ul>"
dat += "<li><a href='byond://?src=\ref[src];mode=1'>Notekeeper</a></li>"
dat += "<li><a href='byond://?src=\ref[src];mode=2'>Messenger</a></li>"
dat += "<li><a href='byond://?src=\ref[src];mode=3'>File Browser</a></li>"
dat += "</ul>"
dat += "<h4>Utilities</h4>"
dat += "<ul>"
dat += "<li><a href='byond://?src=\ref[src];mode=4'>Atmospheric Scan</a></li>"
dat += "<li>Scanner: [src.master.scan_program ? "<a href='byond://?src=\ref[src];scanner=1'>[src.master.scan_program.name]</a>" : "None loaded"]</li>"
dat += "<li><a href='byond://?src=\ref[src];flight=1'>[src.master.fon ? "Disable" : "Enable"] Flashlight</a></li>"
dat += "</ul>"
if(1)
//Note Program. Can save/load note files.
dat += "<h4>Notekeeper V2.5</h4>"
if(!src.note_mode)
dat += "<a href='byond://?src=\ref[src];input=note'>Edit</a>"
dat += " | <a href='byond://?src=\ref[src];note_func=new'>New File</a>"
dat += " | <a href='byond://?src=\ref[src];note_func=save'>Save</a>"
dat += " | <a href='byond://?src=\ref[src];note_func=switchmenu'>Load</a><br>"
dat += src.note
else
dat += " <a href='byond://?src=\ref[src];note_func=switchmenu'>Back</a>"
dat += " | \[[src.holding_folder.holder.file_amount - src.holding_folder.holder.file_used]\] Free<br>"
dat += "<table cellspacing=5>"
for(var/datum/computer/file/text/T in src.holding_folder.contents)
dat += "<tr><td><a href='byond://?src=\ref[src];target=\ref[T];note_func=load'>[T.name]</a></td>"
dat += "<td>[T.extension]</td>"
dat += "<td>Length: [T.data ? (length(T.data)) : "0"]</td></tr>"
dat += "</table>"
if(2)
//Messenger. Uses Radio. Is a messenger.
//TO-DO: ~file sharing~
src.master.overlays = null //Remove existing alerts
dat += "<h4>SpaceMessenger V4.0.5</h4>"
if (!src.message_mode)
dat += "<a href='byond://?src=\ref[src];message_func=ringer'>Ringer: [src.message_silent == 1 ? "Off" : "On"]</a> | "
dat += "<a href='byond://?src=\ref[src];message_func=on'>Send / Receive: [src.message_on == 1 ? "On" : "Off"]</a> | "
dat += "<a href='byond://?src=\ref[src];input=tone'>Set Ringtone</a> | "
dat += "<a href='byond://?src=\ref[src];message_mode=1'>Messages</a><br>"
dat += "<font size=2><a href='byond://?src=\ref[src];message_func=scan'>Scan</a></font><br>"
dat += "<b>Detected PDAs</b><br>"
dat += "<ul>"
var/count = 0
if (src.message_on)
for (var/obj/item/device/pda2/P in src.detected_pdas)
if (!P.owner)
src.detected_pdas -= P
continue
else if (P == src) //I guess this can happen if somebody copies the system file.
src.detected_pdas -= P
continue
dat += "<li><a href='byond://?src=\ref[src];input=message;target=\ref[P]'>[P]</a>"
dat += "</li>"
count++
dat += "</ul>"
if (count == 0)
dat += "None detected.<br>"
else
dat += "<a href='byond://?src=\ref[src];message_func=clear'>Clear</a> | "
dat += "<a href='byond://?src=\ref[src];message_mode=0'>Back</a><br>"
dat += "<h4>Messages</h4>"
dat += src.message_note
dat += "<br>"
if(3)
//File Browser.
//To-do(?): Setting "favorite" programs to access straight from main menu
//Not sure how needed it is, not like they have to go through 500 subfolders or whatever
if((!src.browse_folder) || !(src.browse_folder.holder in src.master))
src.browse_folder = src.holding_folder
dat += " | <a href='byond://?src=\ref[src];target=\ref[src.browse_folder];browse_func=paste'>Paste</a>"
dat += " | Drive: "
dat += "\[<a href='byond://?src=\ref[src];browse_func=drive'>[src.browse_folder.holder == src.master.hd ? "MAIN" : "CART"]</a>\]<br>"
dat += "<b>Contents of [browse_folder] | Drive ID:\[[src.browse_folder.holder.title]]</b><br>"
dat += "<b>Used: \[[src.browse_folder.holder.file_used]/[src.browse_folder.holder.file_amount]\]</b><hr>"
dat += "<table cellspacing=5>"
for(var/datum/computer/file/F in browse_folder.contents)
if(F == src)
dat += "<tr><td>System</td><td>Size: [src.size]</td><td>SYSTEM</td></tr>"
continue
dat += "<tr><td><a href='byond://?src=\ref[src];target=\ref[F];browse_func=open'>[F.name]</a></td>"
dat += "<td>Size: [F.size]</td>"
dat += "<td>[F.extension]</td>"
dat += "<td><a href='byond://?src=\ref[src];target=\ref[F];browse_func=delete'>Del</a></td>"
dat += "<td><a href='byond://?src=\ref[src];target=\ref[F];input=rename'>Rename</a></td>"
dat += "<td><a href='byond://?src=\ref[src];target=\ref[F];browse_func=copy'>Copy</a></td>"
dat += "</tr>"
dat += "</table>"
if(4)
//Atmos Scanner
dat += "<h4>Atmospheric Readings</h4>"
var/turf/T = get_turf_or_move(get_turf(src.master))
if (isnull(T))
dat += "Unable to obtain a reading.<br>"
else
var/datum/gas_mixture/environment = T.return_air()
var/pressure = environment.return_pressure()
var/total_moles = environment.total_moles()
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
if (total_moles)
var/o2_level = environment.oxygen/total_moles
var/n2_level = environment.nitrogen/total_moles
var/co2_level = environment.carbon_dioxide/total_moles
var/plasma_level = environment.toxins/total_moles
var/unknown_level = 1-(o2_level+n2_level+co2_level+plasma_level)
dat += "Nitrogen: [round(n2_level*100)]%<br>"
dat += "Oxygen: [round(o2_level*100)]%<br>"
dat += "Carbon Dioxide: [round(co2_level*100)]%<br>"
dat += "Plasma: [round(plasma_level*100)]%<br>"
if(unknown_level > 0.01)
dat += "OTHER: [round(unknown_level)]%<br>"
dat += "Temperature: [round(environment.temperature-T0C)]&deg;C<br>"
dat += "<br>"
return dat
Topic(href, href_list)
if(..())
return
if(href_list["mode"])
var/newmode = text2num(href_list["mode"])
src.mode = max(newmode, 0)
else if(href_list["flight"])
src.master.toggle_light()
else if(href_list["scanner"])
if(src.master.scan_program)
src.master.scan_program = null
else if(href_list["input"])
switch(href_list["input"])
if("tone")
var/t = input(usr, "Please enter new ringtone", src.name, src.message_tone) as text
if (!t)
return
if (!src.master || !in_range(src.master, usr) && src.master.loc != usr)
return
if(!(src.holder in src.master))
return
t = copytext(sanitize(t), 1, 20)
src.message_tone = t
if("note")
var/t = input(usr, "Please enter note", src.name, src.note) as message
if (!t)
return
if (!src.master || !in_range(src.master, usr) && src.master.loc != usr)
return
if(!(src.holder in src.master))
return
t = copytext(adminscrub(t), 1, MAX_MESSAGE_LEN)
src.note = t
if("message")
var/obj/item/device/pda2/P = locate(href_list["target"])
if(!P || !istype(P))
return
var/t = input(usr, "Please enter message", P.name, null) as text
if (!t)
return
if (!src.master || !in_range(src.master, usr) && src.master.loc != usr)
return
if(!(src.holder in src.master))
return
var/datum/signal/signal = new
signal.data["command"] = "text message"
signal.data["message"] = t
signal.data["sender"] = src.master.owner
signal.data["tag"] = "\ref[P]"
src.post_signal(signal)
src.message_note += "<i><b>&rarr; To [P.owner]:</b></i><br>[t]<br>"
if("rename")
var/datum/computer/file/F = locate(href_list["target"])
if(!F || !istype(F))
return
var/t = input(usr, "Please enter new name", src.name, F.name) as text
t = copytext(sanitize(t), 1, 16)
if (!t)
return
if (!in_range(src.master, usr) || !(F.holder in src.master))
return
if(F.holder.read_only)
return
F.name = capitalize(lowertext(t))
else if(href_list["message_func"]) //Messenger specific topic junk
switch(href_list["message_func"])
if("ringer")
src.message_silent = !src.message_silent
if("on")
src.message_on = !src.message_on
if("clear")
src.message_note = null
if("scan")
if(src.message_on)
src.detected_pdas = list()
var/datum/signal/signal = new
signal.data["command"] = "report pda"
src.post_signal(signal)
else if(href_list["note_func"]) //Note program specific topic junk
switch(href_list["note_func"])
if("new")
src.note_file = null
src.note = null
if("save")
if(src.note_file && src.note_file.holder in src.master)
src.note_file.data = src.note
else
var/datum/computer/file/text/F = new /datum/computer/file/text
if(!src.holding_folder.add_file(F))
del(F)
else
src.note_file = F
F.data = src.note
if("load")
var/datum/computer/file/text/T = locate(href_list["target"])
if(!T || !istype(T))
return
src.note_file = T
src.note = note_file.data
src.note_mode = 0
if("switchmenu")
src.note_mode = !src.note_mode
else if(href_list["browse_func"]) //File browser specific topic junk
var/datum/computer/target = locate(href_list["target"])
switch(href_list["browse_func"])
if("drive")
if(src.browse_folder.holder == src.master.hd && src.master.cartridge && (src.master.cartridge.root))
src.browse_folder = src.master.cartridge.root
else
src.browse_folder = src.holding_folder
if("open")
if(!target || !istype(target))
return
if(istype(target, /datum/computer/file/pda_program))
if(istype(target,/datum/computer/file/pda_program/os) && (src.master.host_program))
return
else
src.master.run_program(target)
src.master.updateSelfDialog()
return
if("delete")
if(!target || !istype(target))
return
src.master.delete_file(target)
if("copy")
if(istype(target,/datum/computer/file) && (!target.holder || (target.holder in src.master.contents)))
src.clipboard = target
if("paste")
if(istype(target,/datum/computer/folder))
if(!src.clipboard || !src.clipboard.holder || !(src.clipboard.holder in src.master.contents))
return
if(!istype(src.clipboard))
return
src.clipboard.copy_file_to_folder(target)
else if(href_list["message_mode"])
var/newmode = text2num(href_list["message_mode"])
src.message_mode = max(newmode, 0)
src.master.add_fingerprint(usr)
src.master.updateSelfDialog()
return
receive_signal(datum/signal/signal)
if(..())
return
switch(signal.data["command"])
if("text message")
if(!message_on || !signal.data["message"])
return
var/sender = signal.data["sender"]
if(!sender)
sender = "!Unknown!"
src.message_note += "<i><b>&larr; From <a href='byond://?src=\ref[src];input=message;target=\ref[signal.source]'>[sender]</a>:</b></i><br>[signal.data["message"]]<br>"
var/alert_beep = null //Don't beep if set to silent.
if(!src.message_silent)
alert_beep = src.message_tone
src.master.display_alert(alert_beep)
src.master.updateSelfDialog()
if("report pda")
if(!message_on)
return
var/datum/signal/newsignal = new
newsignal.data["command"] = "reporting pda"
newsignal.data["tag"] = "\ref[signal.source]"
src.post_signal(newsignal)
if("reporting pda")
if(!detected_pdas)
detected_pdas = new()
if(!(signal.source in detected_pdas))
detected_pdas += signal.source
src.master.updateSelfDialog()
return
return_text_header()
if(!src.master)
return
var/dat
if(src.mode)
dat += " | <a href='byond://?src=\ref[src];mode=0'>Main Menu</a>"
else if (!isnull(src.master.cartridge))
dat += " | <a href='byond://?src=\ref[src.master];eject_cart=1'>Eject [src.master.cartridge]</a>"
dat += " | <a href='byond://?src=\ref[src.master];refresh=1'>Refresh</a>"
return dat

View File

@@ -0,0 +1,185 @@
//Eventual plan: Convert all datum/data to datum/computer/file
/datum/computer/file/text
name = "text"
extension = "TEXT"
size = 2.0
var/data = null
/datum/computer/file/record
name = "record"
extension = "REC"
var/list/fields = list( )
//base pda program
/datum/computer/file/pda_program
name = "blank program"
extension = "PPROG"
var/obj/item/device/pda2/master = null
var/id_tag = null
os
name = "blank system program"
extension = "PSYS"
scan
name = "blank scan program"
extension = "PSCAN"
New(obj/holding as obj)
if(holding)
src.holder = holding
if(istype(src.holder.loc,/obj/item/device/pda2))
src.master = src.holder.loc
proc
return_text()
if((!src.holder) || (!src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(!(holder in src.master.contents))
//world << "Holder [holder] not in [master] of prg:[src]"
if(master.active_program == src)
master.active_program = null
return 1
if(!src.holder.root)
src.holder.root = new /datum/computer/folder
src.holder.root.holder = src
src.holder.root.name = "root"
return 0
process() //This isn't actually used at the moment
if((!src.holder) || (!src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(!(holder in src.master.contents))
if(master.active_program == src)
master.active_program = null
return 1
if(!src.holder.root)
src.holder.root = new /datum/computer/folder
src.holder.root.holder = src
src.holder.root.name = "root"
return 0
//maybe remove this, I haven't found a good use for it yet
send_os_command(list/command_list)
if(!src.master || !src.holder || src.master.host_program || !command_list)
return 1
if(!istype(src.master.host_program) || src.master.host_program == src)
return 1
src.master.host_program.receive_os_command()
return 0
return_text_header()
if(!src.master || !src.holder)
return
var/dat = " | <a href='byond://?src=\ref[src];quit=1'>Main Menu</a>"
dat += " | <a href='byond://?src=\ref[src.master];refresh=1'>Refresh</a>"
return dat
post_signal(datum/signal/signal, newfreq)
if(master)
master.post_signal(signal, newfreq)
else
del(signal)
transfer_holder(obj/item/weapon/disk/data/newholder,datum/computer/folder/newfolder)
if((newholder.file_used + src.size) > newholder.file_amount)
return 0
if(!newholder.root)
newholder.root = new /datum/computer/folder
newholder.root.holder = newholder
newholder.root.name = "root"
if(!newfolder)
newfolder = newholder.root
if((src.holder && src.holder.read_only) || newholder.read_only)
return 0
if((src.holder) && (src.holder.root))
src.holder.root.remove_file(src)
newfolder.add_file(src)
if(istype(newholder.loc,/obj/item/device/pda2))
src.master = newholder.loc
//world << "Setting [src.holder] to [newholder]"
src.holder = newholder
return 1
receive_signal(datum/signal/signal)
if((!src.holder) || (!src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(!(holder in src.master.contents))
if(master.active_program == src)
master.active_program = null
return 1
return 0
Topic(href, href_list)
if((!src.holder) || (!src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(src.master.active_program != src)
return 1
if ((!usr.contents.Find(src.master) && (!in_range(src.master, usr) || !istype(src.master.loc, /turf))) && (!istype(usr, /mob/living/silicon)))
return 1
if(!(holder in src.master.contents))
if(master.active_program == src)
master.active_program = null
return 1
usr.machine = src.master
if (href_list["close"])
usr.machine = null
usr << browse(null, "window=pda2")
return 0
if (href_list["quit"])
// src.master.processing_programs.Remove(src)
if(src.master.host_program && src.master.host_program.holder && (src.master.host_program.holder in src.master.contents))
src.master.run_program(src.master.host_program)
src.master.updateSelfDialog()
return 1
else
src.master.active_program = null
src.master.updateSelfDialog()
return 1
return 0

297
code/unused/pda2/pda2.dm Normal file
View File

@@ -0,0 +1,297 @@
//The advanced pea-green monochrome lcd of tomorrow.
//TO-DO: rearrange all this disk/data stuff so that fixed disks are the parent type
//because otherwise you have carts going into floppy drives and it's ALL MAD
/obj/item/weapon/disk/data/cartridge
name = "Cart 2.0"
desc = "A data cartridge for portable microcomputers."
icon = 'pda.dmi'
icon_state = "cart"
item_state = "electronic"
file_amount = 80.0
title = "ROM Cart"
pda2test
name = "Test Cart"
New()
..()
src.root.add_file( new /datum/computer/file/computer_program/arcade(src))
src.root.add_file( new /datum/computer/file/pda_program/manifest(src))
src.root.add_file( new /datum/computer/file/pda_program/status_display(src))
src.root.add_file( new /datum/computer/file/pda_program/signaler(src))
src.root.add_file( new /datum/computer/file/pda_program/qm_records(src))
src.root.add_file( new /datum/computer/file/pda_program/scan/health_scan(src))
src.root.add_file( new /datum/computer/file/pda_program/records/security(src))
src.root.add_file( new /datum/computer/file/pda_program/records/medical(src))
src.read_only = 1
/obj/item/device/pda2
name = "PDA"
desc = "A portable microcomputer by Thinktronic Systems, LTD. Functionality determined by an EEPROM cartridge."
icon = 'pda.dmi'
icon_state = "pda"
item_state = "electronic"
w_class = 2.0
flags = FPRINT | TABLEPASS | ONBELT
var/owner = null
var/default_cartridge = null // Access level defined by cartridge
var/obj/item/weapon/disk/data/cartridge/cartridge = null //current cartridge
var/datum/computer/file/pda_program/active_program = null
var/datum/computer/file/pda_program/os/host_program = null
var/datum/computer/file/pda_program/scan/scan_program = null
var/obj/item/weapon/disk/data/fixed_disk/hd = null
var/fon = 0 //Is the flashlight function on?
var/f_lum = 3 //Luminosity for the flashlight function
// var/datum/data/record/active1 = null //General
// var/datum/data/record/active2 = null //Medical
// var/datum/data/record/active3 = null //Security
// var/obj/item/weapon/integrated_uplink/uplink = null //Maybe replace uplink with some remote ~syndicate~ server
var/frequency = 1149
var/datum/radio_frequency/radio_connection
var/setup_default_cartridge = null //Cartridge contains job-specific programs
var/setup_drive_size = 24.0 //PDAs don't have much work room at all, really.
var/setup_system_os_path = /datum/computer/file/pda_program/os/main_os //Needs an operating system to...operate!!
/obj/item/device/pda2/pickup(mob/user)
if (src.fon)
src.sd_SetLuminosity(0)
user.sd_SetLuminosity(user.luminosity + src.f_lum)
/obj/item/device/pda2/dropped(mob/user)
if (src.fon)
user.sd_SetLuminosity(user.luminosity - src.f_lum)
src.sd_SetLuminosity(src.f_lum)
/obj/item/device/pda2/New()
..()
spawn(5)
src.hd = new /obj/item/weapon/disk/data/fixed_disk(src)
src.hd.file_amount = src.setup_drive_size
src.hd.name = "Minidrive"
src.hd.title = "Minidrive"
if(src.setup_system_os_path)
src.host_program = new src.setup_system_os_path
src.hd.file_amount = max(src.hd.file_amount, src.host_program.size)
src.host_program.transfer_holder(src.hd)
if(radio_controller)
radio_controller.add_object(src, frequency)
if (src.default_cartridge)
src.cartridge = new src.setup_default_cartridge(src)
// if(src.owner)
// processing_items.Add(src)
/obj/item/device/pda2/attack_self(mob/user as mob)
user.machine = src
var/dat = "<html><head><title>Personal Data Assistant</title></head><body>"
dat += "<a href='byond://?src=\ref[src];close=1'>Close</a>"
if (!src.owner)
if(src.cartridge)
dat += " | <a href='byond://?src=\ref[src];eject_cart=1'>Eject [src.cartridge]</a>"
dat += "<br>Warning: No owner information entered. Please swipe card.<br><br>"
dat += "<a href='byond://?src=\ref[src];refresh=1'>Retry</a>"
else
if(src.active_program)
dat += src.active_program.return_text()
else
if(src.host_program)
src.run_program(src.host_program)
dat += src.active_program.return_text()
else
if(src.cartridge)
dat += " | <a href='byond://?src=\ref[src];eject_cart=1'>Eject [src.cartridge]</a><br>"
dat += "<center><font color=red>Fatal Error 0x17<br>"
dat += "No System Software Loaded</font></center>"
//To-do: System recovery shit (maybe have a dedicated computer for this kind of thing)
user << browse(dat,"window=pda2")
onclose(user,"pda2")
return
/obj/item/device/pda2/Topic(href, href_list)
..()
if (usr.contents.Find(src) || usr.contents.Find(src.master) || (istype(src.loc, /turf) && get_dist(src, usr) <= 1))
if (usr.stat || usr.restrained())
return
src.add_fingerprint(usr)
usr.machine = src
if(href_list["return_to_host"])
if(src.host_program)
src.active_program = src.host_program
src.host_program = null
else if (href_list["eject_cart"])
src.eject_cartridge()
else if (href_list["refresh"])
src.updateSelfDialog()
else if (href_list["close"])
usr << browse(null, "window=pda2")
usr.machine = null
src.updateSelfDialog()
return
/obj/item/device/pda2/attackby(obj/item/weapon/C as obj, mob/user as mob)
if (istype(C, /obj/item/weapon/disk/data/cartridge) && isnull(src.cartridge))
user.drop_item()
C.loc = src
user << "\blue You insert [C] into [src]."
src.cartridge = C
src.updateSelfDialog()
else if (istype(C, /obj/item/weapon/card/id) && !src.owner && C:registered)
src.owner = C:registered
src.name = "PDA-[src.owner]"
user << "\blue Card scanned."
src.updateSelfDialog()
/obj/item/device/pda2/receive_signal(datum/signal/signal)
if(!signal || signal.encryption || !src.owner) return
if(signal.data["tag"] && signal.data["tag"] != "\ref[src]") return
if(src.host_program)
src.host_program.receive_signal(signal)
if(src.active_program && (src.active_program != src.host_program))
src.host_program.receive_signal(signal)
return
/obj/item/device/pda2/attack(mob/M as mob, mob/user as mob)
if(src.scan_program)
return
else
..()
/obj/item/device/pda2/afterattack(atom/A as mob|obj|turf|area, mob/user as mob)
var/scan_dat = null
if(src.scan_program && istype(src.scan_program))
scan_dat = src.scan_program.scan_atom(A)
if(scan_dat)
A.visible_message("\red [user] has scanned [A]!")
user.show_message(scan_dat, 1)
return
/obj/item/device/pda2/proc
post_signal(datum/signal/signal,var/newfreq)
if(!signal)
return
var/freq = newfreq
if(!freq)
freq = src.frequency
signal.source = src
var/datum/radio_frequency/frequency = radio_controller.return_frequency(freq)
signal.transmission_method = TRANSMISSION_RADIO
if(frequency)
return frequency.post_signal(src, signal)
else
del(signal)
eject_cartridge()
if(src.cartridge)
var/turf/T = get_turf(src)
if(src.active_program && (src.active_program.holder == src.cartridge))
src.active_program = null
if(src.host_program && (src.host_program.holder == src.cartridge))
src.host_program = null
if(src.scan_program && (src.scan_program.holder == src.cartridge))
src.scan_program = null
src.cartridge.loc = T
src.cartridge = null
return
//Toggle the built-in flashlight
toggle_light()
src.fon = (!src.fon)
if (ismob(src.loc))
if (src.fon)
src.loc.sd_SetLuminosity(src.loc.luminosity + src.f_lum)
else
src.loc.sd_SetLuminosity(src.loc.luminosity - src.f_lum)
else
src.sd_SetLuminosity(src.fon * src.f_lum)
src.updateSelfDialog()
display_alert(var/alert_message) //Add alert overlay and beep
if (alert_message)
playsound(src.loc, 'twobeep.ogg', 50, 1)
for (var/mob/O in hearers(3, src.loc))
O.show_message(text("\icon[src] *[alert_message]*"))
src.overlays = null
src.overlays += image('pda.dmi', "pda-r")
return
run_program(datum/computer/file/pda_program/program)
if((!program) || (!program.holder))
return 0
if(!(program.holder in src))
// world << "Not in src"
program = new program.type
program.transfer_holder(src.hd)
if(program.master != src)
program.master = src
if(!src.host_program && istype(program, /datum/computer/file/pda_program/os))
src.host_program = program
if(istype(program, /datum/computer/file/pda_program/scan))
if(program == src.scan_program)
src.scan_program = null
else
src.scan_program = program
return 1
src.active_program = program
return 1
delete_file(datum/computer/file/file)
//world << "Deleting [file]..."
if((!file) || (!file.holder) || (file.holder.read_only))
//world << "Cannot delete :("
return 0
//Don't delete the running program you jerk
if(src.active_program == file || src.host_program == file)
src.active_program = null
//world << "Now calling del on [file]..."
del(file)
return 1

View File

@@ -0,0 +1,181 @@
//CONTENTS:
//Generic records
//Security records
//Medical records
/datum/computer/file/pda_program/records
var/mode = 0
var/datum/data/record/active1 = null //General
var/datum/data/record/active2 = null //Security/Medical/Whatever
//To-do: editing arrest status/etc from pda.
/datum/computer/file/pda_program/records/security
name = "Security Records"
size = 12.0
return_text()
if(..())
return
var/dat = src.return_text_header()
switch(src.mode)
if(0)
dat += "<h4>Security Record List</h4>"
for (var/datum/data/record/R in data_core.general)
dat += "<a href='byond://?src=\ref[src];select_rec=\ref[R]'>[R.fields["id"]]: [R.fields["name"]]<br>"
dat += "<br>"
if(1)
dat += "<h4>Security Record</h4>"
dat += "<a href='byond://?src=\ref[src];mode=0'>Back</a><br>"
if (istype(src.active1, /datum/data/record) && data_core.general.Find(src.active1))
dat += "Name: [src.active1.fields["name"]] ID: [src.active1.fields["id"]]<br>"
dat += "Sex: [src.active1.fields["sex"]]<br>"
dat += "Age: [src.active1.fields["age"]]<br>"
dat += "Fingerprint: [src.active1.fields["fingerprint"]]<br>"
dat += "Physical Status: [src.active1.fields["p_stat"]]<br>"
dat += "Mental Status: [src.active1.fields["m_stat"]]<br>"
else
dat += "<b>Record Lost!</b><br>"
dat += "<br>"
dat += "<h4>Security Data</h4>"
if (istype(src.active2, /datum/data/record) && data_core.security.Find(src.active2))
dat += "Criminal Status: [src.active2.fields["criminal"]]<br>"
dat += "Minor Crimes: [src.active2.fields["mi_crim"]]<br>"
dat += "Details: [src.active2.fields["mi_crim"]]<br><br>"
dat += "Major Crimes: [src.active2.fields["ma_crim"]]<br>"
dat += "Details: [src.active2.fields["ma_crim_d"]]<br><br>"
dat += "Important Notes:<br>"
dat += "[src.active2.fields["notes"]]"
else
dat += "<b>Record Lost!</b><br>"
dat += "<br>"
return dat
Topic(href, href_list)
if(..())
return
if(href_list["mode"])
var/newmode = text2num(href_list["mode"])
src.mode = max(newmode, 0)
else if(href_list["select_rec"])
var/datum/data/record/R = locate(href_list["select_rec"])
var/datum/data/record/S = locate(href_list["select_rec"])
if (data_core.general.Find(R))
for (var/datum/data/record/E in data_core.security)
if ((E.fields["name"] == R.fields["name"] || E.fields["id"] == R.fields["id"]))
S = E
break
src.active1 = R
src.active2 = S
src.mode = 1
src.master.add_fingerprint(usr)
src.master.updateSelfDialog()
return
/datum/computer/file/pda_program/records/medical
name = "Medical Records"
size = 8.0
return_text()
if(..())
return
var/dat = src.return_text_header()
switch(src.mode)
if(0)
dat += "<h4>Medical Record List</h4>"
for (var/datum/data/record/R in data_core.general)
dat += "<a href='byond://?src=\ref[src];select_rec=\ref[R]'>[R.fields["id"]]: [R.fields["name"]]<br>"
dat += "<br>"
if(1)
dat += "<h4>Medical Record</h4>"
dat += "<a href='byond://?src=\ref[src];mode=0'>Back</a><br>"
if (istype(src.active1, /datum/data/record) && data_core.general.Find(src.active1))
dat += "Name: [src.active1.fields["name"]] ID: [src.active1.fields["id"]]<br>"
dat += "Sex: [src.active1.fields["sex"]]<br>"
dat += "Age: [src.active1.fields["age"]]<br>"
dat += "Fingerprint: [src.active1.fields["fingerprint"]]<br>"
dat += "Physical Status: [src.active1.fields["p_stat"]]<br>"
dat += "Mental Status: [src.active1.fields["m_stat"]]<br>"
else
dat += "<b>Record Lost!</b><br>"
dat += "<br>"
dat += "<h4>Medical Data</h4>"
if (istype(src.active2, /datum/data/record) && data_core.medical.Find(src.active2))
dat += "Blood Type: [src.active2.fields["b_type"]]<br><br>"
dat += "Minor Disabilities: [src.active2.fields["mi_dis"]]<br>"
dat += "Details: [src.active2.fields["mi_dis_d"]]<br><br>"
dat += "Major Disabilities: [src.active2.fields["ma_dis"]]<br>"
dat += "Details: [src.active2.fields["ma_dis_d"]]<br><br>"
dat += "Allergies: [src.active2.fields["alg"]]<br>"
dat += "Details: [src.active2.fields["alg_d"]]<br><br>"
dat += "Current Diseases: [src.active2.fields["cdi"]]<br>"
dat += "Details: [src.active2.fields["cdi_d"]]<br><br>"
dat += "Important Notes: [src.active2.fields["notes"]]<br>"
else
dat += "<b>Record Lost!</b><br>"
dat += "<br>"
return dat
Topic(href, href_list)
if(..())
return
if(href_list["mode"])
var/newmode = text2num(href_list["mode"])
src.mode = max(newmode, 0)
else if(href_list["select_rec"])
var/datum/data/record/R = locate(href_list["select_rec"])
var/datum/data/record/M = locate(href_list["select_rec"])
if (data_core.general.Find(R))
for (var/datum/data/record/E in data_core.medical)
if ((E.fields["name"] == R.fields["name"] || E.fields["id"] == R.fields["id"]))
M = E
break
src.active1 = R
src.active2 = M
src.mode = 1
src.master.add_fingerprint(usr)
src.master.updateSelfDialog()
return

View File

@@ -0,0 +1,101 @@
//CONTENTS:
//Base scanner stuff
//Health scanner
//Forensic scanner
//Reagent scanner
/datum/computer/file/pda_program/scan
return_text()
return src.return_text_header()
proc/scan_atom(atom/A as mob|obj|turf|area)
if( !A || (!src.holder) || (!src.master))
return 1
if((!istype(holder)) || (!istype(master)))
return 1
if(!(holder in src.master.contents))
if(master.scan_program == src)
master.scan_program = null
return 1
return 0
//Health analyzer program
health_scan
name = "Health Scan"
size = 8.0
scan_atom(atom/A as mob|obj|turf|area)
if(..())
return
var/mob/living/carbon/C = A
if(!istype(C))
return
var/dat = "\blue Analyzing Results for [C]:\n"
dat += "\blue \t Overall Status: [C.stat > 1 ? "dead" : "[C.health]% healthy"]\n"
dat += "\blue \t Damage Specifics: [C.oxyloss > 50 ? "\red" : "\blue"][C.oxyloss]-[C.toxloss > 50 ? "\red" : "\blue"][C.toxloss]-[C.fireloss > 50 ? "\red" : "\blue"][C.fireloss]-[C.bruteloss > 50 ? "\red" : "\blue"][C.bruteloss]\n"
dat += "\blue \t Key: Suffocation/Toxin/Burns/Brute\n"
dat += "\blue \t Body Temperature: [C.bodytemperature-T0C]&deg;C ([C.bodytemperature*1.8-459.67]&deg;F)"
if(C.virus)
dat += "\red \n<b>Warning Virus Detected.</b>\nName: [C.virus.name].\nType: [C.virus.spread].\nStage: [C.virus.stage]/[C.virus.max_stages].\nPossible Cure: [C.virus.cure]"
return dat
//Forensic scanner
forensic_scan
name = "Forensic Scan"
size = 8.0
scan_atom(atom/A as mob|obj|turf|area)
if(..())
return
var/dat = null
if(istype(A,/mob/living/carbon/human))
var/mob/living/carbon/human/H = A
if (!istype(H.dna, /datum/dna) || !isnull(H.gloves))
dat += "\blue Unable to scan [A]'s fingerprints.\n"
else
dat += "\blue [H]'s Fingerprints: [md5(H.dna.uni_identity)]\n"
if ( !(H.blood_DNA) )
dat += "\blue No blood found on [H]\n"
else
dat += "\blue Blood type: [H.blood_type]\nDNA: [H.blood_DNA]\n"
if (!A.fingerprints)
dat += "\blue Unable to locate any fingerprints on [A]!\n"
else
var/list/L = params2list(A:fingerprints)
dat += "\blue Isolated [L.len] fingerprints.\n"
for(var/i in L)
dat += "\blue \t [i]\n"
return dat
//Reagent scanning program
reagent_scan
name = "Reagent Scan"
size = 6.0
scan_atom(atom/A as mob|obj|turf|area)
if(..())
return
var/dat = null
if(!isnull(A.reagents))
if(A.reagents.reagent_list.len > 0)
var/reagents_length = A.reagents.reagent_list.len
dat += "\blue [reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found.\n"
for (var/datum/reagent/re in A.reagents.reagent_list)
dat += "\blue \t [re] - [re.volume]\n"
else
dat = "\blue No active chemical agents found in [A]."
else
dat = "\blue No significant chemical agents found in [A]."
return dat

View File

@@ -0,0 +1,204 @@
//Assorted small programs not worthy of their own file
//CONTENTS:
//Crew Manifest viewer
//Status display controller
//Remote signaling program
//Cargo orders monitor
//Manifest
/datum/computer/file/pda_program/manifest
name = "Manifest"
return_text()
if(..())
return
var/dat = src.return_text_header()
dat += "<h4>Crew Manifest</h4>"
dat += "Entries cannot be modified from this terminal.<br><br>"
for (var/datum/data/record/t in data_core.general)
dat += "[t.fields["name"]] - [t.fields["rank"]]<br>"
dat += "<br>"
return dat
//Status Display
/datum/computer/file/pda_program/status_display
name = "Status Controller"
size = 8.0
var/message1 // For custom messages on the displays.
var/message2
return_text()
if(..())
return
var/dat = src.return_text_header()
dat += "<h4>Station Status Display Interlink</h4>"
dat += "\[ <A HREF='?src=\ref[src];statdisp=blank'>Clear</A> \]<BR>"
dat += "\[ <A HREF='?src=\ref[src];statdisp=shuttle'>Shuttle ETA</A> \]<BR>"
dat += "\[ <A HREF='?src=\ref[src];statdisp=message'>Message</A> \]"
dat += "<ul><li> Line 1: <A HREF='?src=\ref[src];statdisp=setmsg1'>[ message1 ? message1 : "(none)"]</A>"
dat += "<li> Line 2: <A HREF='?src=\ref[src];statdisp=setmsg2'>[ message2 ? message2 : "(none)"]</A></ul><br>"
dat += "\[ Alert: <A HREF='?src=\ref[src];statdisp=alert;alert=default'>None</A> |"
dat += " <A HREF='?src=\ref[src];statdisp=alert;alert=redalert'>Red Alert</A> |"
dat += " <A HREF='?src=\ref[src];statdisp=alert;alert=lockdown'>Lockdown</A> |"
dat += " <A HREF='?src=\ref[src];statdisp=alert;alert=biohazard'>Biohazard</A> \]<BR>"
return dat
Topic(href, href_list)
if(..())
return
if(href_list["statdisp"])
switch(href_list["statdisp"])
if("message")
post_status("message", message1, message2)
if("alert")
post_status("alert", href_list["alert"])
if("setmsg1")
message1 = input("Line 1", "Enter Message Text", message1) as text|null
if (!src.master || !in_range(src.master, usr) && src.master.loc != usr)
return
if(!(src.holder in src.master))
return
src.master.updateSelfDialog()
if("setmsg2")
message2 = input("Line 2", "Enter Message Text", message2) as text|null
if (!src.master || !in_range(src.master, usr) && src.master.loc != usr)
return
if(!(src.holder in src.master))
return
src.master.updateSelfDialog()
else
post_status(href_list["statdisp"])
src.master.add_fingerprint(usr)
src.master.updateSelfDialog()
return
proc/post_status(var/command, var/data1, var/data2)
if(!src.master)
return
var/datum/signal/status_signal = new
status_signal.source = src.master
status_signal.transmission_method = 1
status_signal.data["command"] = command
switch(command)
if("message")
status_signal.data["msg1"] = data1
status_signal.data["msg2"] = data2
if("alert")
status_signal.data["picture_state"] = data1
src.post_signal(status_signal,"1435")
//Signaler
/datum/computer/file/pda_program/signaler
name = "Signalix 5"
size = 8.0
var/send_freq = 1457 //Frequency signal is sent at, should be kept within normal radio ranges.
var/send_code = 30
var/last_transmission = 0 //No signal spamming etc
return_text()
if(..())
return
var/dat = src.return_text_header()
dat += "<h4>Remote Signaling System</h4>"
dat += {"
<a href='byond://?src=\ref[src];send=1'>Send Signal</A><BR>
Frequency:
<a href='byond://?src=\ref[src];adj_freq=-10'>-</a>
<a href='byond://?src=\ref[src];adj_freq=-2'>-</a>
[format_frequency(send_freq)]
<a href='byond://?src=\ref[src];adj_freq=2'>+</a>
<a href='byond://?src=\ref[src];adj_freq=10'>+</a><br>
<br>
Code:
<a href='byond://?src=\ref[src];adj_code=-5'>-</a>
<a href='byond://?src=\ref[src];adj_code=-1'>-</a>
[send_code]
<a href='byond://?src=\ref[src];adj_code=1'>+</a>
<a href='byond://?src=\ref[src];adj_code=5'>+</a><br>"}
return dat
Topic(href, href_list)
if(..())
return
if (href_list["send"])
if(last_transmission && world.time < (last_transmission + 5))
return
last_transmission = world.time
spawn( 0 )
var/time = time2text(world.realtime,"hh:mm:ss")
lastsignalers.Add("[time] <B>:</B> [usr.key] used [src.master] @ location ([src.master.loc.x],[src.master.loc.y],[src.master.loc.z]) <B>:</B> [format_frequency(send_freq)]/[send_code]")
var/datum/signal/signal = new
signal.source = src
signal.encryption = send_code
signal.data["message"] = "ACTIVATE"
src.post_signal(signal,"[send_freq]")
return
else if (href_list["adj_freq"])
src.send_freq = sanitize_frequency(src.send_freq + text2num(href_list["adj_freq"]))
else if (href_list["adj_code"])
src.send_code += text2num(href_list["adj_code"])
src.send_code = round(src.send_code)
src.send_code = min(100, src.send_code)
src.send_code = max(1, src.send_code)
src.master.add_fingerprint(usr)
src.master.updateSelfDialog()
return
//Supply record monitor
/datum/computer/file/pda_program/qm_records
name = "Supply Records"
size = 8.0
return_text()
if(..())
return
var/dat = src.return_text_header()
dat += "<h4>Supply Record Interlink</h4>"
dat += "<BR><B>Supply shuttle</B><BR>"
dat += "Location: [supply_shuttle_moving ? "Moving to station ([supply_shuttle_timeleft] Mins.)":supply_shuttle_at_station ? "Station":"Dock"]<BR>"
dat += "Current approved orders: <BR><ol>"
for(var/S in supply_shuttle_shoppinglist)
var/datum/supply_order/SO = S
dat += "<li>[SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]</li>"
dat += "</ol>"
dat += "Current requests: <BR><ol>"
for(var/S in supply_shuttle_requestlist)
var/datum/supply_order/SO = S
dat += "<li>[SO.object.name] requested by [SO.orderedby]</li>"
dat += "</ol><font size=\"-3\">Upgrade NOW to Space Parts & Space Vendors PLUS for full remote order control and inventory management."
return dat

View File

@@ -0,0 +1,249 @@
// Entirely unfinished. Mostly just bouncing ideas off the code.
// Smelting
// Grinding
// Spraying
// Crate
/obj/deploycrate
icon = 'mining.dmi'
icon_state = "deploycrate"
density = 1
var
payload
/obj/deploycrate/attack_hand(mob/user as mob)
switch(payload)
if(null)
return
//if("cloner")
// make a cloner
// blah blah
for (var/mob/V in hearers(src))
V.show_message("[src] lets out a pneumatic hiss, its panels rapdily unfolding and expanding to produce its payload.", 2)
del(src)
/obj/machinery/nanosprayer
icon = 'mining.dmi'
icon_state = "sprayer"
density = 1
anchored = 1
var
payload
hacked = 0
temp = 100
usr_density = 5
usr_lastupdate = 0
time_started = 0
points = 0
totalpoints = 0
state = 0 // 0 - Idle, 1 - Spraying, 2 - Done, 3 - Overheated
obj/machinery/nanosprayer/proc/update_temp()
// 1 second : 1 degree
if(src.state == 0)
var/diff = (world.time - usr_lastupdate) * 10
temp -= diff
if(temp < 100)
temp = 100
usr_lastupdate = world.time
return temp
else if(src.state == 1)
var/diff = (world.time - usr_lastupdate) * 10
diff = diff * usr_density
temp += diff
usr_lastupdate = world.time
return temp
obj/machinery/nanosprayer/process()
src.time_started = world.time
totalpoints = lentext(payload) * rand(5,10)
if(!totalpoints)
totalpoints = 1
while(src.state == 1)
// Each unit of cost is 20 seconds - density
temp += density * rand(1,4)
sleep(200 - (usr_density * 10))
if(src.temp > 350)
src.state = 3
src.overheat()
return 0
points += usr_density
if(points >= totalpoints)
src.state = 2
src.complete()
return 1
obj/machinery/nanosprayer/proc/cooldown()
while(state != 1)
sleep(200)
temp -= rand(5,20)
if(temp < 100)
temp = 100
return
obj/machinery/nanosprayer/proc/overheat()
return
obj/machinery/nanosprayer/proc/complete()
src.totalpoints = 0
src.points = 0
spawn() cooldown()
return
obj/machinery/nanosprayer/attack_hand(user as mob)
var/dat
if(..())
return
dat += text("Core Temp: [temp]<5D>C<BR>")
dat += text("Nanocloud Density: [usr_density] million<BR>")
dat += text("\[<A href='?src=\ref[src];minus=1'>-</A> / <A href='?src=\ref[src];plus=1'>+</A>\]<BR>")
if(payload)
dat += text("<BR>Task: [payload]<BR>")
switch(state)
if(0)
dat += text("Status: Idling<BR>")
if(1)
dat += text("Status: Spraying<BR>")
if(2)
dat += text("Status: Spray Task Complete<BR>")
if(3)
dat += text("Status: <B><FONT COLOR=RED>OVERHEATED</FONT><BR>")
if(state == 1)
if(points <= 0)
points = 1
var/complete = (points * 100)/totalpoints
if(complete < 0)
complete = 0
if(complete > 100)
complete = 100
dat += text("Progress: <B>[complete]%</B><BR>")
if(state == 2)
dat += text("Progress: <B>100%</B><BR>")
dat += text("\[<A href='?src=\ref[src];release=1'>Release Payload</A>\]<BR>")
dat += text("<HR><BR><A href='?src=\ref[src];settask=1'>Set Task</A><BR>")
dat += text("<A href='?src=\ref[src];start=1'>Start Spray</A><BR>")
dat += text("<A href='?src=\ref[src];stop=1'>Cancel Spray</A>")
dat += text("<BR><BR><A href='?src=\ref[src];refresh=1'>Refresh</A>")
user << browse("<HEAD><TITLE>NANO SPRAY 1.1</TITLE></HEAD><TT>[dat]</TT>", "window=nanosprayer")
onclose(user, "nanosprayer")
obj/machinery/nanosprayer/Topic(href, href_list)
if(..())
return
usr.machine = src
src.add_fingerprint(usr)
if(href_list["plus"])
usr_density += 1
if(href_list["minus"])
usr_density -= 1
if(usr_density < 1)
usr_density = 1
if(href_list["start"])
if(state == 0)
state = 1
spawn() src.process()
if(href_list["stop"])
if(state == 1)
state = 0
points = 0
totalpoints = 0
spawn() cooldown()
if(href_list["settask"])
if(state == 0)
var/temppayload = input("Set a Task:", "Job Assignment") as text|null
if(temppayload)
payload = temppayload
//if(href_list["release"])
// if(state == 2)
// Create the crate somewhere
src.updateUsrDialog()
/obj/machinery/smelter
icon = 'mining.dmi'
icon_state = "sprayer"
density = 1
anchored = 1
var
locked = 0
closed = 0
state = 0 // 0 - Idle, 1 - Smelt, 2 - Cool, 3 - Clean
slag = 0
hacked = 0
obj/machinery/smelter/attack_hand(user as mob)
var/dat
if(..())
return
dat += text("<h2>Smelt-o-Matic Control Interface</h2>")
dat += text("The red light is [src.closed ? "off" : "on"].<BR>")
dat += text("The green light is [src.locked ? "on" : "off"].<BR>")
switch(slag)
if(0)
dat += text("The meter is resting at zero.<BR>")
if(1 to 2)
dat += text("The meter is wobbling at the mid-point marker.<BR>")
if(3)
dat += text("The meter strains, displaying its maximum value.<BR>")
else
dat += text("The meter has broken.<BR>")
switch(state)
if(0)
dat += text("<b>Status</b>:<i>Idle</i><BR>")
if(1)
dat += text("<b>Status</b>:<i>Smelting</i><BR>")
if(2)
dat += text("<b>Status</b>:<i>Cooling</i><BR>")
if(3)
dat += text("<b>Status</b>:<i>Cleaning</i><BR>")
dat += text("<HR /><BR>Turn key <A href='?src=\ref[src];key=1'>[src.locked ? "to upper-left position" : "to upper-right position"]</A><BR>")
dat += text("Flip switch <A href='?src=\ref[src];switch=1'>[src.closed ? "up" : "down"]</A><BR>")
dat += text("<A href='?src=\ref[src];button=1'>Push large flashing yellow button</A><BR>")
user << browse("<HEAD><TITLE>SMELTOMATIC</TITLE></HEAD><TT>[dat]</TT>", "window=smelter")
onclose(user, "smelter")
obj/machinery/smelter/Topic(href, href_list)
if(..())
return
usr.machine = src
src.add_fingerprint(usr)
if(href_list["key"])
src.locked = !src.locked
if(href_list["switch"])
src.closed = !src.closed
if(href_list["button"])
//Do stuff to actually smelt shit or something I don't know
return
src.updateUsrDialog()
/obj/machinery/slaggrinder
icon = 'mining.dmi'
density = 1
anchored = 1
/obj/machinery/adminmachine
icon = 'mining.dmi'
icon_state = "sprayer"
density = 1
anchored = 1
var
gameticker
gameworld
New()
..()
gameticker = ticker
gameworld = world

View File

@@ -0,0 +1,349 @@
/obj/machinery/shipcore
icon = 'craft.dmi'
icon_state = "core"
density = 1
var/width = 6
var/height = 8
var/list/turfs = list()
var/list/builders
var/list/components = list()
var/build_status = "unbuilt"
proc/group_self()
builders = list()
turfs = list()
components = list()
src.anchored = 1
var/obj/ship_builder/L = new(locate(src.x, src.y, src.z))
L.dir = WEST
L.distance = width/2
L.core = src
var/obj/ship_builder/R = new(locate(src.x+1, src.y, src.z))
R.dir = EAST
R.distance = (width/2)-1
R.core = src
builders.Add(L, R)
spawn() L.scan()
spawn() R.scan()
var/h
for(h=1, h<height/2, h++)
var/obj/ship_builder/A = new(locate(src.x+1, src.y+h, src.z))
A.dir = EAST
A.distance = (width/2)-1
A.core = src
var/obj/ship_builder/B = new(locate(src.x, src.y+h, src.z))
B.dir = WEST
B.distance = width/2
B.core = src
var/obj/ship_builder/C = new(locate(src.x+1, src.y-h, src.z))
C.dir = EAST
C.distance = (width/2)-1
C.core = src
var/obj/ship_builder/D = new(locate(src.x, src.y-h, src.z))
D.dir = WEST
D.distance = width/2
D.core = src
builders.Add(A, B, C, D)
spawn() A.scan()
spawn() B.scan()
spawn() C.scan()
spawn() D.scan()
while(src.builders.len)
sleep(50)
del(src.builders)
for(var/turf/T in turfs)
for(var/obj/O in T.contents)
if(istype(O, /obj/machinery/ship_component))
O:core = src
src.components.Add(O)
src.build_status = "built"
//world << "Ship initialization complete. [src.turfs.len] tiles added."
proc/receive_turf(var/turf/T)
turfs.Add(T)
proc/MoveShip(var/turf/Center) // Center - The new position of the ship's core
src.anchored = 0
var/turf/lowerleft = locate(Center.x - (src.width/2), Center.y - (src.height/2), Center.z)
var/turf/upperright = locate(Center.x + (src.width/2), Center.y + (src.height/2), Center.z)
var/xsav = src.loc.x
var/ysav = src.loc.y
var/zsav = src.loc.z
for(var/turf/T in block(lowerleft, upperright))
if(!istype(T, /turf/space))
return 0 // One of the tiles in the range we're moving to isn't a space tile - something's in the way!
// Alright, the way is clear, we can actually begin transferring everything over now.
for(var/turf/T in src.turfs)
for(var/obj/O in T)
if(istype(O, /obj/ship_landing_beacon)) // Leave beacons where they are, we don't want to take them with us.
continue
var/
_x = Center.x + O.x - xsav
_y = Center.y + O.y - ysav
_z = Center.z + O.z - zsav
O.loc = locate(_x, _y, _z)
for(var/mob/M in T)
var/
_x = Center.x + M.x - xsav
_y = Center.y + M.y - ysav
_z = Center.z + M.z - zsav
M.loc = locate(_x, _y, _z)
var/
_x = Center.x + T.x - xsav
_y = Center.y + T.y - ysav
_z = Center.z + T.z - zsav
var/turf/Newloc = locate(_x, _y, _z)
//new T(Newloc)
new T.type(Newloc)
T.ReplaceWithSpace()
if(Newloc)
Newloc.assume_air(T.return_air())
T.remove_air(T.return_air())
src.build_status = "rebuilding"
src.group_self()
proc/draw_power(var/n as num)
for(var/obj/machinery/ship_component/engine/E in components)
if(E.draw_power(n))
return 1
return 0
obj/machinery/shipcore/attack_hand(user as mob)
var/dat
if(..())
return
if (1 == 1) // Haha why did I even do this what the fuck. Whatever. It's too entertaining to remove now. -- TLE
/*
dat += "Autolathe Wires:<BR>"
var/wire
for(wire in src.wires)
dat += text("[wire] Wire: <A href='?src=\ref[src];wire=[wire];act=wire'>[src.wires[wire] ? "Mend" : "Cut"]</A> <A href='?src=\ref[src];wire=[wire];act=pulse'>Pulse</A><BR>")
dat += text("The red light is [src.disabled ? "off" : "on"].<BR>")
dat += text("The green light is [src.shocked ? "off" : "on"].<BR>")
dat += text("The blue light is [src.hacked ? "off" : "on"].<BR>")
*/
switch(src.build_status)
if("unbuilt")
dat += "<h3>Core Status: <font color =#FF3300>Undeployed</font></h3><BR>"
dat += "<A href='?src=\ref[src];groupself=1'>Build Ship</A><BR>"
if("built")
dat += "<h3>Core Status: <font color =#00CC00>Deployed</font></h3><BR>"
dat += "<A href='?src=\ref[src];move=1'>Move</A><BR>"
if("rebuilding")
dat += "<h3>Core Status: <font color =#FFCC00>Recalibrating</font></h3><BR>"
user << browse("<HEAD><TITLE>Ship Core</TITLE></HEAD>[dat]","window=shipcore")
onclose(user, "shipcore")
return
user << browse("<HEAD><TITLE>Ship Core Control Panel</TITLE></HEAD><TT>[dat]</TT>", "window=shipcore")
onclose(user, "shipcore")
return
obj/machinery/shipcore/Topic(href, href_list)
if(..())
return
usr.machine = src
src.add_fingerprint(usr)
if(href_list["groupself"])
src.group_self()
if (href_list["move"])
var/list/beacons = list()
for(var/obj/ship_landing_beacon/b in world)
if(istype(b, /obj/ship_landing_beacon))
if(b.active)
beacons.Add(b)
if(!beacons.len)
return
var/obj/choice = input("Choose a beacon to land at.", "Beacon Selection") in beacons
if(choice)
src.MoveShip(choice.loc)
for(var/mob/M in viewers(1, src))
if ((M.client && M.machine == src))
src.attack_hand(M)
src.updateUsrDialog()
return
obj/machinery/ship_component
name = "ship component"
icon = 'craft.dmi'
var
obj/machinery/shipcore/core
required_draw = 0
active = 1
proc
draw_power(var/n as num)
if(!n)
n = required_draw
if(core.draw_power(n))
return 1
else
return 0
obj/machinery/ship_component/thruster
name = "thruster"
icon_state = "thruster"
density = 1
opacity = 1
var
cooldown = 600 // In 1/10th seconds
lastused
ready = 0
required_draw = 100
proc
check_ready()
if(ready)
return 1
if(lastused + cooldown <= world.time)
for(var/turf/T in range(1,src))
if(istype(T, /turf/space))
src.ready = 1
break
else
src.ready = 0
return src.ready
fire()
src.check_ready()
if(!ready)
return 0
if(src.draw_power())
src.ready = 0
src.lastused = world.time
return 1
else
return 0
obj/machinery/ship_component/engine
name = "engine"
icon_state = "engine"
density = 1
opacity = 1
var
charge = 1000
capacity = 1000
draw_power(var/n as num)
if(charge >= n)
charge -= n
return 1
else
return 0
obj/machinery/ship_component/control_panel
name = "control panel"
icon_state = "controlpanel"
density = 1
opacity = 0
attack_hand(user as mob)
var/dat
if(..())
return
if(!src.core)
dat += "<b>No linked core found. Deploy ship core first.</b>"
else
dat += "Ship Status: [src.core.build_status]<br><br>"
dat += "<h3>Installed Components:</h3><br><br>"
dat += "<table>"
for(var/obj/machinery/ship_component/C in core.components)
dat += "<tr><td><b>[C.name]</b></td><td>[C.active ? "<font color=green>Active</font>" : "<font color=red>Inactive</font>"]</td></tr>"
if(istype(C, /obj/machinery/ship_component/engine))
dat += "<tr><td></td><td><i>Fuel: [C:charge]/[C:capacity]</i></td></tr>"
if(istype(C, /obj/machinery/ship_component/thruster))
dat += "<tr><td></td><td><i>Status: [C:check_ready() ? "Ready" : "On Cooldown"]</i></td></tr>"
dat += "</table>"
user << browse("<HEAD><TITLE>Ship Controls</TITLE></HEAD>[dat]","window=shipcontrols")
onclose(user, "shipcontrols")
Topic(href, href_list)
if(..())
return
usr.machine = src
src.add_fingerprint(usr)
/obj/ship_builder
icon = 'craft.dmi'
icon_state = "builder"
density = 0
opacity = 0
var/obj/machinery/shipcore/core
var/distance = 0
proc/scan()
if(distance < 0)
cleanup_self()
var/i
for(i=0, i<distance, i++)
if(istype(src.loc, /turf/space))
break
else
core.receive_turf(src.loc)
src.loc = get_step(src, src.dir)
sleep(0)
cleanup_self()
proc/cleanup_self()
core.builders.Remove(src)
del(src)
/obj/ship_overlay
icon = 'craft.dmi'
icon_state = "ship_overlay"
/obj/ship_landing_beacon
icon = 'craft.dmi'
icon_state = "beacon"
name = "Beacon"
var/active = 0
proc
deploy()
if(active)
return
src.active = 1
src.anchored = 1
deactivate()
if(!active)
return
src.active = 0
src.anchored = 0