Merge branch 'master' of https://github.com/ParadiseSS13/Paradise into BookClub

This commit is contained in:
Crazylemon64
2017-01-06 05:01:43 -08:00
158 changed files with 4150 additions and 1040 deletions
@@ -95,10 +95,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
if(usr.stat || !usr.canmove || usr.restrained())
return
if(src.anchored)
if(anchored)
to_chat(usr, "It is fastened to the floor!")
return 0
src.dir = turn(src.dir, 270)
dir = turn(dir, 270)
return 1
/obj/structure/particle_accelerator/AltClick(mob/user)
@@ -116,29 +116,29 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
if(usr.stat || !usr.canmove || usr.restrained())
return
if(src.anchored)
if(anchored)
to_chat(usr, "It is fastened to the floor!")
return 0
src.dir = turn(src.dir, 90)
dir = turn(dir, 90)
return 1
/obj/structure/particle_accelerator/examine(mob/user)
switch(src.construction_state)
switch(construction_state)
if(0)
src.desc = text("A [name], looks like it's not attached to the flooring")
desc = text("A [name], looks like it's not attached to the flooring")
if(1)
src.desc = text("A [name], it is missing some cables")
desc = text("A [name], it is missing some cables")
if(2)
src.desc = text("A [name], the panel is open")
desc = text("A [name], the panel is open")
if(3)
src.desc = text("The [name] is assembled")
desc = text("The [name] is assembled")
if(powered)
src.desc = src.desc_holder
desc = desc_holder
..(user)
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params)
if(istool(W))
if(src.process_tool_hit(W,user))
if(process_tool_hit(W,user))
return
..()
return
@@ -208,7 +208,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/structure/particle_accelerator/proc/connect_master(var/obj/O)
if(O && istype(O,/obj/machinery/particle_accelerator/control_box))
if(O.dir == src.dir)
if(O.dir == dir)
master = O
return 1
return 0
@@ -219,51 +219,51 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return 0
if(!ismob(user) || !isobj(O))
return 0
var/temp_state = src.construction_state
var/temp_state = construction_state
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
switch(construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(iswrench(O) && !isinspace())
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
src.anchored = 1
user.visible_message("[user.name] secures the [src.name] to the floor.", \
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
anchored = 1
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
temp_state++
if(1)
if(iswrench(O))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
src.anchored = 0
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
anchored = 0
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
temp_state--
else if(iscoil(O))
var/obj/item/stack/cable_coil/C = O
if(C.use(1))
user.visible_message("[user.name] adds wires to the [src.name].", \
user.visible_message("[user.name] adds wires to the [name].", \
"You add some wires.")
temp_state++
else
to_chat(user, "<span class='warning'>You need one length of cable to wire the [src.name]!</span>")
to_chat(user, "<span class='warning'>You need one length of cable to wire the [name]!</span>")
return
if(2)
if(iswirecutter(O))//TODO:Shock user if its on?
user.visible_message("[user.name] removes some wires from the [src.name].", \
user.visible_message("[user.name] removes some wires from the [name].", \
"You remove some wires.")
temp_state--
else if(isscrewdriver(O))
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
user.visible_message("[user.name] closes the [name]'s access panel.", \
"You close the access panel.")
temp_state++
if(3)
if(isscrewdriver(O))
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
user.visible_message("[user.name] opens the [name]'s access panel.", \
"You open the access panel.")
temp_state--
if(temp_state == src.construction_state)//Nothing changed
if(temp_state == construction_state)//Nothing changed
return 0
else
src.construction_state = temp_state
if(src.construction_state < 3)//Was taken apart, update state
construction_state = temp_state
if(construction_state < 3)//Was taken apart, update state
update_state()
update_icon()
return 1
@@ -296,10 +296,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
if(usr.stat || !usr.canmove || usr.restrained())
return
if(src.anchored)
if(anchored)
to_chat(usr, "It is fastened to the floor!")
return 0
src.dir = turn(src.dir, 270)
dir = turn(dir, 270)
return 1
/obj/machinery/particle_accelerator/verb/rotateccw()
@@ -309,10 +309,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
if(usr.stat || !usr.canmove || usr.restrained())
return
if(src.anchored)
if(anchored)
to_chat(usr, "It is fastened to the floor!")
return 0
src.dir = turn(src.dir, 90)
dir = turn(dir, 90)
return 1
/obj/machinery/particle_accelerator/update_icon()
@@ -320,7 +320,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user, params)
if(istool(W))
if(src.process_tool_hit(W,user))
if(process_tool_hit(W,user))
return
..()
return
@@ -357,51 +357,53 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return 0
if(!ismob(user) || !isobj(O))
return 0
var/temp_state = src.construction_state
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
var/temp_state = construction_state
switch(construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(iswrench(O))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
src.anchored = 1
user.visible_message("[user.name] secures the [src.name] to the floor.", \
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
anchored = 1
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
temp_state++
power_change()
if(1)
if(iswrench(O))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
src.anchored = 0
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
anchored = 0
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
temp_state--
power_change()
else if(iscoil(O))
if(O:use(1))
user.visible_message("[user.name] adds wires to the [src.name].", \
user.visible_message("[user.name] adds wires to the [name].", \
"You add some wires.")
temp_state++
if(2)
if(iswirecutter(O))//TODO:Shock user if its on?
user.visible_message("[user.name] removes some wires from the [src.name].", \
user.visible_message("[user.name] removes some wires from the [name].", \
"You remove some wires.")
temp_state--
else if(isscrewdriver(O))
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
user.visible_message("[user.name] closes the [name]'s access panel.", \
"You close the access panel.")
temp_state++
if(3)
if(isscrewdriver(O))
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
user.visible_message("[user.name] opens the [name]'s access panel.", \
"You open the access panel.")
temp_state--
active = 0
if(temp_state == src.construction_state)//Nothing changed
if(temp_state == construction_state)//Nothing changed
return 0
else
if(src.construction_state < 3)//Was taken apart, update state
if(construction_state < 3)//Was taken apart, update state
update_state()
if(use_power)
use_power = 0
src.construction_state = temp_state
if(src.construction_state >= 3)
construction_state = temp_state
if(construction_state >= 3)
use_power = 1
update_icon()
return 1
@@ -24,6 +24,7 @@
/obj/machinery/particle_accelerator/control_box/New()
wires = new(src)
connected_parts = list()
update_icon()
..()
/obj/machinery/particle_accelerator/control_box/Destroy()
@@ -34,7 +35,7 @@
return ..()
/obj/machinery/particle_accelerator/control_box/attack_ghost(user as mob)
return src.attack_hand(user)
return attack_hand(user)
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
if(construction_state >= 3)
@@ -62,9 +63,12 @@
/obj/machinery/particle_accelerator/control_box/update_icon()
if(active)
icon_state = "[reference]p1"
icon_state = "[reference]p[strength]"
else
if(use_power)
if(stat & NOPOWER)
icon_state = "[reference]w"
return
else if(use_power)
if(assembled)
icon_state = "[reference]p"
else
@@ -89,16 +93,16 @@
to_chat(usr, "<span class='error'>ERROR: Request timed out. Check wire contacts.</span>")
return
if( href_list["close"] )
if(href_list["close"])
usr << browse(null, "window=pacontrol")
usr.unset_machine()
return
if(href_list["togglep"])
if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE))
src.toggle_power()
toggle_power()
else if(href_list["scan"])
src.part_scan()
part_scan()
else if(href_list["strengthup"])
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
@@ -108,8 +112,8 @@
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
remove_strength()
src.updateDialog()
src.update_icon()
updateDialog()
update_icon()
return
@@ -152,32 +156,39 @@
use_power = 0
else if(!stat && construction_state <= 3)
use_power = 1
update_icon()
if((stat & NOPOWER) || (!stat && construction_state <= 3)) //Only update the part icons if something's changed (i.e. any of the above condition sets are met).
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = null
part.powered = 0
part.update_icon()
return
/obj/machinery/particle_accelerator/control_box/process()
if(src.active)
if(active)
//a part is missing!
if( length(connected_parts) < 6 )
if(length(connected_parts) < 6)
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
src.toggle_power()
toggle_power()
return
//emit some particles
for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts)
if(PE)
PE.emit_particle(src.strength)
PE.emit_particle(strength)
return
/obj/machinery/particle_accelerator/control_box/proc/part_scan()
for(var/obj/structure/particle_accelerator/fuel_chamber/F in orange(1,src))
src.dir = F.dir
dir = F.dir
connected_parts = list()
var/tally = 0
var/ldir = turn(dir,-90)
var/rdir = turn(dir,90)
var/odir = turn(dir,180)
var/turf/T = src.loc
var/turf/T = loc
T = get_step(T,rdir)
if(check_part(T,/obj/structure/particle_accelerator/fuel_chamber))
tally++
@@ -213,26 +224,26 @@
if(istype(PA, type))
if(PA.connect_master(src))
if(PA.report_ready(src))
src.connected_parts.Add(PA)
connected_parts.Add(PA)
return 1
return 0
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
src.active = !src.active
active = !active
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
if(active)
msg_admin_attack("PA Control Computer turned ON by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("PA Control Computer turned ON by [usr.ckey]([usr]) in ([x],[y],[z])")
use_log += text("\[[time_stamp()]\] <font color='red'>[usr.name] ([usr.ckey]) has turned on the PA Control Computer.</font>")
if(src.active)
src.use_power = 2
if(active)
use_power = 2
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = src.strength
part.strength = strength
part.powered = 1
part.update_icon()
else
src.use_power = 1
use_power = 1
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = null
part.powered = 0
@@ -262,13 +273,13 @@
else
dat += "Off <BR>"
dat += "<A href='?src=[UID()];togglep=1'>Toggle Power</A><BR><BR>"
dat += "Particle Strength: [src.strength] "
dat += "Particle Strength: [strength] "
dat += "<A href='?src=[UID()];strengthdown=1'>--</A>|<A href='?src=[UID()];strengthup=1'>++</A><BR><BR>"
//user << browse(dat, "window=pacontrol;size=420x500")
//onclose(user, "pacontrol")
var/datum/browser/popup = new(user, "pacontrol", name, 420, 500)
popup.set_content(dat)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.set_title_image(user.browse_rsc_icon(icon, icon_state))
popup.open()
return