gravitygenerator.dm now pretty much equal to tg's
Minus toggle_machine_stat and machine_stat mostly
This commit is contained in:
@@ -27,12 +27,22 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
use_power = NO_POWER_USE
|
||||
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
var/sprite_number = 0
|
||||
///Audio for when the gravgen is on
|
||||
var/datum/looping_sound/gravgen/soundloop
|
||||
|
||||
/obj/machinery/gravity_generator/main/Initialize()
|
||||
. = ..()
|
||||
soundloop = new(list(src), TRUE)
|
||||
|
||||
/obj/machinery/gravity_generator/main/Destroy()
|
||||
. = ..()
|
||||
QDEL_NULL(soundloop)
|
||||
|
||||
/obj/machinery/gravity_generator/safe_throw_at(atom/target, range, speed, mob/thrower, spin = TRUE, diagonals_first = FALSE, datum/callback/callback, force = MOVE_FORCE_STRONG, gentle = FALSE)
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/gravity_generator/ex_act(severity, target)
|
||||
if(severity == 1) // Very sturdy.
|
||||
if(severity >= EXPLODE_DEVASTATE) // Very sturdy.
|
||||
set_broken()
|
||||
|
||||
/obj/machinery/gravity_generator/blob_act(obj/structure/blob/B)
|
||||
@@ -40,12 +50,13 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
set_broken()
|
||||
|
||||
/obj/machinery/gravity_generator/zap_act(power, zap_flags)
|
||||
..()
|
||||
. = ..()
|
||||
if(zap_flags & ZAP_MACHINE_EXPLOSIVE)
|
||||
qdel(src)//like the singulo, tesla deletes it. stops it from exploding over and over
|
||||
|
||||
/obj/machinery/gravity_generator/update_icon_state()
|
||||
icon_state = "[get_status()]_[sprite_number]"
|
||||
return ..()
|
||||
|
||||
/obj/machinery/gravity_generator/proc/get_status()
|
||||
return "off"
|
||||
@@ -65,6 +76,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
if(main_part)
|
||||
qdel(main_part)
|
||||
set_broken()
|
||||
QDEL_NULL(soundloop)
|
||||
return ..()
|
||||
|
||||
//
|
||||
@@ -80,14 +92,19 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
/obj/machinery/gravity_generator/part/get_status()
|
||||
return main_part?.get_status()
|
||||
|
||||
/obj/machinery/gravity_generator/part/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
return main_part.attack_hand(user)
|
||||
/obj/machinery/gravity_generator/part/attack_hand(mob/user, list/modifiers)
|
||||
return main_part.attack_hand(user, modifiers)
|
||||
|
||||
/obj/machinery/gravity_generator/part/set_broken()
|
||||
..()
|
||||
if(main_part && !(main_part.stat & BROKEN))
|
||||
main_part.set_broken()
|
||||
|
||||
/// Used to eat args
|
||||
/obj/machinery/gravity_generator/part/proc/on_update_icon(obj/machinery/gravity_generator/source, updates, updated)
|
||||
SIGNAL_HANDLER
|
||||
return update_appearance(updates)
|
||||
|
||||
//
|
||||
// Generator which spawns with the station.
|
||||
//
|
||||
@@ -124,7 +141,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
var/charge_count = 100
|
||||
var/current_overlay = null
|
||||
var/broken_state = 0
|
||||
var/setting = 1 //Gravity value when on
|
||||
var/setting = 1 //Gravity value when on
|
||||
|
||||
/obj/machinery/gravity_generator/main/Destroy() // If we somehow get deleted, remove all of our other parts.
|
||||
investigate_log("was destroyed!", INVESTIGATE_GRAVITY)
|
||||
@@ -149,13 +166,13 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
if(count == 5) // Middle
|
||||
middle = part
|
||||
if(count <= 3) // Their sprite is the top part of the generator
|
||||
part.density = FALSE
|
||||
part.set_density(FALSE)
|
||||
part.layer = WALL_OBJ_LAYER
|
||||
part.sprite_number = count
|
||||
part.main_part = src
|
||||
parts += part
|
||||
part.update_icon()
|
||||
part.RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, /atom/proc/update_icon)
|
||||
part.update_appearance()
|
||||
part.RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, /obj/machinery/gravity_generator/part/proc/on_update_icon)
|
||||
|
||||
/obj/machinery/gravity_generator/main/proc/connected_parts()
|
||||
return parts.len == 8
|
||||
@@ -178,7 +195,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
if(M.stat & BROKEN)
|
||||
M.set_fix()
|
||||
broken_state = FALSE
|
||||
update_icon()
|
||||
update_appearance()
|
||||
set_power()
|
||||
|
||||
// Interaction
|
||||
@@ -188,33 +205,33 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
switch(broken_state)
|
||||
if(GRAV_NEEDS_SCREWDRIVER)
|
||||
if(I.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
to_chat(user, "<span class='notice'>You secure the screws of the framework.</span>")
|
||||
to_chat(user, span_notice("You secure the screws of the framework."))
|
||||
I.play_tool_sound(src)
|
||||
broken_state++
|
||||
update_icon()
|
||||
update_appearance()
|
||||
return
|
||||
if(GRAV_NEEDS_WELDING)
|
||||
if(I.tool_behaviour == TOOL_WELDER)
|
||||
if(I.use_tool(src, user, 0, volume=50, amount=1))
|
||||
to_chat(user, "<span class='notice'>You mend the damaged framework.</span>")
|
||||
to_chat(user, span_notice("You mend the damaged framework."))
|
||||
broken_state++
|
||||
update_icon()
|
||||
update_appearance()
|
||||
return
|
||||
if(GRAV_NEEDS_PLASTEEL)
|
||||
if(istype(I, /obj/item/stack/sheet/plasteel))
|
||||
var/obj/item/stack/sheet/plasteel/PS = I
|
||||
if(PS.get_amount() >= 10)
|
||||
PS.use(10)
|
||||
to_chat(user, "<span class='notice'>You add the plating to the framework.</span>")
|
||||
to_chat(user, span_notice("You add the plating to the framework."))
|
||||
playsound(src.loc, 'sound/machines/click.ogg', 75, TRUE)
|
||||
broken_state++
|
||||
update_icon()
|
||||
update_appearance()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need 10 sheets of plasteel!</span>")
|
||||
to_chat(user, span_warning("You need 10 sheets of plasteel!"))
|
||||
return
|
||||
if(GRAV_NEEDS_WRENCH)
|
||||
if(I.tool_behaviour == TOOL_WRENCH)
|
||||
to_chat(user, "<span class='notice'>You secure the plating to the framework.</span>")
|
||||
to_chat(user, span_notice("You secure the plating to the framework."))
|
||||
I.play_tool_sound(src)
|
||||
set_fix()
|
||||
return
|
||||
@@ -233,12 +250,13 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
data["charge_count"] = charge_count
|
||||
data["charging_state"] = charging_state
|
||||
data["on"] = on
|
||||
data["operational"] = (stat & BROKEN) ? FALSE : TRUE
|
||||
data["operational"] = (machine_stat & BROKEN) ? FALSE : TRUE
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/gravity_generator/main/ui_act(action, params)
|
||||
if(..())
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
switch(action)
|
||||
@@ -252,7 +270,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
|
||||
/obj/machinery/gravity_generator/main/power_change()
|
||||
. = ..()
|
||||
investigate_log("has [stat & NOPOWER ? "lost" : "regained"] power.", INVESTIGATE_GRAVITY)
|
||||
investigate_log("has [machine_stat & NOPOWER ? "lost" : "regained"] power.", INVESTIGATE_GRAVITY)
|
||||
set_power()
|
||||
|
||||
/obj/machinery/gravity_generator/main/get_status()
|
||||
@@ -270,7 +288,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
|
||||
charging_state = new_state ? POWER_UP : POWER_DOWN // Startup sequence animation.
|
||||
investigate_log("is now [charging_state == POWER_UP ? "charging" : "discharging"].", INVESTIGATE_GRAVITY)
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
// Set the state of the gravity.
|
||||
/obj/machinery/gravity_generator/main/proc/set_state(new_state)
|
||||
@@ -281,17 +299,19 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
var/alert = FALSE
|
||||
if(SSticker.IsRoundInProgress())
|
||||
if(on) // If we turned on and the game is live.
|
||||
soundloop.start()
|
||||
if(gravity_in_level() == FALSE)
|
||||
alert = TRUE
|
||||
investigate_log("was brought online and is now producing gravity for this level.", INVESTIGATE_GRAVITY)
|
||||
message_admins("The gravity generator was brought online [ADMIN_VERBOSEJMP(src)]")
|
||||
else
|
||||
soundloop.stop()
|
||||
if(gravity_in_level() == TRUE)
|
||||
alert = TRUE
|
||||
investigate_log("was brought offline and there is now no gravity for this level.", INVESTIGATE_GRAVITY)
|
||||
message_admins("The gravity generator was brought offline with no backup generator. [ADMIN_VERBOSEJMP(src)]")
|
||||
|
||||
update_icon()
|
||||
update_appearance()
|
||||
update_list()
|
||||
src.updateUsrDialog()
|
||||
if(alert)
|
||||
@@ -391,13 +411,16 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
// Misc
|
||||
|
||||
/obj/item/paper/guides/jobs/engi/gravity_gen
|
||||
info = {"
|
||||
# Gravity Generator Instructions For Dummies
|
||||
Surprisingly, gravity isn't that hard to make! All you have to do is inject deadly radioactive minerals into a ball of energy and you have yourself gravity! You can turn the machine on or off when required but you must remember that the generator will EMIT RADIATION when charging or discharging, you can tell it is charging or discharging by the noise it makes, so please WEAR PROTECTIVE CLOTHING.</p>
|
||||
### It blew up!
|
||||
Don't panic! The gravity generator was designed to be easily repaired. If, somehow, the sturdy framework did not survive then please proceed to panic; otherwise follow these steps.
|
||||
1. Secure the screws of the framework with a screwdriver.
|
||||
2. Mend the damaged framework with a welding tool.
|
||||
3. Add additional plasteel plating.
|
||||
4. Secure the additional plating with a wrench.
|
||||
"}
|
||||
name = "paper- 'Generate your own gravity!'"
|
||||
info = {"<h1>Gravity Generator Instructions For Dummies</h1>
|
||||
<p>Surprisingly, gravity isn't that hard to make! All you have to do is inject deadly radioactive minerals into a ball of
|
||||
energy and you have yourself gravity! You can turn the machine on or off when required but you must remember that the generator
|
||||
will EMIT RADIATION when charging or discharging, you can tell it is charging or discharging by the noise it makes, so please WEAR PROTECTIVE CLOTHING.</p>
|
||||
<br>
|
||||
<h3>It blew up!</h3>
|
||||
<p>Don't panic! The gravity generator was designed to be easily repaired. If, somehow, the sturdy framework did not survive then
|
||||
please proceed to panic; otherwise follow these steps.</p><ol>
|
||||
<li>Secure the screws of the framework with a screwdriver.</li>
|
||||
<li>Mend the damaged framework with a welding tool.</li>
|
||||
<li>Add additional plasteel plating.</li>
|
||||
<li>Secure the additional plating with a wrench.</li></ol>"}
|
||||
|
||||
Reference in New Issue
Block a user