Updates disposal bin pressurization

Also tweaks flasher power use.
This commit is contained in:
mwerezak
2014-08-07 19:31:17 -04:00
parent 319b9181e6
commit 47b32122d4
3 changed files with 434 additions and 435 deletions

View File

@@ -202,8 +202,6 @@ datum/pipeline
//surface must be the surface area in m^2
proc/radiate_heat_to_space(surface, thermal_conductivity)
var/total_heat_capacity = air.heat_capacity()
//if the h/e pipes radiate less than the AVERAGE_SOLAR_RADIATION, then they will heat up, otherwise they will cool down. It turns out the critical temperature is -26 C
var/heat_gain = surface*(AVERAGE_SOLAR_RADIATION - STEFAN_BOLTZMANN_CONSTANT*thermal_conductivity*(air.temperature - COSMIC_RADIATION_TEMPERATURE) ** 4)

View File

@@ -64,7 +64,7 @@
playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1)
flick("[base_state]_flash", src)
src.last_flash = world.time
use_power(1000)
use_power(1500)
for (var/mob/O in viewers(src, null))
if (get_dist(src, O) > src.range)

View File

@@ -5,7 +5,9 @@
// Automatically recharges air (unless off), will flush when ready if pre-set
// Can hold items and human size things, no other draggables
// Toilets are a type of disposal bin for small objects only and work on magic. By magic, I mean torque rotation
#define SEND_PRESSURE 0.05*ONE_ATMOSPHERE
#define SEND_PRESSURE 700 //kPa. 7 bar - Based on existing pneumatic conveyor pressures.
#define PRESSURE_TANK_VOLUME 70 //L - a 0.3 m diameter * 1 m long cylindrical tank. Happens to be the same volume as the regular oxygen tanks, so seems appropriate.
#define PUMP_MAX_FLOW_RATE 50 //L/s - 2 m/s using a 15 cm by 15 cm inlet
/obj/machinery/disposal
name = "disposal unit"
@@ -22,12 +24,12 @@
var/flush_every_ticks = 30 //Every 30 ticks it will look whether it is ready to flush
var/flush_count = 0 //this var adds 1 once per tick. When it reaches flush_every_ticks it resets and tries to flush.
var/last_sound = 0
active_power_usage = 600
active_power_usage = 1500 //the pneumatic pump power. 2 HP ~ 1500W
idle_power_usage = 100
// create a new disposal
// find the attached trunk (if present) and init gas resvr.
New()
/obj/machinery/disposal/New()
..()
spawn(5)
trunk = locate() in src.loc
@@ -38,12 +40,12 @@
trunk.linked = src // link the pipe trunk to self
air_contents = new/datum/gas_mixture()
//gas.volume = 1.05 * CELLSTANDARD
air_contents.volume = PRESSURE_TANK_VOLUME
update()
// attack by item places it in to disposal
attackby(var/obj/item/I, var/mob/user)
/obj/machinery/disposal/attackby(var/obj/item/I, var/mob/user)
if(stat & BROKEN || !I || !user)
return
@@ -137,7 +139,7 @@
// mouse drop another mob or self
//
MouseDrop_T(mob/target, mob/user)
/obj/machinery/disposal/MouseDrop_T(mob/target, mob/user)
if (!istype(target) || target.buckled || get_dist(user, src) > 1 || get_dist(user, target) > 1 || user.stat || istype(user, /mob/living/silicon/ai))
return
if(isanimal(user) && target != user) return //animals cannot put mobs other than themselves into disposal
@@ -181,18 +183,18 @@
return
// can breath normally in the disposal
alter_health()
/obj/machinery/disposal/alter_health()
return get_turf(src)
// attempt to move while inside
relaymove(mob/user as mob)
/obj/machinery/disposal/relaymove(mob/user as mob)
if(user.stat || src.flushing)
return
src.go_out(user)
return
// leave the disposal
proc/go_out(mob/user)
/obj/machinery/disposal/proc/go_out(mob/user)
if (user.client)
user.client.eye = user.client.mob
@@ -203,7 +205,7 @@
// monkeys can only pull the flush lever
attack_paw(mob/user as mob)
/obj/machinery/disposal/attack_paw(mob/user as mob)
if(stat & BROKEN)
return
@@ -212,11 +214,11 @@
return
// ai as human but can't flush
attack_ai(mob/user as mob)
/obj/machinery/disposal/attack_ai(mob/user as mob)
interact(user, 1)
// human interact with machine
attack_hand(mob/user as mob)
/obj/machinery/disposal/attack_hand(mob/user as mob)
if(user && user.loc == src)
usr << "\red You cannot reach the controls from inside."
return
@@ -228,7 +230,7 @@
interact(user, 0)
// user interaction
interact(mob/user, var/ai=0)
/obj/machinery/disposal/interact(mob/user, var/ai=0)
src.add_fingerprint(user)
if(stat & BROKEN)
@@ -263,7 +265,7 @@
// handle machine interaction
Topic(href, href_list)
/obj/machinery/disposal/Topic(href, href_list)
if(usr.loc == src)
usr << "\red You cannot reach the controls from inside."
return
@@ -306,14 +308,14 @@
return
// eject the contents of the disposal unit
proc/eject()
/obj/machinery/disposal/proc/eject()
for(var/atom/movable/AM in src)
AM.loc = src.loc
AM.pipe_eject(0)
update()
// update the icon & overlays to reflect mode & status
proc/update()
/obj/machinery/disposal/proc/update()
overlays.Cut()
if(stat & BROKEN)
icon_state = "disposal-broken"
@@ -341,12 +343,9 @@
// timed process
// charge the gas reservoir and perform flush if ready
process()
use_power = 0
if(stat & BROKEN) // nothing can happen if broken
return
if(!air_contents) // Potentially causes a runtime otherwise (if this is really shitty, blame pete //Donkie)
/obj/machinery/disposal/process()
if(!air_contents || (stat & BROKEN)) // nothing can happen if broken
update_use_power(0)
return
flush_count++
@@ -363,29 +362,12 @@
if(flush && air_contents.return_pressure() >= SEND_PRESSURE ) // flush can happen even without power
flush()
if(stat & NOPOWER) // won't charge if no power
return
use_power = 1
if(mode != 1) // if off or ready, no need to charge
update_use_power(1)
return
// otherwise charge
use_power = 2
var/atom/L = loc // recharging from loc turf
var/datum/gas_mixture/env = L.return_air()
var/pressure_delta = (SEND_PRESSURE*1.01) - air_contents.return_pressure()
if(env.temperature > 0)
var/transfer_moles = 0.1 * pressure_delta*air_contents.volume/(env.temperature * R_IDEAL_GAS_EQUATION)
//Actually transfer the gas
var/datum/gas_mixture/removed = env.remove(transfer_moles)
air_contents.merge(removed)
src.pressurize()
// if full enough, switch to ready mode
if(air_contents.return_pressure() >= SEND_PRESSURE)
@@ -393,8 +375,27 @@
update()
return
/obj/machinery/disposal/proc/pressurize()
if(stat & NOPOWER) // won't charge if no power
update_use_power(0)
return
var/atom/L = loc // recharging from loc turf
var/datum/gas_mixture/env = L.return_air()
var/power_draw = -1
if(env && env.temperature > 0)
var/transfer_moles = (PUMP_MAX_FLOW_RATE/env.volume)*env.total_moles //group_multiplier is divided out here
power_draw = pump_gas(src, env, air_contents, transfer_moles, active_power_usage)
if (power_draw < 0)
//update_use_power(0)
use_power = 1 //don't force update - easier on CPU
else
handle_power_draw(power_draw)
// perform a flush
proc/flush()
/obj/machinery/disposal/proc/flush()
flushing = 1
flick("[icon_state]-flush", src)
@@ -435,7 +436,7 @@
// called when area power changes
power_change()
/obj/machinery/disposal/power_change()
..() // do default setting/reset of stat NOPOWER bit
update() // update icon
return
@@ -443,7 +444,7 @@
// called when holder is expelled from a disposal
// should usually only occur if the pipe network is modified
proc/expel(var/obj/structure/disposalholder/H)
/obj/machinery/disposal/proc/expel(var/obj/structure/disposalholder/H)
var/turf/target
playsound(src, 'sound/machines/hiss.ogg', 50, 0, 0)
@@ -461,7 +462,7 @@
H.vent_gas(loc)
del(H)
CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
/obj/machinery/disposal/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if (istype(mover,/obj/item) && mover.throwing)
var/obj/item/I = mover
if(istype(I, /obj/item/projectile))