Particle Accelerator Fixes (#8428)

This commit is contained in:
Geeves
2020-03-14 14:43:00 +01:00
committed by GitHub
parent 6460c444c3
commit dca6966ddd
7 changed files with 166 additions and 147 deletions
@@ -5,8 +5,8 @@
desc = "Small things moving very fast."
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "particle"//Need a new icon for this
anchored = 1
density = 1
anchored = TRUE
density = FALSE
var/movement_range = 10
var/energy = 10 //energy in eV
var/mega_energy = 0 //energy in MeV
@@ -62,15 +62,13 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
name = "Particle Accelerator"
desc = "Part of a Particle Accelerator."
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = null
anchored = 0
density = 1
var/obj/machinery/particle_accelerator/control_box/master = null
anchored = FALSE
density = TRUE
var/obj/machinery/particle_accelerator/control_box/master
var/construction_state = 0
var/reference = null
var/reference
var/powered = 0
var/strength = null
var/desc_holder = null
var/strength
/obj/structure/particle_accelerator/Destroy()
construction_state = 0
@@ -80,7 +78,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/structure/particle_accelerator/end_cap
name = "Alpha Particle Generation Array"
desc_holder = "This is where Alpha particles are generated from \[REDACTED\]"
desc = "This is where Alpha particles are generated from \[REDACTED\]."
icon_state = "end_cap"
reference = "end_cap"
@@ -89,42 +87,49 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
to_chat(usr, "It is fastened to the floor!")
return 0
src.set_dir(turn(src.dir, 270))
return 1
if(use_check_and_message(usr))
to_chat(usr, SPAN_WARNING("You are in no state to do this!"))
return FALSE
if(anchored)
to_chat(usr, SPAN_WARNING("It is fastened to the floor!"))
return FALSE
set_dir(turn(dir, 270))
return TRUE
/obj/structure/particle_accelerator/verb/rotateccw()
set name = "Rotate Counter Clockwise"
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
to_chat(usr, "It is fastened to the floor!")
return 0
src.set_dir(turn(src.dir, 90))
return 1
if(use_check_and_message(usr))
to_chat(usr, SPAN_WARNING("You are in no state to do this!"))
return FALSE
if(anchored)
to_chat(usr, SPAN_WARNING("It is fastened to the floor!"))
return FALSE
set_dir(turn(dir, 90))
return TRUE
/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 = "[initial(desc)] Looks like it's not attached to the flooring."
if(1)
src.desc = text("A [name], it is missing some cables")
desc = "[initial(desc)] It's missing some cables."
if(2)
src.desc = text("A [name], the panel is open")
desc = "[initial(desc)] The panel is open."
if(3)
src.desc = text("The [name] is assembled")
desc = "[initial(desc)] It seems completely assembled."
if(powered)
src.desc = src.desc_holder
desc = initial(desc)
..()
return
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user)
if(istool(W))
if(src.process_tool_hit(W,user))
if(process_tool_hit(W, user))
return
..()
return
@@ -142,11 +147,11 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
qdel(src)
return
if(2.0)
if (prob(50))
if(prob(50))
qdel(src)
return
if(3.0)
if (prob(25))
if(prob(25))
qdel(src)
return
else
@@ -154,7 +159,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/structure/particle_accelerator/update_icon()
switch(construction_state)
if(0,1)
if(0, 1)
icon_state="[reference]"
if(2)
icon_state="[reference]w"
@@ -168,145 +173,150 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/structure/particle_accelerator/proc/update_state()
if(master)
master.update_state()
return 0
return FALSE
/obj/structure/particle_accelerator/proc/report_ready(var/obj/O)
if(O && (O == master))
if(construction_state >= 3)
return 1
return 0
return TRUE
return FALSE
/obj/structure/particle_accelerator/proc/report_master()
if(master)
return master
return 0
return FALSE
/obj/structure/particle_accelerator/proc/connect_master(var/obj/O)
if(O && istype(O,/obj/machinery/particle_accelerator/control_box))
if(istype(O, /obj/machinery/particle_accelerator/control_box))
if(O.dir == src.dir)
master = O
return 1
return 0
return TRUE
return FALSE
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/O, var/mob/user)
if(!(O) || !(user))
return 0
if(!O || !user)
return FALSE
if(!ismob(user) || !isobj(O))
return 0
var/temp_state = src.construction_state
return FALSE
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(O.iswrench())
playsound(src.loc, O.usesound, 75, 1)
src.anchored = 1
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the external bolts.")
playsound(get_turf(src), O.usesound, 75, TRUE)
anchored = TRUE
user.visible_message(SPAN_NOTICE("\The [user] secures \the [src] to the floor."), \
SPAN_NOTICE("You secure the external bolts."))
temp_state++
if(1)
if(O.iswrench())
playsound(src.loc, O.usesound, 75, 1)
src.anchored = 0
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
"You remove the external bolts.")
playsound(get_turf(src), O.usesound, 75, TRUE)
anchored = FALSE
user.visible_message(SPAN_NOTICE("\The [user] detaches \the [src] from the floor."), \
SPAN_NOTICE("You remove the external bolts."))
temp_state--
else if(O.iscoil())
if(O:use(1,user))
user.visible_message("[user.name] adds wires to the [src.name].", \
"You add some wires.")
var/obj/item/stack/cable_coil/C = O
if(C.use(1))
user.visible_message(SPAN_NOTICE("\The [user] adds wires to \the [src]."), \
SPAN_NOTICE("You add some wires."))
temp_state++
if(2)
if(O.iswirecutter())//TODO:Shock user if its on?
user.visible_message("[user.name] removes some wires from the [src.name].", \
"You remove some wires.")
user.visible_message(SPAN_NOTICE("\The [user] removes some wires from \the [src]."), \
SPAN_NOTICE("You remove some wires."))
temp_state--
else if(O.isscrewdriver())
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
"You close the access panel.")
user.visible_message(SPAN_NOTICE("\The [user] closes \the [src]'s access panel."), \
SPAN_NOTICE("You close the access panel."))
temp_state++
if(3)
if(O.isscrewdriver())
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
"You open the access panel.")
user.visible_message(SPAN_NOTICE("\The [user] opens \the [src]'s access panel."), \
SPAN_NOTICE("You open the access panel."))
temp_state--
if(temp_state == src.construction_state)//Nothing changed
return 0
if(temp_state == construction_state)//Nothing changed
return FALSE
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
return 0
return TRUE
return FALSE
/obj/machinery/particle_accelerator
name = "Particle Accelerator"
desc = "Part of a Particle Accelerator."
icon = 'icons/obj/machines/particle_accelerator2.dmi'
icon_state = null
anchored = 0
density = 1
anchored = FALSE
density = TRUE
use_power = 0
idle_power_usage = 0
active_power_usage = 0
var/construction_state = 0
var/active = 0
var/reference = null
var/powered = null
var/active = FALSE
var/reference
var/powered
var/strength = 0
var/desc_holder = null
/obj/machinery/particle_accelerator/verb/rotate()
set name = "Rotate Clockwise"
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
to_chat(usr, "It is fastened to the floor!")
return 0
src.set_dir(turn(src.dir, 270))
return 1
if(use_check_and_message(usr))
to_chat(usr, SPAN_WARNING("You are in no state to do this!"))
return FALSE
if(anchored)
to_chat(usr, SPAN_WARNING("It is fastened to the floor!"))
return FALSE
set_dir(turn(dir, 270))
return TRUE
/obj/machinery/particle_accelerator/verb/rotateccw()
set name = "Rotate Counter-Clockwise"
set category = "Object"
set src in oview(1)
if (src.anchored || usr:stat)
to_chat(usr, "It is fastened to the floor!")
return 0
src.set_dir(turn(src.dir, 90))
return 1
if(use_check_and_message(usr))
to_chat(usr, SPAN_WARNING("You are in no state to do this!"))
return FALSE
if(anchored)
to_chat(usr, SPAN_WARNING("It is fastened to the floor!"))
return FALSE
set_dir(turn(dir, 90))
return TRUE
/obj/machinery/particle_accelerator/update_icon()
return
/obj/machinery/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 = "[initial(desc)] Looks like it's not attached to the flooring."
if(1)
src.desc = text("A [name], it is missing some cables")
desc = "[initial(desc)] It's missing some cables."
if(2)
src.desc = text("A [name], the panel is open")
desc = "[initial(desc)] The panel is open."
if(3)
src.desc = text("The [name] is assembled")
desc = "[initial(desc)] It seems completely assembled."
if(powered)
src.desc = src.desc_holder
desc = initial(desc)
..()
return
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user)
if(istool(W))
if(src.process_tool_hit(W,user))
if(process_tool_hit(W,user))
return
..()
return
@@ -317,72 +327,71 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
qdel(src)
return
if(2.0)
if (prob(50))
if(prob(50))
qdel(src)
return
if(3.0)
if (prob(25))
if(prob(25))
qdel(src)
return
return
else
return
/obj/machinery/particle_accelerator/proc/update_state()
return 0
return FALSE
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/O, var/mob/user)
if(!(O) || !(user))
return 0
if(!O || !user)
return FALSE
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
return FALSE
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(O.iswrench())
playsound(src.loc, O.usesound, 75, 1)
src.anchored = 1
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the external bolts.")
playsound(get_turf(src), O.usesound, 75, TRUE)
anchored = TRUE
user.visible_message(SPAN_NOTICE("\The [user] secures \the [src] to the floor."), \
SPAN_NOTICE("You secure the external bolts."))
temp_state++
if(1)
if(O.iswrench())
playsound(src.loc, O.usesound, 75, 1)
src.anchored = 0
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
"You remove the external bolts.")
playsound(get_turf(src), O.usesound, 75, TRUE)
anchored = FALSE
user.visible_message(SPAN_NOTICE("\The [user] detaches \the [src] from the floor."), \
SPAN_NOTICE("You remove the external bolts."))
temp_state--
else if(O.iscoil())
if(O:use(1))
user.visible_message("[user.name] adds wires to the [src.name].", \
"You add some wires.")
var/obj/item/stack/cable_coil/C = O
if(C.use(1))
user.visible_message(SPAN_NOTICE("\The [user] removes some wires from \the [src]."), \
SPAN_NOTICE("You remove some wires."))
temp_state++
if(2)
if(O.iswirecutter())//TODO:Shock user if its on?
user.visible_message("[user.name] removes some wires from the [src.name].", \
"You remove some wires.")
user.visible_message(SPAN_NOTICE("\The [user] removes some wires from \the [src]."), \
SPAN_NOTICE("You remove some wires."))
temp_state--
else if(O.isscrewdriver())
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
"You close the access panel.")
user.visible_message(SPAN_NOTICE("\The [user] closes \the [src]'s access panel."), \
SPAN_NOTICE("You close the access panel."))
temp_state++
if(3)
if(O.isscrewdriver())
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
"You open the access panel.")
user.visible_message(SPAN_NOTICE("\The [user] opens \the [src]'s access panel."), \
SPAN_NOTICE("You open the access panel."))
temp_state--
active = 0
if(temp_state == src.construction_state)//Nothing changed
return 0
active = FALSE
if(temp_state == construction_state)//Nothing changed
return FALSE
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
return 0
return TRUE
return FALSE
@@ -6,20 +6,20 @@
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "control_box"
reference = "control_box"
anchored = 0
density = 1
anchored = FALSE
density = TRUE
use_power = 0
idle_power_usage = 500
active_power_usage = 70000 //70 kW per unit of strength
construction_state = 0
active = 0
dir = 1
active = FALSE
dir = NORTH
var/strength_upper_limit = 2
var/interface_control = 1
var/interface_control = TRUE
var/list/obj/structure/particle_accelerator/connected_parts
var/assembled = 0
var/parts = null
var/datum/wires/particle_acc/control_box/wires = null
var/parts
var/datum/wires/particle_acc/control_box/wires
/obj/machinery/particle_accelerator/control_box/Initialize()
wires = new(src)
@@ -87,7 +87,7 @@
usr << browse(null, "window=pacontrol")
return
if( href_list["close"] )
if(href_list["close"])
usr << browse(null, "window=pacontrol")
usr.unset_machine()
return
@@ -142,7 +142,7 @@
/obj/machinery/particle_accelerator/control_box/power_change()
..()
if(stat & NOPOWER)
active = 0
active = FALSE
update_use_power(0)
else if(!stat && construction_state == 3)
update_use_power(1)
@@ -152,7 +152,7 @@
/obj/machinery/particle_accelerator/control_box/machinery_process()
if(src.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()
return
@@ -260,4 +260,4 @@
user << browse(dat, "window=pacontrol;size=420x500")
onclose(user, "pacontrol")
return
return
@@ -2,7 +2,7 @@
/obj/structure/particle_accelerator/particle_emitter
name = "EM Containment Grid"
desc_holder = "This emits alpha particles, you might not want to stand near this end."
desc = "This emits alpha particles, you might not want to stand near this end."
icon = 'icons/obj/machines/particle_accelerator.dmi'
var/fire_delay = 50
var/last_shot = 0
@@ -22,8 +22,8 @@
/obj/structure/particle_accelerator/particle_emitter/proc/set_delay(var/delay)
if(delay && delay >= 0)
src.fire_delay = delay
return 1
return 0
return TRUE
return FALSE
/obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(var/strength = 0)
if((src.last_shot + src.fire_delay) <= world.time)
@@ -42,5 +42,5 @@
A = new/obj/effect/accelerated_particle/powerful(T, dir)
if(A)
A.set_dir(src.dir)
return 1
return 0
return TRUE
return FALSE
@@ -1,13 +1,13 @@
/obj/structure/particle_accelerator/power_box
name = "Particle Focusing EM Lens"
desc_holder = "This uses electromagnetic waves to focus Alpha-Particles."
desc = "This uses electromagnetic waves to focus Alpha-Particles."
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "power_box"
reference = "power_box"
/obj/structure/particle_accelerator/fuel_chamber
name = "EM Acceleration Chamber"
desc_holder = "This is where the Alpha particles are accelerated to <b><i>radical speeds</i></b>."
desc = "This is where the Alpha particles are accelerated to <b><i>radical speeds</i></b>."
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "fuel_chamber"
reference = "fuel_chamber"
reference = "fuel_chamber"