Merge branch 'master' into cool-ipcs
This commit is contained in:
+89
-74
@@ -38,6 +38,8 @@
|
||||
#define APC_CHARGING 1
|
||||
#define APC_FULLY_CHARGED 2
|
||||
|
||||
#define MAXIMUM_COG_REGAIN 100 //How much charge drained by an integration cog can be priority-recharged in one processing-tick
|
||||
|
||||
// the Area Power Controller (APC), formerly Power Distribution Unit (PDU)
|
||||
// one per area, needs wire connection to power network through a terminal
|
||||
|
||||
@@ -94,6 +96,7 @@
|
||||
var/mob/living/silicon/ai/occupier = null
|
||||
var/transfer_in_progress = FALSE //Is there an AI being transferred out of us?
|
||||
var/obj/item/clockwork/integration_cog/integration_cog //Is there a cog siphoning power?
|
||||
var/cog_drained = 0 //How much of the cell's charge was drained by an integration cog, recovering this amount takes priority over the normal APC cell recharge calculations, but comes after powering Essentials.
|
||||
var/longtermpower = 10
|
||||
var/auto_name = 0
|
||||
var/failure_timer = 0
|
||||
@@ -499,6 +502,7 @@
|
||||
cell.forceMove(T)
|
||||
cell.update_icon()
|
||||
cell = null
|
||||
cog_drained = 0 //No more cell means no more averting celldrain
|
||||
charging = APC_NOT_CHARGING
|
||||
update_icon()
|
||||
return
|
||||
@@ -701,7 +705,7 @@
|
||||
START_PROCESSING(SSfastprocess, W)
|
||||
playsound(src, 'sound/machines/clockcult/steam_whoosh.ogg', 50, FALSE)
|
||||
opened = APC_COVER_CLOSED
|
||||
locked = FALSE
|
||||
locked = TRUE //Clockies get full APC access on cogged APCs, but they can't lock or unlock em unless they steal some ID to give all of them APC access, soo this is pretty much just QoL for them and makes cogs a tiny bit more stealthy
|
||||
update_icon()
|
||||
return
|
||||
else if(panel_open && !opened && is_wire_tool(W))
|
||||
@@ -833,10 +837,47 @@
|
||||
|
||||
// attack with hand - remove cell (if cover open) or interact with the APC
|
||||
|
||||
/obj/machinery/power/apc/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
/obj/machinery/power/apc/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
if(isethereal(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.a_intent == INTENT_HARM)
|
||||
if(cell.charge <= (cell.maxcharge / 2)) // if charge is under 50% you shouldnt drain it
|
||||
to_chat(H, "<span class='warning'>The APC doesn't have much power, you probably shouldn't drain any.</span>")
|
||||
return
|
||||
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
|
||||
if(stomach.crystal_charge > 145)
|
||||
to_chat(H, "<span class='warning'>Your charge is full!</span>")
|
||||
return
|
||||
to_chat(H, "<span class='notice'>You start channeling some power through the APC into your body.</span>")
|
||||
if(do_after(user, 75, target = src))
|
||||
if(cell.charge <= (cell.maxcharge / 2) || (stomach.crystal_charge > 145))
|
||||
return
|
||||
if(istype(stomach))
|
||||
to_chat(H, "<span class='notice'>You receive some charge from the APC.</span>")
|
||||
stomach.adjust_charge(10)
|
||||
cell.charge -= 10
|
||||
else
|
||||
to_chat(H, "<span class='warning'>You can't receive charge from the APC!</span>")
|
||||
return
|
||||
if(H.a_intent == INTENT_GRAB)
|
||||
if(cell.charge == cell.maxcharge)
|
||||
to_chat(H, "<span class='warning'>The APC is full!</span>")
|
||||
return
|
||||
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
|
||||
if(stomach.crystal_charge < 10)
|
||||
to_chat(H, "<span class='warning'>Your charge is too low!</span>")
|
||||
return
|
||||
to_chat(H, "<span class='notice'>You start channeling power through your body into the APC.</span>")
|
||||
if(do_after(user, 75, target = src))
|
||||
if(cell.charge == cell.maxcharge || (stomach.crystal_charge < 10))
|
||||
return
|
||||
if(istype(stomach))
|
||||
to_chat(H, "<span class='notice'>You transfer some power to the APC.</span>")
|
||||
stomach.adjust_charge(-10)
|
||||
cell.charge += 10
|
||||
else
|
||||
to_chat(H, "<span class='warning'>You can't transfer power to the APC!</span>")
|
||||
return
|
||||
if(opened && (!issilicon(user)))
|
||||
if(cell)
|
||||
user.visible_message("[user] removes \the [cell] from [src]!","<span class='notice'>You remove \the [cell].</span>")
|
||||
@@ -849,31 +890,19 @@
|
||||
if((stat & MAINT) && !opened) //no board; no interface
|
||||
return
|
||||
|
||||
/obj/machinery/power/apc/oui_canview(mob/user)
|
||||
if(area.hasSiliconAccessInArea(user)) //some APCs are mapped outside their assigned area, so this is required.
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
|
||||
/obj/machinery/power/apc/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "apc", name, 450, 460, master_ui, state)
|
||||
ui = new(user, src, "Apc", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/power/apc/ui_data(mob/user)
|
||||
var/obj/item/implant/hijack/H = user.getImplant(/obj/item/implant/hijack)
|
||||
var/abilitiesavail = FALSE
|
||||
if (H && !H.stealthmode && H.toggled)
|
||||
abilitiesavail = TRUE
|
||||
var/list/data = list(
|
||||
"locked" = locked && !(integration_cog && is_servant_of_ratvar(user)) && !area.hasSiliconAccessInArea(user, PRIVILEDGES_SILICON|PRIVILEDGES_DRONE),
|
||||
"lock_nightshift" = nightshift_requires_auth,
|
||||
"locked" = locked,
|
||||
"failTime" = failure_timer,
|
||||
"isOperating" = operating,
|
||||
"externalPower" = main_status,
|
||||
"powerCellStatus" = (cell?.percent() || null),
|
||||
"powerCellStatus" = cell ? cell.percent() : null,
|
||||
"chargeMode" = chargemode,
|
||||
"chargingStatus" = charging,
|
||||
"totalLoad" = DisplayPower(lastused_total),
|
||||
@@ -882,10 +911,7 @@
|
||||
"malfStatus" = get_malf_status(user),
|
||||
"emergencyLights" = !emergency_lights,
|
||||
"nightshiftLights" = nightshift_lights,
|
||||
"hijackable" = HAS_TRAIT(user,TRAIT_HIJACKER),
|
||||
"hijacker" = hijacker == user ? TRUE : FALSE,
|
||||
"drainavail" = cell && cell.percent() >= 85 && abilitiesavail,
|
||||
"lockdownavail" = cell && cell.percent() >= 35 && abilitiesavail,
|
||||
|
||||
"powerChannels" = list(
|
||||
list(
|
||||
"title" = "Equipment",
|
||||
@@ -940,6 +966,9 @@
|
||||
return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_equip+lastused_light+lastused_environ]) : [cell? cell.percent() : "N/C"] ([charging])"
|
||||
|
||||
/obj/machinery/power/apc/proc/update()
|
||||
var/old_light = area.power_light
|
||||
var/old_equip = area.power_equip
|
||||
var/old_environ = area.power_environ
|
||||
if(operating && !shorted && !failure_timer)
|
||||
area.power_light = (lighting > 1)
|
||||
area.power_equip = (equipment > 1)
|
||||
@@ -948,7 +977,8 @@
|
||||
area.power_light = FALSE
|
||||
area.power_equip = FALSE
|
||||
area.power_environ = FALSE
|
||||
area.power_change()
|
||||
if(old_light != area.power_light || old_equip != area.power_equip || old_environ != area.power_environ)
|
||||
area.power_change()
|
||||
|
||||
/obj/machinery/power/apc/proc/can_use(mob/user, loud = 0) //used by attack_hand() and Topic()
|
||||
if(IsAdminGhost(user))
|
||||
@@ -979,43 +1009,32 @@
|
||||
. = UI_INTERACTIVE
|
||||
|
||||
/obj/machinery/power/apc/ui_act(action, params)
|
||||
if(..() || !can_use(usr, 1))
|
||||
return
|
||||
if(failure_timer)
|
||||
if(action == "reboot")
|
||||
failure_timer = 0
|
||||
update_icon()
|
||||
update()
|
||||
if (action == "hijack" && can_use(usr, 1)) //don't need auth for hijack button
|
||||
hijack(usr)
|
||||
return
|
||||
var/authorized = (!locked || area.hasSiliconAccessInArea(usr, PRIVILEDGES_SILICON|PRIVILEDGES_DRONE) || (integration_cog && (is_servant_of_ratvar(usr))))
|
||||
if((action == "toggle_nightshift") && (!nightshift_requires_auth || authorized))
|
||||
toggle_nightshift_lights()
|
||||
return TRUE
|
||||
if(!authorized)
|
||||
if(..() || !can_use(usr, 1) || (locked && !area.hasSiliconAccessInArea(usr, PRIVILEDGES_SILICON|PRIVILEDGES_DRONE) && !failure_timer && action != "toggle_nightshift" && (!integration_cog || !(is_servant_of_ratvar(usr)))))
|
||||
return
|
||||
switch(action)
|
||||
if("lock")
|
||||
if(area.hasSiliconAccessInArea(usr))
|
||||
if((obj_flags & EMAGGED) || (stat & (BROKEN|MAINT)))
|
||||
to_chat(usr, "The APC does not respond to the command.")
|
||||
to_chat(usr, "<span class='warning'>The APC does not respond to the command!</span>")
|
||||
else
|
||||
locked = !locked
|
||||
update_icon()
|
||||
return TRUE
|
||||
. = TRUE
|
||||
if("cover")
|
||||
coverlocked = !coverlocked
|
||||
return TRUE
|
||||
. = TRUE
|
||||
if("breaker")
|
||||
toggle_breaker()
|
||||
return TRUE
|
||||
toggle_breaker(usr)
|
||||
. = TRUE
|
||||
if("toggle_nightshift")
|
||||
toggle_nightshift_lights()
|
||||
. = TRUE
|
||||
if("charge")
|
||||
chargemode = !chargemode
|
||||
if(!chargemode)
|
||||
charging = APC_NOT_CHARGING
|
||||
update_icon()
|
||||
return TRUE
|
||||
. = TRUE
|
||||
if("channel")
|
||||
if(params["eqp"])
|
||||
equipment = setsubsystem(text2num(params["eqp"]))
|
||||
@@ -1029,23 +1048,24 @@
|
||||
environ = setsubsystem(text2num(params["env"]))
|
||||
update_icon()
|
||||
update()
|
||||
return TRUE
|
||||
. = TRUE
|
||||
if("overload")
|
||||
if(area.hasSiliconAccessInArea(usr))
|
||||
if(area.hasSiliconAccessInArea(usr, PRIVILEDGES_SILICON|PRIVILEDGES_DRONE)) //usr.has_unlimited_silicon_privilege)
|
||||
overload_lighting()
|
||||
return TRUE
|
||||
. = TRUE
|
||||
if("hack")
|
||||
if(get_malf_status(usr))
|
||||
malfhack(usr)
|
||||
return TRUE
|
||||
if("occupy")
|
||||
if(get_malf_status(usr))
|
||||
malfoccupy(usr)
|
||||
return TRUE
|
||||
if("deoccupy")
|
||||
if(get_malf_status(usr))
|
||||
malfvacate()
|
||||
return TRUE
|
||||
if("reboot")
|
||||
failure_timer = 0
|
||||
update_icon()
|
||||
update()
|
||||
if("emergency_lighting")
|
||||
emergency_lights = !emergency_lights
|
||||
for(var/obj/machinery/light/L in area)
|
||||
@@ -1053,31 +1073,14 @@
|
||||
L.no_emergency = emergency_lights
|
||||
INVOKE_ASYNC(L, /obj/machinery/light/.proc/update, FALSE)
|
||||
CHECK_TICK
|
||||
if("drain")
|
||||
cell.use(cell.charge)
|
||||
hijacker.toggleSiliconAccessArea(area)
|
||||
hijacker = null
|
||||
set_hijacked_lighting()
|
||||
update_icon()
|
||||
var/obj/item/implant/hijack/H = usr.getImplant(/obj/item/implant/hijack)
|
||||
H.stealthcooldown = world.time + 2 MINUTES
|
||||
energy_fail(30 SECONDS * (cell.charge / cell.maxcharge))
|
||||
if("lockdown")
|
||||
var/celluse = rand(20,35)
|
||||
celluse = celluse /100
|
||||
for (var/obj/machinery/door/D in GLOB.airlocks)
|
||||
if (get_area(D) == area)
|
||||
INVOKE_ASYNC(D,/obj/machinery/door.proc/hostile_lockdown,usr, FALSE)
|
||||
addtimer(CALLBACK(D,/obj/machinery/door.proc/disable_lockdown, FALSE), 30 SECONDS)
|
||||
cell.charge -= cell.maxcharge*celluse
|
||||
var/obj/item/implant/hijack/H = usr.getImplant(/obj/item/implant/hijack)
|
||||
H.stealthcooldown = world.time + 3 MINUTES
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/apc/proc/toggle_breaker()
|
||||
/obj/machinery/power/apc/proc/toggle_breaker(mob/user)
|
||||
if(!is_operational() || failure_timer)
|
||||
return
|
||||
operating = !operating
|
||||
add_hiddenprint(user) //delete when runtime
|
||||
log_game("[key_name(user)] turned [operating ? "on" : "off"] the [src] in [AREACOORD(src)]")
|
||||
update()
|
||||
update_icon()
|
||||
|
||||
@@ -1122,6 +1125,10 @@
|
||||
if(malf.malfhacking)
|
||||
to_chat(malf, "You are already hacking an APC.")
|
||||
return
|
||||
var/area/ourarea = get_area(src)
|
||||
if(!ourarea.valid_malf_hack)
|
||||
to_chat(malf, "This APC is not well connected enough to the Exonet to provide any useful processing capabilities.")
|
||||
return
|
||||
to_chat(malf, "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process.")
|
||||
malf.malfhack = src
|
||||
malf.malfhacking = addtimer(CALLBACK(malf, /mob/living/silicon/ai/.proc/malfhacked, src), 600, TIMER_STOPPABLE)
|
||||
@@ -1141,6 +1148,7 @@
|
||||
return
|
||||
if(!is_station_level(z))
|
||||
return
|
||||
malf.ShutOffDoomsdayDevice()
|
||||
occupier = new /mob/living/silicon/ai(src, malf.laws, malf) //DEAR GOD WHY? //IKR????
|
||||
occupier.adjustOxyLoss(malf.getOxyLoss())
|
||||
if(!findtext(occupier.name, "APC Copy"))
|
||||
@@ -1314,6 +1322,11 @@
|
||||
cur_used -= lastused_light
|
||||
lighting_satisfied = TRUE
|
||||
|
||||
//If drained by an integration cog: Forcefully avert as much of the powerdrain as possible, though a maximum of MAXIMUM_COG_REGAIN
|
||||
if(cur_excess && cog_drained && cell)
|
||||
var/cog_regain = cell.give(min(min(cog_drained, cur_excess), MAXIMUM_COG_REGAIN))
|
||||
cur_excess -= cog_regain
|
||||
cog_drained = max(0, cog_drained - cog_regain)
|
||||
|
||||
// next: take from or charge to the cell, depending on how much is left
|
||||
if(cell && !shorted)
|
||||
@@ -1576,6 +1589,8 @@
|
||||
#undef APC_UPOVERLAY_LOCKED
|
||||
#undef APC_UPOVERLAY_OPERATING
|
||||
|
||||
#undef MAXIMUM_COG_REGAIN
|
||||
|
||||
/*Power module, used for APC construction*/
|
||||
/obj/item/electronics/apc
|
||||
name = "power control module"
|
||||
|
||||
@@ -171,8 +171,8 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
return
|
||||
coil.cable_join(src, user)
|
||||
|
||||
else if(istype(W, /obj/item/twohanded/rcl))
|
||||
var/obj/item/twohanded/rcl/R = W
|
||||
else if(istype(W, /obj/item/rcl))
|
||||
var/obj/item/rcl/R = W
|
||||
if(R.loaded)
|
||||
R.loaded.cable_join(src, user)
|
||||
R.is_empty(user)
|
||||
@@ -569,10 +569,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
icon_state = "[initial(item_state)][amount < 3 ? amount : ""]"
|
||||
name = "cable [amount < 3 ? "piece" : "coil"]"
|
||||
|
||||
/obj/item/stack/cable_coil/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
/obj/item/stack/cable_coil/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
var/obj/item/stack/cable_coil/new_cable = ..()
|
||||
if(istype(new_cable))
|
||||
new_cable.color = color
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/obj/item/stock_parts/cell/vv_edit_var(var_name, var_value)
|
||||
switch(var_name)
|
||||
if("self_recharge")
|
||||
if(NAMEOF(src, self_recharge))
|
||||
if(var_value)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
@@ -151,6 +151,27 @@
|
||||
if(prob(25))
|
||||
corrupt()
|
||||
|
||||
/obj/item/stock_parts/cell/attack_self(mob/user)
|
||||
if(isethereal(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(charge < 100)
|
||||
to_chat(H, "<span class='warning'>The [src] doesn't have enough power!</span>")
|
||||
return
|
||||
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
|
||||
if(stomach.crystal_charge > 146)
|
||||
to_chat(H, "<span class='warning'>Your charge is full!</span>")
|
||||
return
|
||||
to_chat(H, "<span class='notice'>You clumsily channel power through the [src] and into your body, wasting some in the process.</span>")
|
||||
if(do_after(user, 5, target = src))
|
||||
if((charge < 100) || (stomach.crystal_charge > 146))
|
||||
return
|
||||
if(istype(stomach))
|
||||
to_chat(H, "<span class='notice'>You receive some charge from the [src].</span>")
|
||||
stomach.adjust_charge(3)
|
||||
charge -= 100 //you waste way more than you receive, so that ethereals cant just steal one cell and forget about hunger
|
||||
else
|
||||
to_chat(H, "<span class='warning'>You can't receive charge from the [src]!</span>")
|
||||
return
|
||||
|
||||
/obj/item/stock_parts/cell/blob_act(obj/structure/blob/B)
|
||||
ex_act(EXPLODE_DEVASTATE)
|
||||
|
||||
@@ -92,10 +92,7 @@
|
||||
else
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/power/floodlight/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
/obj/machinery/power/floodlight/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
var/current = setting
|
||||
if(current == 1)
|
||||
current = light_setting_list.len
|
||||
@@ -113,4 +110,4 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/power/floodlight/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
|
||||
playsound(src, 'sound/effects/glasshit.ogg', 75, 1)
|
||||
playsound(src, 'sound/effects/glasshit.ogg', 75, 1)
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
var/cold_air_heat_capacity = cold_air.heat_capacity()
|
||||
var/hot_air_heat_capacity = hot_air.heat_capacity()
|
||||
|
||||
var/delta_temperature = hot_air.temperature - cold_air.temperature
|
||||
var/delta_temperature = hot_air.return_temperature() - cold_air.return_temperature()
|
||||
|
||||
|
||||
if(delta_temperature > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0)
|
||||
@@ -66,10 +66,10 @@
|
||||
var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity)
|
||||
|
||||
var/heat = energy_transfer*(1-efficiency)
|
||||
lastgen += energy_transfer*efficiency
|
||||
lastgen += LOGISTIC_FUNCTION(1000000,0.0034,delta_temperature,2000)
|
||||
|
||||
hot_air.temperature = hot_air.temperature - energy_transfer/hot_air_heat_capacity
|
||||
cold_air.temperature = cold_air.temperature + heat/cold_air_heat_capacity
|
||||
hot_air.set_temperature(hot_air.return_temperature() - energy_transfer/hot_air_heat_capacity)
|
||||
cold_air.set_temperature(cold_air.return_temperature() + heat/cold_air_heat_capacity)
|
||||
|
||||
//add_avail(lastgen) This is done in process now
|
||||
// update icon overlays only if displayed level has changed
|
||||
@@ -116,11 +116,11 @@
|
||||
t += "<BR>"
|
||||
|
||||
t += "<B><font color='blue'>Cold loop</font></B><BR>"
|
||||
t += "Temperature Inlet: [round(cold_circ_air2.temperature, 0.1)] K / Outlet: [round(cold_circ_air1.temperature, 0.1)] K<BR>"
|
||||
t += "Temperature Inlet: [round(cold_circ_air2.return_temperature(), 0.1)] K / Outlet: [round(cold_circ_air1.return_temperature(), 0.1)] K<BR>"
|
||||
t += "Pressure Inlet: [round(cold_circ_air2.return_pressure(), 0.1)] kPa / Outlet: [round(cold_circ_air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
|
||||
t += "<B><font color='red'>Hot loop</font></B><BR>"
|
||||
t += "Temperature Inlet: [round(hot_circ_air2.temperature, 0.1)] K / Outlet: [round(hot_circ_air1.temperature, 0.1)] K<BR>"
|
||||
t += "Temperature Inlet: [round(hot_circ_air2.return_temperature(), 0.1)] K / Outlet: [round(hot_circ_air1.return_temperature(), 0.1)] K<BR>"
|
||||
t += "Pressure Inlet: [round(hot_circ_air2.return_pressure(), 0.1)] kPa / Outlet: [round(hot_circ_air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
|
||||
t += "</div>"
|
||||
|
||||
@@ -28,7 +28,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
var/sprite_number = 0
|
||||
|
||||
/obj/machinery/gravity_generator/safe_throw_at()
|
||||
/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)
|
||||
@@ -56,7 +56,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/gravity_generator/proc/set_broken()
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
|
||||
/obj/machinery/gravity_generator/proc/set_fix()
|
||||
stat &= ~BROKEN
|
||||
@@ -80,7 +80,7 @@ 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/attack_hand(mob/user)
|
||||
/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/set_broken()
|
||||
@@ -187,14 +187,14 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
/obj/machinery/gravity_generator/main/attackby(obj/item/I, mob/user, params)
|
||||
switch(broken_state)
|
||||
if(GRAV_NEEDS_SCREWDRIVER)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
if(I.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
to_chat(user, "<span class='notice'>You secure the screws of the framework.</span>")
|
||||
I.play_tool_sound(src)
|
||||
broken_state++
|
||||
update_icon()
|
||||
return
|
||||
if(GRAV_NEEDS_WELDING)
|
||||
if(istype(I, /obj/item/weldingtool))
|
||||
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>")
|
||||
broken_state++
|
||||
@@ -206,25 +206,24 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
if(PS.get_amount() >= 10)
|
||||
PS.use(10)
|
||||
to_chat(user, "<span class='notice'>You add the plating to the framework.</span>")
|
||||
playsound(src.loc, 'sound/machines/click.ogg', 75, 1)
|
||||
playsound(src.loc, 'sound/machines/click.ogg', 75, TRUE)
|
||||
broken_state++
|
||||
update_icon()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need 10 sheets of plasteel!</span>")
|
||||
return
|
||||
if(GRAV_NEEDS_WRENCH)
|
||||
if(istype(I, /obj/item/wrench))
|
||||
if(I.tool_behaviour == TOOL_WRENCH)
|
||||
to_chat(user, "<span class='notice'>You secure the plating to the framework.</span>")
|
||||
I.play_tool_sound(src)
|
||||
set_fix()
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/gravity_generator/main/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
/obj/machinery/gravity_generator/main/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "gravity_generator", name, 400, 200, master_ui, state)
|
||||
ui = new(user, src, "GravityGenerator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/gravity_generator/main/ui_data(mob/user)
|
||||
@@ -241,16 +240,18 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
/obj/machinery/gravity_generator/main/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("gentoggle")
|
||||
breaker = !breaker
|
||||
investigate_log("was toggled [breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(usr)].", INVESTIGATE_GRAVITY)
|
||||
set_power()
|
||||
. = TRUE
|
||||
|
||||
// Power and Icon States
|
||||
|
||||
/obj/machinery/gravity_generator/main/power_change()
|
||||
..()
|
||||
. = ..()
|
||||
investigate_log("has [stat & NOPOWER ? "lost" : "regained"] power.", INVESTIGATE_GRAVITY)
|
||||
set_power()
|
||||
|
||||
@@ -313,7 +314,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
charge_count -= 2
|
||||
|
||||
if(charge_count % 4 == 0 && prob(75)) // Let them know it is charging/discharging.
|
||||
playsound(src.loc, 'sound/effects/empulse.ogg', 100, 1)
|
||||
playsound(src.loc, 'sound/effects/empulse.ogg', 100, TRUE)
|
||||
|
||||
updateDialog()
|
||||
if(prob(25)) // To help stop "Your clothes feel warm." spam.
|
||||
@@ -390,16 +391,13 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
|
||||
// Misc
|
||||
|
||||
/obj/item/paper/guides/jobs/engi/gravity_gen
|
||||
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>"}
|
||||
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.
|
||||
"}
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/stack/cable_coil))
|
||||
if(W.use_tool(src, user, 0, 1, max_level = JOB_SKILL_TRAINED))
|
||||
if(W.use_tool(src, user, 0, 1, skill_gain_mult = TRIVIAL_USE_TOOL_MULT))
|
||||
icon_state = "[fixture_type]-construct-stage2"
|
||||
stage = 2
|
||||
user.visible_message("[user.name] adds wires to [src].", \
|
||||
@@ -595,11 +595,9 @@
|
||||
// attack with hand - remove tube/bulb
|
||||
// if hands aren't protected and the light is on, burn the player
|
||||
|
||||
/obj/machinery/light/attack_hand(mob/living/carbon/human/user)
|
||||
/obj/machinery/light/on_attack_hand(mob/living/carbon/human/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.DelayNextAction(CLICK_CD_MELEE)
|
||||
add_fingerprint(user)
|
||||
|
||||
if(status == LIGHT_EMPTY)
|
||||
@@ -612,7 +610,18 @@
|
||||
var/mob/living/carbon/human/H = user
|
||||
|
||||
if(istype(H))
|
||||
|
||||
var/datum/species/ethereal/eth_species = H.dna?.species
|
||||
if(istype(eth_species))
|
||||
to_chat(H, "<span class='notice'>You start channeling some power through the [fitting] into your body.</span>")
|
||||
if(do_after(user, 50, target = src))
|
||||
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
|
||||
if(istype(stomach))
|
||||
to_chat(H, "<span class='notice'>You receive some charge from the [fitting].</span>")
|
||||
stomach.adjust_charge(2)
|
||||
else
|
||||
to_chat(H, "<span class='warning'>You can't receive charge from the [fitting]!</span>")
|
||||
return
|
||||
|
||||
if(H.gloves)
|
||||
var/obj/item/clothing/gloves/G = H.gloves
|
||||
if(G.max_heat_protection_temperature)
|
||||
@@ -812,11 +821,11 @@
|
||||
return
|
||||
|
||||
/obj/item/light/attack(mob/living/M, mob/living/user, def_zone)
|
||||
..()
|
||||
. = ..()
|
||||
shatter()
|
||||
|
||||
/obj/item/light/attack_obj(obj/O, mob/living/user)
|
||||
..()
|
||||
. = ..()
|
||||
shatter()
|
||||
|
||||
/obj/item/light/proc/shatter()
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
idle_power_usage = 20
|
||||
active_power_usage = 100
|
||||
circuit = /obj/item/circuitboard/computer/powermonitor
|
||||
tgui_id = "PowerMonitor"
|
||||
|
||||
var/obj/structure/cable/attached_wire
|
||||
var/obj/machinery/power/apc/local_apc
|
||||
@@ -19,8 +20,6 @@
|
||||
var/record_interval = 50
|
||||
var/next_record = 0
|
||||
var/is_secret_monitor = FALSE
|
||||
tgui_id = "power_monitor"
|
||||
ui_style = "ntos"
|
||||
|
||||
/obj/machinery/computer/monitor/secret //Hides the power monitor (such as ones on ruins & CentCom) from PDA's to prevent metagaming.
|
||||
name = "outdated power monitoring console"
|
||||
@@ -83,11 +82,10 @@
|
||||
if(demand.len > record_size)
|
||||
demand.Cut(1, 2)
|
||||
|
||||
/obj/machinery/computer/monitor/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
/obj/machinery/computer/monitor/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, tgui_id, name, 550, 700, master_ui, state)
|
||||
ui = new(user, src, "PowerMonitor", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/monitor/ui_data()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
//Baseline portable generator. Has all the default handling. Not intended to be used on it's own (since it generates unlimited power).
|
||||
/obj/machinery/power/port_gen
|
||||
name = "portable generator"
|
||||
@@ -9,9 +8,8 @@
|
||||
anchored = FALSE
|
||||
use_power = NO_POWER_USE
|
||||
|
||||
var/active = 0
|
||||
var/active = FALSE
|
||||
var/power_gen = 5000
|
||||
var/recent_fault = 0
|
||||
var/power_output = 1
|
||||
var/consumption = 0
|
||||
var/base_icon = "portgen0"
|
||||
@@ -27,8 +25,13 @@
|
||||
QDEL_NULL(soundloop)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/port_gen/connect_to_network()
|
||||
if(!anchored)
|
||||
return FALSE
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/power/port_gen/proc/HasFuel() //Placeholder for fuel check.
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/port_gen/proc/UseFuel() //Placeholder for fuel use.
|
||||
return
|
||||
@@ -39,26 +42,38 @@
|
||||
/obj/machinery/power/port_gen/proc/handleInactive()
|
||||
return
|
||||
|
||||
/obj/machinery/power/port_gen/proc/TogglePower()
|
||||
if(active)
|
||||
active = FALSE
|
||||
update_icon()
|
||||
soundloop.stop()
|
||||
else if(HasFuel())
|
||||
active = TRUE
|
||||
START_PROCESSING(SSmachines, src)
|
||||
update_icon()
|
||||
soundloop.start()
|
||||
|
||||
/obj/machinery/power/port_gen/update_icon_state()
|
||||
icon_state = "[base_icon]_[active]"
|
||||
|
||||
/obj/machinery/power/port_gen/process()
|
||||
if(active && HasFuel() && !crit_fail && anchored && powernet)
|
||||
add_avail(power_gen * power_output)
|
||||
if(active)
|
||||
if(!HasFuel() || !anchored)
|
||||
TogglePower()
|
||||
return
|
||||
if(powernet)
|
||||
add_avail(power_gen * power_output)
|
||||
UseFuel()
|
||||
src.updateDialog()
|
||||
soundloop.start()
|
||||
|
||||
else
|
||||
active = 0
|
||||
handleInactive()
|
||||
update_icon()
|
||||
soundloop.stop()
|
||||
|
||||
/obj/machinery/power/port_gen/examine(mob/user)
|
||||
. = ..()
|
||||
. += "It is[!active?"n't":""] running."
|
||||
|
||||
/////////////////
|
||||
// P.A.C.M.A.N //
|
||||
/////////////////
|
||||
/obj/machinery/power/port_gen/pacman
|
||||
name = "\improper P.A.C.M.A.N.-type portable generator"
|
||||
circuit = /obj/item/circuitboard/machine/pacman
|
||||
@@ -78,8 +93,8 @@
|
||||
/obj/machinery/power/port_gen/pacman/Initialize()
|
||||
. = ..()
|
||||
|
||||
var/obj/sheet = new sheet_path(null)
|
||||
sheet_name = sheet.name
|
||||
var/obj/S = sheet_path
|
||||
sheet_name = initial(S.name)
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/Destroy()
|
||||
DropFuel()
|
||||
@@ -100,16 +115,16 @@
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The generator has [sheets] units of [sheet_name] fuel left, producing [power_gen] per cycle.</span>"
|
||||
if(crit_fail)
|
||||
. += "<span class='danger'>The generator seems to have broken down.</span>"
|
||||
. += "<span class='notice'>The generator has [sheets] units of [sheet_name] fuel left, producing [DisplayPower(power_gen)] per cycle.</span>"
|
||||
if(anchored)
|
||||
. += "<span class='notice'>It is anchored to the ground.</span>"
|
||||
if(in_range(user, src) || isobserver(user))
|
||||
. += "<span class='notice'>The status display reads: Fuel efficiency increased by <b>[(consumption*100)-100]%</b>.</span>"
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/HasFuel()
|
||||
if(sheets >= 1 / (time_per_sheet / power_output) - sheet_left)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/DropFuel()
|
||||
if(sheets)
|
||||
@@ -145,13 +160,11 @@
|
||||
if (current_heat > 300)
|
||||
overheat()
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/handleInactive()
|
||||
|
||||
if (current_heat > 0)
|
||||
current_heat = max(current_heat - 2, 0)
|
||||
src.updateDialog()
|
||||
current_heat = max(current_heat - 2, 0)
|
||||
if(current_heat == 0)
|
||||
STOP_PROCESSING(SSmachines, src)
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/proc/overheat()
|
||||
explosion(src.loc, 2, 5, 2, -1)
|
||||
@@ -166,24 +179,21 @@
|
||||
to_chat(user, "<span class='notice'>You add [amount] sheets to the [src.name].</span>")
|
||||
sheets += amount
|
||||
addstack.use(amount)
|
||||
updateUsrDialog()
|
||||
return
|
||||
else if(!active)
|
||||
|
||||
if(istype(O, /obj/item/wrench))
|
||||
|
||||
if(O.tool_behaviour == TOOL_WRENCH)
|
||||
if(!anchored && !isinspace())
|
||||
anchored = TRUE
|
||||
connect_to_network()
|
||||
to_chat(user, "<span class='notice'>You secure the generator to the floor.</span>")
|
||||
anchored = TRUE
|
||||
else if(anchored)
|
||||
anchored = FALSE
|
||||
disconnect_from_network()
|
||||
to_chat(user, "<span class='notice'>You unsecure the generator from the floor.</span>")
|
||||
anchored = FALSE
|
||||
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
|
||||
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
return
|
||||
else if(istype(O, /obj/item/screwdriver))
|
||||
else if(O.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
panel_open = !panel_open
|
||||
O.play_tool_sound(src)
|
||||
if(panel_open)
|
||||
@@ -196,12 +206,10 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/emag_act(mob/user)
|
||||
. = ..()
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
obj_flags |= EMAGGED
|
||||
emp_act(EMP_HEAVY)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/attack_ai(mob/user)
|
||||
interact(user)
|
||||
@@ -209,60 +217,51 @@
|
||||
/obj/machinery/power/port_gen/pacman/attack_paw(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/ui_interact(mob/user)
|
||||
. = ..()
|
||||
if (get_dist(src, user) > 1 )
|
||||
if(!isAI(user))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=port_gen")
|
||||
return
|
||||
/obj/machinery/power/port_gen/pacman/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "PortableGenerator", name)
|
||||
ui.open()
|
||||
|
||||
var/dat = text("<b>[name]</b><br>")
|
||||
if (active)
|
||||
dat += text("Generator: <A href='?src=[REF(src)];action=disable'>On</A><br>")
|
||||
else
|
||||
dat += text("Generator: <A href='?src=[REF(src)];action=enable'>Off</A><br>")
|
||||
dat += text("[capitalize(sheet_name)]: [sheets] - <A href='?src=[REF(src)];action=eject'>Eject</A><br>")
|
||||
var/stack_percent = round(sheet_left * 100, 1)
|
||||
dat += text("Current stack: [stack_percent]% <br>")
|
||||
dat += text("Power output: <A href='?src=[REF(src)];action=lower_power'>-</A> [power_gen * power_output] <A href='?src=[REF(src)];action=higher_power'>+</A><br>")
|
||||
dat += text("Power current: [(powernet == null ? "Unconnected" : "[DisplayPower(avail())]")]<br>")
|
||||
dat += text("Heat: [current_heat]<br>")
|
||||
dat += "<br><A href='?src=[REF(src)];action=close'>Close</A>"
|
||||
user << browse(dat, "window=port_gen")
|
||||
onclose(user, "port_gen")
|
||||
/obj/machinery/power/port_gen/pacman/ui_data()
|
||||
var/data = list()
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/Topic(href, href_list)
|
||||
data["active"] = active
|
||||
data["sheet_name"] = capitalize(sheet_name)
|
||||
data["sheets"] = sheets
|
||||
data["stack_percent"] = round(sheet_left * 100, 0.1)
|
||||
|
||||
data["anchored"] = anchored
|
||||
data["connected"] = (powernet == null ? 0 : 1)
|
||||
data["ready_to_boot"] = anchored && HasFuel()
|
||||
data["power_generated"] = DisplayPower(power_gen)
|
||||
data["power_output"] = DisplayPower(power_gen * power_output)
|
||||
data["power_available"] = (powernet == null ? 0 : DisplayPower(avail()))
|
||||
data["current_heat"] = current_heat
|
||||
. = data
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
TogglePower()
|
||||
. = TRUE
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["action"])
|
||||
if(href_list["action"] == "enable")
|
||||
if(!active && HasFuel() && !crit_fail)
|
||||
active = 1
|
||||
src.updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["action"] == "disable")
|
||||
if (active)
|
||||
active = 0
|
||||
src.updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["action"] == "eject")
|
||||
if("eject")
|
||||
if(!active)
|
||||
DropFuel()
|
||||
src.updateUsrDialog()
|
||||
if(href_list["action"] == "lower_power")
|
||||
. = TRUE
|
||||
|
||||
if("lower_power")
|
||||
if (power_output > 1)
|
||||
power_output--
|
||||
src.updateUsrDialog()
|
||||
if (href_list["action"] == "higher_power")
|
||||
. = TRUE
|
||||
|
||||
if("higher_power")
|
||||
if (power_output < 4 || (obj_flags & EMAGGED))
|
||||
power_output++
|
||||
src.updateUsrDialog()
|
||||
if (href_list["action"] == "close")
|
||||
usr << browse(null, "window=port_gen")
|
||||
usr.unset_machine()
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/super
|
||||
name = "\improper S.U.P.E.R.P.A.C.M.A.N.-type portable generator"
|
||||
|
||||
@@ -299,8 +299,8 @@
|
||||
//siemens_coeff - layman's terms, conductivity
|
||||
//dist_check - set to only shock mobs within 1 of source (vendors, airlocks, etc.)
|
||||
//No animations will be performed by this proc.
|
||||
/proc/electrocute_mob(mob/living/carbon/M, power_source, obj/source, siemens_coeff = 1, dist_check = FALSE)
|
||||
if(!M || ismecha(M.loc))
|
||||
/proc/electrocute_mob(mob/living/M, power_source, obj/source, siemens_coeff = 1, dist_check = FALSE)
|
||||
if(!istype(M) || ismecha(M.loc))
|
||||
return 0 //feckin mechs are dumb
|
||||
if(dist_check)
|
||||
if(!in_range(source,M))
|
||||
@@ -386,4 +386,4 @@
|
||||
var/target = base_area ? base_area : src
|
||||
for(var/obj/machinery/power/apc/APC in GLOB.apcs_list)
|
||||
if(APC.area == target)
|
||||
return APC
|
||||
return APC
|
||||
|
||||
@@ -47,31 +47,29 @@
|
||||
if(!loaded_tank)
|
||||
return
|
||||
if(!bitcoinmining)
|
||||
if(!loaded_tank.air_contents.gases[/datum/gas/plasma])
|
||||
if(loaded_tank.air_contents.get_moles(/datum/gas/plasma) < 0.0001)
|
||||
investigate_log("<font color='red'>out of fuel</font>.", INVESTIGATE_SINGULO)
|
||||
playsound(src, 'sound/machines/ding.ogg', 50, 1)
|
||||
Radio.talk_into(src, "Insufficient plasma in [get_area(src)] [src], ejecting \the [loaded_tank].", FREQ_ENGINEERING)
|
||||
eject()
|
||||
else
|
||||
var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.gases[/datum/gas/plasma])
|
||||
loaded_tank.air_contents.gases[/datum/gas/plasma] -= 2.7 * gasdrained
|
||||
loaded_tank.air_contents.gases[/datum/gas/tritium] += 2.7 * gasdrained
|
||||
GAS_GARBAGE_COLLECT(loaded_tank.air_contents.gases)
|
||||
var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.get_moles(/datum/gas/plasma))
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/plasma, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, gasdrained)
|
||||
|
||||
var/power_produced = RAD_COLLECTOR_OUTPUT
|
||||
add_avail(power_produced)
|
||||
stored_power-=power_produced
|
||||
else if(is_station_level(z) && SSresearch.science_tech)
|
||||
if(!loaded_tank.air_contents.gases[/datum/gas/tritium] || !loaded_tank.air_contents.gases[/datum/gas/oxygen])
|
||||
if(!loaded_tank.air_contents.get_moles(/datum/gas/tritium) || !loaded_tank.air_contents.get_moles(/datum/gas/oxygen))
|
||||
playsound(src, 'sound/machines/ding.ogg', 50, 1)
|
||||
Radio.talk_into(src, "Insufficient oxygen and tritium in [get_area(src)] [src] to produce research points, ejecting \the [loaded_tank].", FREQ_ENGINEERING)
|
||||
eject()
|
||||
else
|
||||
var/gasdrained = bitcoinproduction_drain*drainratio
|
||||
loaded_tank.air_contents.gases[/datum/gas/tritium] -= gasdrained
|
||||
loaded_tank.air_contents.gases[/datum/gas/oxygen] -= gasdrained
|
||||
loaded_tank.air_contents.gases[/datum/gas/carbon_dioxide] += gasdrained*2
|
||||
GAS_GARBAGE_COLLECT(loaded_tank.air_contents.gases)
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/oxygen, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/carbon_dioxide, gasdrained*2)
|
||||
var/bitcoins_mined = stored_power*RAD_COLLECTOR_MINING_CONVERSION_RATE
|
||||
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_ENG)
|
||||
if(D)
|
||||
@@ -86,9 +84,7 @@
|
||||
toggle_power()
|
||||
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
|
||||
"<span class='notice'>You turn the [src.name] [active? "on":"off"].</span>")
|
||||
var/fuel
|
||||
if(loaded_tank)
|
||||
fuel = loaded_tank.air_contents.gases[/datum/gas/plasma]
|
||||
var/fuel = loaded_tank.air_contents.get_moles(/datum/gas/plasma)
|
||||
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"<font color='red'>It is empty</font>"].", INVESTIGATE_SINGULO)
|
||||
return
|
||||
else
|
||||
@@ -180,6 +176,7 @@
|
||||
/obj/machinery/power/rad_collector/analyzer_act(mob/living/user, obj/item/I)
|
||||
if(loaded_tank)
|
||||
loaded_tank.analyzer_act(user, I)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/rad_collector/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
FG2.fields -= src
|
||||
return ..()
|
||||
|
||||
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
||||
/obj/machinery/field/containment/attack_hand(mob/user)
|
||||
/obj/machinery/field/containment/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
if(get_dist(src, user) > 1)
|
||||
return FALSE
|
||||
else
|
||||
|
||||
@@ -315,6 +315,9 @@
|
||||
|
||||
/obj/machinery/power/emitter/proc/integrate(obj/item/gun/energy/E,mob/user)
|
||||
if(istype(E, /obj/item/gun/energy))
|
||||
if(!E.can_emitter)
|
||||
to_chat(user, "<span class='warning'>[E] cannot fit into emitters.</span>")
|
||||
return
|
||||
if(!user.transferItemToLoc(E, src))
|
||||
return
|
||||
gun = E
|
||||
|
||||
@@ -103,7 +103,6 @@
|
||||
did_something = TRUE
|
||||
|
||||
if(did_something)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
update_state()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 10000
|
||||
dir = NORTH
|
||||
var/strength_upper_limit = 2
|
||||
var/interface_control = 1
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = 0
|
||||
var/construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
var/active = 0
|
||||
var/strength = 0
|
||||
var/powered = 0
|
||||
mouse_opacity = MOUSE_OPACITY_OPAQUE
|
||||
var/strength_upper_limit = 2
|
||||
var/interface_control = TRUE
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = FALSE
|
||||
var/construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
var/active = FALSE
|
||||
var/strength = 0
|
||||
var/powered = FALSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Initialize()
|
||||
. = ..()
|
||||
@@ -34,30 +34,27 @@
|
||||
QDEL_NULL(wires)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user)
|
||||
/obj/machinery/particle_accelerator/control_box/multitool_act(mob/living/user, obj/item/I)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(construction_state == PA_CONSTRUCTION_COMPLETE)
|
||||
interact(user)
|
||||
else if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
wires.interact(user)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/update_state()
|
||||
if(construction_state < PA_CONSTRUCTION_COMPLETE)
|
||||
use_power = NO_POWER_USE
|
||||
assembled = 0
|
||||
active = 0
|
||||
assembled = FALSE
|
||||
active = FALSE
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.powered = FALSE
|
||||
part.update_icon()
|
||||
connected_parts.Cut()
|
||||
return
|
||||
if(!part_scan())
|
||||
use_power = IDLE_POWER_USE
|
||||
active = 0
|
||||
active = FALSE
|
||||
connected_parts.Cut()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon_state()
|
||||
@@ -78,36 +75,6 @@
|
||||
else
|
||||
icon_state = "control_boxc"
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(!interface_control)
|
||||
to_chat(usr, "<span class='error'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=pacontrol")
|
||||
usr.unset_machine()
|
||||
return
|
||||
if(href_list["togglep"])
|
||||
if(!wires.is_cut(WIRE_POWER))
|
||||
toggle_power()
|
||||
|
||||
else if(href_list["scan"])
|
||||
part_scan()
|
||||
|
||||
else if(href_list["strengthup"])
|
||||
if(!wires.is_cut(WIRE_STRENGTH))
|
||||
add_strength()
|
||||
|
||||
else if(href_list["strengthdown"])
|
||||
if(!wires.is_cut(WIRE_STRENGTH))
|
||||
remove_strength()
|
||||
|
||||
updateDialog()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
@@ -123,7 +90,6 @@
|
||||
log_game("PA Control Computer increased to [strength] by [key_name(usr)] in [AREACOORD(src)]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [key_name(usr)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(s)
|
||||
if(assembled && (strength > 0))
|
||||
strength--
|
||||
@@ -133,11 +99,10 @@
|
||||
log_game("PA Control Computer decreased to [strength] by [key_name(usr)] in [AREACOORD(src)]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [key_name(usr)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
..()
|
||||
. = ..()
|
||||
if(stat & NOPOWER)
|
||||
active = 0
|
||||
active = FALSE
|
||||
use_power = NO_POWER_USE
|
||||
else if(!stat && construction_state == PA_CONSTRUCTION_COMPLETE)
|
||||
use_power = IDLE_POWER_USE
|
||||
@@ -160,49 +125,48 @@
|
||||
var/odir = turn(dir,180)
|
||||
var/turf/T = loc
|
||||
|
||||
assembled = 0
|
||||
assembled = FALSE
|
||||
critical_machine = FALSE
|
||||
|
||||
var/obj/structure/particle_accelerator/fuel_chamber/F = locate() in orange(1,src)
|
||||
if(!F)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
setDir(F.dir)
|
||||
connected_parts.Cut()
|
||||
|
||||
T = get_step(T,rdir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/fuel_chamber))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,odir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/end_cap))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,dir)
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/power_box))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/center))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,ldir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/left))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,rdir)
|
||||
T = get_step(T,rdir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/right))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
assembled = 1
|
||||
assembled = TRUE
|
||||
critical_machine = TRUE //Only counts if the PA is actually assembled.
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/check_part(turf/T, type)
|
||||
var/obj/structure/particle_accelerator/PA = locate(/obj/structure/particle_accelerator) in T
|
||||
if(istype(PA, type) && (PA.construction_state == PA_CONSTRUCTION_COMPLETE))
|
||||
if(PA.connect_master(src))
|
||||
connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
active = !active
|
||||
@@ -214,47 +178,16 @@
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = strength
|
||||
part.powered = 1
|
||||
part.powered = TRUE
|
||||
part.update_icon()
|
||||
else
|
||||
use_power = IDLE_POWER_USE
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.powered = FALSE
|
||||
part.update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_interact(mob/user)
|
||||
. = ..()
|
||||
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
|
||||
if(!issilicon(user))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=pacontrol")
|
||||
return
|
||||
|
||||
var/dat = ""
|
||||
dat += "<A href='?src=[REF(src)];close=1'>Close</A><BR><BR>"
|
||||
dat += "<h3>Status</h3>"
|
||||
if(!assembled)
|
||||
dat += "Unable to detect all parts!<BR>"
|
||||
dat += "<A href='?src=[REF(src)];scan=1'>Run Scan</A><BR><BR>"
|
||||
else
|
||||
dat += "All parts in place.<BR><BR>"
|
||||
dat += "Power:"
|
||||
if(active)
|
||||
dat += "On<BR>"
|
||||
else
|
||||
dat += "Off <BR>"
|
||||
dat += "<A href='?src=[REF(src)];togglep=1'>Toggle Power</A><BR><BR>"
|
||||
dat += "Particle Strength: [strength] "
|
||||
dat += "<A href='?src=[REF(src)];strengthdown=1'>--</A>|<A href='?src=[REF(src)];strengthup=1'>++</A><BR><BR>"
|
||||
|
||||
var/datum/browser/popup = new(user, "pacontrol", name, 420, 300)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(user.browse_rsc_icon(icon, icon_state))
|
||||
popup.open()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -266,53 +199,51 @@
|
||||
if(PA_CONSTRUCTION_PANEL_OPEN)
|
||||
. += "The panel is open."
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attackby(obj/item/W, mob/user, params)
|
||||
var/did_something = FALSE
|
||||
|
||||
switch(construction_state)
|
||||
if(PA_CONSTRUCTION_UNSECURED)
|
||||
if(istype(W, /obj/item/wrench) && !isinspace())
|
||||
if(W.tool_behaviour == TOOL_WRENCH && !isinspace())
|
||||
W.play_tool_sound(src, 75)
|
||||
anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
user.visible_message("<span class='notice'>[user.name] secures the [name] to the floor.</span>", \
|
||||
"<span class='notice'>You secure the external bolts.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNWIRED
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_UNWIRED)
|
||||
if(istype(W, /obj/item/wrench))
|
||||
if(W.tool_behaviour == TOOL_WRENCH)
|
||||
W.play_tool_sound(src, 75)
|
||||
anchored = FALSE
|
||||
user.visible_message("[user.name] detaches the [name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
user.visible_message("<span class='notice'>[user.name] detaches the [name] from the floor.</span>", \
|
||||
"<span class='notice'>You remove the external bolts.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
did_something = TRUE
|
||||
else if(istype(W, /obj/item/stack/cable_coil))
|
||||
if(W.use_tool(src, user, 0, 1))
|
||||
user.visible_message("[user.name] adds wires to the [name].", \
|
||||
"You add some wires.")
|
||||
user.visible_message("<span class='notice'>[user.name] adds wires to the [name].</span>", \
|
||||
"<span class='notice'>You add some wires.</span>")
|
||||
construction_state = PA_CONSTRUCTION_PANEL_OPEN
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_PANEL_OPEN)
|
||||
if(istype(W, /obj/item/wirecutters))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [name].", \
|
||||
"You remove some wires.")
|
||||
if(W.tool_behaviour == TOOL_WIRECUTTER)//TODO:Shock user if its on?
|
||||
user.visible_message("<span class='notice'>[user.name] removes some wires from the [name].</span>", \
|
||||
"<span class='notice'>You remove some wires.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNWIRED
|
||||
did_something = TRUE
|
||||
else if(istype(W, /obj/item/screwdriver))
|
||||
user.visible_message("[user.name] closes the [name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
user.visible_message("<span class='notice'>[user.name] closes the [name]'s access panel.</span>", \
|
||||
"<span class='notice'>You close the access panel.</span>")
|
||||
construction_state = PA_CONSTRUCTION_COMPLETE
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_COMPLETE)
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
user.visible_message("[user.name] opens the [name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
if(W.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
user.visible_message("<span class='notice'>[user.name] opens the [name]'s access panel.</span>", \
|
||||
"<span class='notice'>You open the access panel.</span>")
|
||||
construction_state = PA_CONSTRUCTION_PANEL_OPEN
|
||||
did_something = TRUE
|
||||
|
||||
if(did_something)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
update_state()
|
||||
update_icon()
|
||||
return
|
||||
@@ -323,6 +254,64 @@
|
||||
if(prob(50))
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/interact(mob/user)
|
||||
if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/is_interactive(mob/user)
|
||||
if(!interface_control)
|
||||
to_chat(user, "<span class='alert'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return FALSE
|
||||
if(construction_state != PA_CONSTRUCTION_COMPLETE)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_status(mob/user)
|
||||
if(is_interactive(user))
|
||||
return ..()
|
||||
return UI_CLOSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ParticleAccelerator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["assembled"] = assembled
|
||||
data["power"] = active
|
||||
data["strength"] = strength
|
||||
return data
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
if(wires.is_cut(WIRE_POWER))
|
||||
return
|
||||
toggle_power()
|
||||
. = TRUE
|
||||
if("scan")
|
||||
part_scan()
|
||||
. = TRUE
|
||||
if("add_strength")
|
||||
if(wires.is_cut(WIRE_STRENGTH))
|
||||
return
|
||||
add_strength()
|
||||
. = TRUE
|
||||
if("remove_strength")
|
||||
if(wires.is_cut(WIRE_STRENGTH))
|
||||
return
|
||||
remove_strength()
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
|
||||
#undef PA_CONSTRUCTION_UNSECURED
|
||||
#undef PA_CONSTRUCTION_UNWIRED
|
||||
#undef PA_CONSTRUCTION_PANEL_OPEN
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
last_failed_movement = direct
|
||||
return 0
|
||||
|
||||
/obj/singularity/attack_hand(mob/user)
|
||||
/obj/singularity/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
consume(user)
|
||||
return TRUE
|
||||
|
||||
|
||||
+34
-35
@@ -21,6 +21,7 @@
|
||||
density = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
circuit = /obj/item/circuitboard/machine/smes
|
||||
|
||||
var/capacity = 5e6 // maximum charge
|
||||
var/charge = 0 // actual charge
|
||||
|
||||
@@ -54,7 +55,7 @@
|
||||
break dir_loop
|
||||
|
||||
if(!terminal)
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
return
|
||||
terminal.master = src
|
||||
update_icon()
|
||||
@@ -123,22 +124,22 @@
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You start building the power terminal...</span>")
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
|
||||
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
|
||||
if(C.use_tool(src, user, 20, 10))
|
||||
var/obj/structure/cable/N = T.get_cable_node() //get the connecting node cable, if there's one
|
||||
if (prob(50) && electrocute_mob(usr, N, N, 1, TRUE)) //animate the electrocution if uncautious and unlucky
|
||||
do_sparks(5, TRUE, src)
|
||||
return
|
||||
if(!terminal)
|
||||
C.use(10)
|
||||
user.visible_message("<span class='notice'>[user.name] builds a power terminal.</span>",\
|
||||
"<span class='notice'>You build the power terminal.</span>")
|
||||
|
||||
user.visible_message(\
|
||||
"[user.name] has built a power terminal.",\
|
||||
"<span class='notice'>You build the power terminal.</span>")
|
||||
|
||||
//build the terminal and link it to the network
|
||||
make_terminal(T)
|
||||
terminal.connect_to_network()
|
||||
connect_to_network()
|
||||
//build the terminal and link it to the network
|
||||
make_terminal(T)
|
||||
terminal.connect_to_network()
|
||||
connect_to_network()
|
||||
return
|
||||
|
||||
//crowbarring it !
|
||||
@@ -148,13 +149,14 @@
|
||||
log_game("[src] has been deconstructed by [key_name(user)] at [AREACOORD(src)]")
|
||||
investigate_log("SMES deconstructed by [key_name(user)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
||||
return
|
||||
else if(panel_open && istype(I, /obj/item/crowbar))
|
||||
else if(panel_open && I.tool_behaviour == TOOL_CROWBAR)
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/smes/wirecutter_act(mob/living/user, obj/item/I)
|
||||
//disassembling the terminal
|
||||
. = ..()
|
||||
if(terminal && panel_open)
|
||||
terminal.dismantle(user, I)
|
||||
return TRUE
|
||||
@@ -193,12 +195,15 @@
|
||||
if(terminal)
|
||||
terminal.master = null
|
||||
terminal = null
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
|
||||
|
||||
/obj/machinery/power/smes/update_overlays()
|
||||
. = ..()
|
||||
if((stat & BROKEN) || panel_open)
|
||||
if(stat & BROKEN)
|
||||
return
|
||||
|
||||
if(panel_open)
|
||||
return
|
||||
|
||||
if(outputting)
|
||||
@@ -208,14 +213,14 @@
|
||||
|
||||
if(inputting)
|
||||
. += "smes-oc1"
|
||||
else
|
||||
if(input_attempt)
|
||||
. += "smes-oc0"
|
||||
else if(input_attempt)
|
||||
. += "smes-oc0"
|
||||
|
||||
var/clevel = chargedisplay()
|
||||
if(clevel>0)
|
||||
. += "smes-og[clevel]"
|
||||
|
||||
|
||||
/obj/machinery/power/smes/proc/chargedisplay()
|
||||
return clamp(round(5.5*charge/capacity),0,5)
|
||||
|
||||
@@ -228,6 +233,11 @@
|
||||
var/last_chrg = inputting
|
||||
var/last_onln = outputting
|
||||
|
||||
//check for self-recharging cells in stock parts and use them to self-charge
|
||||
for(var/obj/item/stock_parts/cell/C in component_parts)
|
||||
if(C.self_recharge)
|
||||
charge += min(capacity-charge, C.chargerate) // If capacity-charge is smaller than the attempted charge rate, this avoids overcharging
|
||||
|
||||
//inputting
|
||||
if(terminal && input_attempt)
|
||||
input_available = terminal.surplus()
|
||||
@@ -306,32 +316,29 @@
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
/obj/machinery/power/smes/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "smes", name, 340, 440, master_ui, state)
|
||||
ui = new(user, src, "Smes", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/power/smes/ui_data()
|
||||
var/list/data = list(
|
||||
"capacityPercent" = round(100*charge/capacity, 0.1),
|
||||
"capacity" = capacity,
|
||||
"capacityPercent" = round(100*charge/capacity, 0.1),
|
||||
"charge" = charge,
|
||||
|
||||
"inputAttempt" = input_attempt,
|
||||
"inputting" = inputting,
|
||||
"inputLevel" = input_level,
|
||||
"inputLevel_text" = DisplayPower(input_level),
|
||||
"inputLevelMax" = input_level_max,
|
||||
"inputAvailable" = DisplayPower(input_available),
|
||||
|
||||
"inputAvailable" = input_available,
|
||||
"outputAttempt" = output_attempt,
|
||||
"outputting" = outputting,
|
||||
"outputLevel" = output_level,
|
||||
"outputLevel_text" = DisplayPower(output_level),
|
||||
"outputLevelMax" = output_level_max,
|
||||
"outputUsed" = DisplayPower(output_used)
|
||||
"outputUsed" = output_used,
|
||||
)
|
||||
return data
|
||||
|
||||
@@ -352,11 +359,7 @@
|
||||
if("input")
|
||||
var/target = params["target"]
|
||||
var/adjust = text2num(params["adjust"])
|
||||
if(target == "input")
|
||||
target = input("New input target (0-[input_level_max]):", name, input_level) as num|null
|
||||
if(!isnull(target) && !..())
|
||||
. = TRUE
|
||||
else if(target == "min")
|
||||
if(target == "min")
|
||||
target = 0
|
||||
. = TRUE
|
||||
else if(target == "max")
|
||||
@@ -374,11 +377,7 @@
|
||||
if("output")
|
||||
var/target = params["target"]
|
||||
var/adjust = text2num(params["adjust"])
|
||||
if(target == "input")
|
||||
target = input("New output target (0-[output_level_max]):", name, output_level) as num|null
|
||||
if(!isnull(target) && !..())
|
||||
. = TRUE
|
||||
else if(target == "min")
|
||||
if(target == "min")
|
||||
target = 0
|
||||
. = TRUE
|
||||
else if(target == "max")
|
||||
|
||||
@@ -115,9 +115,6 @@
|
||||
panel.icon_state = "solar_panel-b"
|
||||
else
|
||||
panel.icon_state = "solar_panel"
|
||||
#if DM_VERSION <= 512
|
||||
. += new /mutable_appearance(panel)
|
||||
#endif
|
||||
|
||||
/obj/machinery/power/solar/proc/queue_turn(azimuth)
|
||||
needs_to_turn = TRUE
|
||||
@@ -346,11 +343,10 @@
|
||||
else
|
||||
. += mutable_appearance(icon, icon_screen)
|
||||
|
||||
/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
/obj/machinery/power/solar_control/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "solar_control", name, 380, 230, master_ui, state)
|
||||
ui = new(user, src, "SolarControl", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/power/solar_control/ui_data()
|
||||
@@ -481,8 +477,12 @@
|
||||
//
|
||||
|
||||
/obj/item/paper/guides/jobs/engi/solars
|
||||
name = "paper- 'Going green! Setup your own solar array instructions.'"
|
||||
info = "<h1>Welcome</h1><p>At greencorps we love the environment, and space. With this package you are able to help mother nature and produce energy without any usage of fossil fuel or plasma! Singularity energy is dangerous while solar energy is safe, which is why it's better. Now here is how you setup your own solar array.</p><p>You can make a solar panel by wrenching the solar assembly onto a cable node. Adding a glass panel, reinforced or regular glass will do, will finish the construction of your solar panel. It is that easy!</p><p>Now after setting up 19 more of these solar panels you will want to create a solar tracker to keep track of our mother nature's gift, the sun. These are the same steps as before except you insert the tracker equipment circuit into the assembly before performing the final step of adding the glass. You now have a tracker! Now the last step is to add a computer to calculate the sun's movements and to send commands to the solar panels to change direction with the sun. Setting up the solar computer is the same as setting up any computer, so you should have no trouble in doing that. You do need to put a wire node under the computer, and the wire needs to be connected to the tracker.</p><p>Congratulations, you should have a working solar array. If you are having trouble, here are some tips. Make sure all solar equipment are on a cable node, even the computer. You can always deconstruct your creations if you make a mistake.</p><p>That's all to it, be safe, be green!</p>"
|
||||
info = {"
|
||||
# Welcome!
|
||||
At greencorps we love the environment, and space. With this package you are able to help mother nature and produce energy without any usage of fossil fuel or plasma! Singularity energy is dangerous while solar energy is safe, which is why it's better. Now here is how you setup your own solar array.
|
||||
You can make a solar panel by wrenching the solar assembly onto a cable node. Adding a glass panel, reinforced or regular glass will do, will finish the construction of your solar panel. It is that easy!</p><p>Now after setting up 19 more of these solar panels you will want to create a solar tracker to keep track of our mother nature's gift, the sun. These are the same steps as before except you insert the tracker equipment circuit into the assembly before performing the final step of adding the glass. You now have a tracker! Now the last step is to add a computer to calculate the sun's movements and to send commands to the solar panels to change direction with the sun. Setting up the solar computer is the same as setting up any computer, so you should have no trouble in doing that. You do need to put a wire node under the computer, and the wire needs to be connected to the tracker.
|
||||
Congratulations, you should have a working solar array. If you are having trouble, here are some tips. Make sure all solar equipment are on a cable node, even the computer. You can always deconstruct your creations if you make a mistake.</p><p>That's all to it, be safe, be green!
|
||||
"}
|
||||
|
||||
#undef SOLAR_GEN_RATE
|
||||
#undef OCCLUSION_DISTANCE
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,6 +41,11 @@
|
||||
var/comp_id = 0
|
||||
var/efficiency
|
||||
|
||||
/obj/machinery/power/compressor/Destroy()
|
||||
if(turbine && turbine.compressor == src)
|
||||
turbine.compressor = null
|
||||
turbine = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/turbine
|
||||
name = "gas turbine generator"
|
||||
@@ -57,6 +62,12 @@
|
||||
var/lastgen
|
||||
var/productivity = 1
|
||||
|
||||
/obj/machinery/power/turbine/Destroy()
|
||||
if(compressor && compressor.turbine == src)
|
||||
compressor.turbine = null
|
||||
compressor = null
|
||||
return ..()
|
||||
|
||||
// the inlet stage of the gas turbine electricity generator
|
||||
|
||||
/obj/machinery/power/compressor/Initialize()
|
||||
@@ -66,12 +77,10 @@
|
||||
inturf = get_step(src, dir)
|
||||
locate_machinery()
|
||||
if(!turbine)
|
||||
stat |= BROKEN
|
||||
|
||||
obj_break()
|
||||
|
||||
#define COMPFRICTION 5e5
|
||||
|
||||
|
||||
/obj/machinery/power/compressor/locate_machinery()
|
||||
if(turbine)
|
||||
return
|
||||
@@ -103,7 +112,7 @@
|
||||
stat &= ~BROKEN
|
||||
else
|
||||
to_chat(user, "<span class='alert'>Turbine not connected.</span>")
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
@@ -129,9 +138,9 @@
|
||||
|
||||
// RPM function to include compression friction - be advised that too low/high of a compfriction value can make things screwy
|
||||
|
||||
rpm = min(rpm, (COMPFRICTION*efficiency)/2)
|
||||
rpm = max(0, rpm - (rpm*rpm)/(COMPFRICTION*efficiency))
|
||||
|
||||
|
||||
if(starter && !(stat & NOPOWER))
|
||||
use_power(2800)
|
||||
if(rpm<1000)
|
||||
@@ -140,8 +149,6 @@
|
||||
if(rpm<1000)
|
||||
rpmtarget = 0
|
||||
|
||||
|
||||
|
||||
if(rpm>50000)
|
||||
add_overlay(mutable_appearance(icon, "comp-o4", FLY_LAYER))
|
||||
else if(rpm>10000)
|
||||
@@ -164,7 +171,7 @@
|
||||
outturf = get_step(src, dir)
|
||||
locate_machinery()
|
||||
if(!compressor)
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
connect_to_network()
|
||||
|
||||
/obj/machinery/power/turbine/RefreshParts()
|
||||
@@ -205,7 +212,7 @@
|
||||
|
||||
// Weird function but it works. Should be something else...
|
||||
|
||||
var/newrpm = ((compressor.gas_contained.temperature) * compressor.gas_contained.total_moles())/4
|
||||
var/newrpm = ((compressor.gas_contained.return_temperature()) * compressor.gas_contained.total_moles())/4
|
||||
|
||||
newrpm = max(0, newrpm)
|
||||
|
||||
@@ -222,8 +229,6 @@
|
||||
if(lastgen > 100)
|
||||
add_overlay(mutable_appearance(icon, "turb-o", FLY_LAYER))
|
||||
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/power/turbine/attackby(obj/item/I, mob/user, params)
|
||||
if(default_deconstruction_screwdriver(user, initial(icon_state), initial(icon_state), I))
|
||||
return
|
||||
@@ -237,53 +242,41 @@
|
||||
stat &= ~BROKEN
|
||||
else
|
||||
to_chat(user, "<span class='alert'>Compressor not connected.</span>")
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
/obj/machinery/power/turbine/ui_interact(mob/user)
|
||||
/obj/machinery/power/turbine/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "TurbineComputer", name)
|
||||
ui.open()
|
||||
|
||||
if(!Adjacent(user) || (stat & (NOPOWER|BROKEN)) && !issilicon(user))
|
||||
user.unset_machine(src)
|
||||
user << browse(null, "window=turbine")
|
||||
return
|
||||
/obj/machinery/power/turbine/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["compressor"] = compressor ? TRUE : FALSE
|
||||
data["compressor_broke"] = (!compressor || (compressor.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["turbine"] = compressor?.turbine ? TRUE : FALSE
|
||||
data["turbine_broke"] = (!compressor || !compressor.turbine || (compressor.turbine.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["online"] = compressor?.starter
|
||||
data["power"] = DisplayPower(compressor?.turbine?.lastgen)
|
||||
data["rpm"] = compressor?.rpm
|
||||
data["temp"] = compressor?.gas_contained.return_temperature()
|
||||
return data
|
||||
|
||||
var/t = "<TT><B>Gas Turbine Generator</B><HR><PRE>"
|
||||
|
||||
t += "Generated power : [DisplayPower(lastgen)]<BR><BR>"
|
||||
|
||||
t += "Turbine: [round(compressor.rpm)] RPM<BR>"
|
||||
|
||||
t += "Starter: [ compressor.starter ? "<A href='?src=[REF(src)];str=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=[REF(src)];str=1'>On</A>"]"
|
||||
|
||||
t += "</PRE><HR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
|
||||
t += "</TT>"
|
||||
var/datum/browser/popup = new(user, "turbine", name)
|
||||
popup.set_content(t)
|
||||
popup.open()
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/power/turbine/Topic(href, href_list)
|
||||
/obj/machinery/power/turbine/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=turbine")
|
||||
usr.unset_machine(src)
|
||||
return
|
||||
|
||||
else if( href_list["str"] )
|
||||
if(compressor)
|
||||
compressor.starter = !compressor.starter
|
||||
|
||||
updateDialog()
|
||||
|
||||
|
||||
|
||||
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
if(compressor && compressor.turbine)
|
||||
compressor.starter = !compressor.starter
|
||||
. = TRUE
|
||||
if("reconnect")
|
||||
locate_machinery()
|
||||
. = TRUE
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -315,31 +308,29 @@
|
||||
else
|
||||
compressor = locate(/obj/machinery/power/compressor) in range(7, src)
|
||||
|
||||
/obj/machinery/computer/turbine_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
/obj/machinery/computer/turbine_computer/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "turbine_computer", name, 300, 200, master_ui, state)
|
||||
ui = new(user, src, "TurbineComputer", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/turbine_computer/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["compressor"] = compressor ? TRUE : FALSE
|
||||
data["compressor_broke"] = (!compressor || (compressor.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["turbine"] = compressor?.turbine ? TRUE : FALSE
|
||||
data["turbine_broke"] = (!compressor || !compressor.turbine || (compressor.turbine.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["online"] = compressor?.starter
|
||||
|
||||
data["power"] = DisplayPower(compressor?.turbine?.lastgen)
|
||||
data["rpm"] = compressor?.rpm
|
||||
data["temp"] = compressor?.gas_contained.temperature
|
||||
data["temp"] = compressor?.gas_contained.return_temperature()
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/turbine_computer/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
if(compressor && compressor.turbine)
|
||||
|
||||
Reference in New Issue
Block a user