From 285ce84044a0ac89000d140b1359c545fb6e45c8 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Tue, 23 Jun 2015 23:14:20 -0400 Subject: [PATCH 1/4] Fixes disposals not transferring gas to holder, creating air_contents with the wrong volume, runtime due to terrible management of shared gas_mix Fixes one of the runtimes in #9310 --- code/ZAS/_gas_mixture_xgm.dm | 2 ++ code/modules/recycling/disposal.dm | 12 +++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/ZAS/_gas_mixture_xgm.dm b/code/ZAS/_gas_mixture_xgm.dm index 8043be1579..1cdc1f1061 100644 --- a/code/ZAS/_gas_mixture_xgm.dm +++ b/code/ZAS/_gas_mixture_xgm.dm @@ -17,6 +17,8 @@ //List of active tile overlays for this gas_mixture. Updated by check_tile_graphic() var/list/graphic = list() +/datum/gas_mixture/New(vol = CELL_VOLUME) + volume = vol //Takes a gas string and the amount of moles to adjust by. Calls update_values() if update isn't 0. /datum/gas_mixture/proc/adjust_gas(gasid, moles, update = 1) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 525a79d9d1..581e59d1d5 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -39,8 +39,7 @@ else trunk.linked = src // link the pipe trunk to self - air_contents = new/datum/gas_mixture() - air_contents.volume = PRESSURE_TANK_VOLUME + air_contents = new/datum/gas_mixture(PRESSURE_TANK_VOLUME) update() /obj/machinery/disposal/Destroy() @@ -411,8 +410,6 @@ H.tomail = 1 - air_contents = new() // new empty gas resv. - sleep(10) if(last_sound < world.time + 1) playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0) @@ -420,7 +417,8 @@ sleep(5) // wait for animation to finish - H.init(src) // copy the contents of disposer to holder + H.init(src, air_contents) // copy the contents of disposer to holder + air_contents = new(PRESSURE_TANK_VOLUME) // new empty gas resv. H.start(src) // start the holder processing movement flushing = 0 @@ -495,8 +493,8 @@ // initialize a holder from the contents of a disposal unit - proc/init(var/obj/machinery/disposal/D) - gas = D.air_contents// transfer gas resv. into holder object + proc/init(var/obj/machinery/disposal/D, var/datum/gas_mixture/flush_gas) + gas = flush_gas// transfer gas resv. into holder object -- let's be explicit about the data this proc consumes, please. //Check for any living mobs trigger hasmob. //hasmob effects whether the package goes to cargo or its tagged destination. From a147a4e15e7c5f89b2c1db0326129c2203925c56 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Tue, 23 Jun 2015 23:21:00 -0400 Subject: [PATCH 2/4] Removes fat mutation checks --- code/modules/recycling/disposal.dm | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 581e59d1d5..bff9830a71 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -484,7 +484,6 @@ var/active = 0 // true if the holder is moving, otherwise inactive dir = 0 var/count = 2048 //*** can travel 2048 steps before going inactive (in case of loops) - var/has_fat_guy = 0 // true if contains a fat person var/destinationTag = "" // changes if contains a delivery container var/tomail = 0 //changes if contains wrapped package var/hasmob = 0 //If it contains a mob @@ -514,10 +513,6 @@ // note AM since can contain mobs or objs for(var/atom/movable/AM in D) AM.loc = src - if(istype(AM, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = AM - if(FAT in H.mutations) // is a human and fat? - has_fat_guy = 1 // set flag on holder if(istype(AM, /obj/structure/bigDelivery) && !hasmob) var/obj/structure/bigDelivery/T = AM src.destinationTag = T.sortTag @@ -554,13 +549,8 @@ if(!istype(H,/mob/living/silicon/robot/drone)) //Drones use the mailing code to move through the disposal system, H.take_overall_damage(20, 0, "Blunt Trauma")//horribly maim any living creature jumping down disposals. c'est la vie - if(has_fat_guy && prob(2)) // chance of becoming stuck per segment if contains a fat guy - active = 0 - // find the fat guys - for(var/mob/living/carbon/human/H in src) - - break sleep(1) // was 1 + var/obj/structure/disposalpipe/curr = loc last = curr curr = curr.transfer(src) @@ -601,8 +591,6 @@ if(M.client) // if a client mob, update eye to follow this holder M.client.eye = src - if(other.has_fat_guy) - has_fat_guy = 1 qdel(other) From cb0b3a30da1f8367862cb86179a0c502da8b45f4 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Tue, 23 Jun 2015 23:26:46 -0400 Subject: [PATCH 3/4] Fixes runtime Fixes the other runtime in #9310 --- code/modules/recycling/disposal.dm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index bff9830a71..fb71de8d95 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -544,16 +544,20 @@ proc/move() var/obj/structure/disposalpipe/last while(active) + sleep(1) // was 1 + if(!loc) return // check if we got GC'd + if(hasmob && prob(3)) for(var/mob/living/H in src) if(!istype(H,/mob/living/silicon/robot/drone)) //Drones use the mailing code to move through the disposal system, H.take_overall_damage(20, 0, "Blunt Trauma")//horribly maim any living creature jumping down disposals. c'est la vie - sleep(1) // was 1 - var/obj/structure/disposalpipe/curr = loc last = curr curr = curr.transfer(src) + + if(!loc) return //side effects + if(!curr) last.expel(src, loc, dir) From 51eecd54f0d9cf01dfc0550b27a4febc62f04e50 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 24 Jun 2015 00:18:21 -0400 Subject: [PATCH 4/4] Fixes disposal bins filling instantly Fixes disposal bins filling instantly, side effect of fixing air_contents having the wrong volume --- code/modules/recycling/disposal.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index fb71de8d95..fd1e53ae0a 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -5,9 +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 50 + ONE_ATMOSPHERE //kPa - assume the inside of a dispoal pipe is 1 atm -#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 100 //L/s - 4 m/s using a 15 cm by 15 cm inlet +#define SEND_PRESSURE (700 + ONE_ATMOSPHERE) //kPa - assume the inside of a dispoal pipe is 1 atm, so that needs to be added. +#define PRESSURE_TANK_VOLUME 150 //L +#define PUMP_MAX_FLOW_RATE 90 //L/s - 4 m/s using a 15 cm by 15 cm inlet /obj/machinery/disposal name = "disposal unit" @@ -24,7 +24,7 @@ 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 = 3500 //the pneumatic pump power. 3 HP ~ 2200W + active_power_usage = 2200 //the pneumatic pump power. 3 HP ~ 2200W idle_power_usage = 100 // create a new disposal