Some more tweaks and an unfinished feature.

-Fixes recycling stack materials resulting in double material output for some reason.
-Fixes and streamlines some sleeperbelly functions.
-Adds unfinished cargo delivery belly. Not implemented currently, still under testing, but was too far in to remove for the other small updates while waiting for the PR to get merged already in vain.
This commit is contained in:
Verkister
2018-06-03 15:42:29 +03:00
parent 7c892fa989
commit 0adf41ba3f
2 changed files with 126 additions and 100 deletions
@@ -18,6 +18,12 @@
var/compactor = FALSE
var/analyzer = FALSE
var/decompiler = FALSE
var/delivery = FALSE
var/delivery_tag = "Fuel"
var/list/deliverylists = list()
var/list/deliveryslot_1 = list()
var/list/deliveryslot_2 = list()
var/list/deliveryslot_3 = list()
var/datum/research/techonly/files //Analyzerbelly var.
var/synced = FALSE
var/startdrain = 500
@@ -49,48 +55,11 @@
return
if(target in hound.module.modules)
return
if(length(contents) > (max_item_count - 1))
if(length(contents) >= max_item_count)
to_chat(user, "<span class='warning'>Your [src.name] is full. Eject or process contents to continue.</span>")
return
if(analyzer == TRUE)
if(istype(target, /obj/item))
var/obj/target_obj = target
if(target_obj.w_class > ITEMSIZE_LARGE)
to_chat(user, "<span class='warning'>\The [target] is too large to fit into your [src.name]</span>")
return
user.visible_message("<span class='warning'>[hound.name] is ingesting [target.name] into their [src.name].</span>", "<span class='notice'>You start ingesting [target] into your [src.name]...</span>")
if(do_after(user, 30, target) && length(contents) < max_item_count)
target.forceMove(src)
user.visible_message("<span class='warning'>[hound.name]'s internal analyzer groans lightly as [target.name] slips inside.</span>", "<span class='notice'>Your internal analyzer groans lightly as [target] slips inside.</span>")
playsound(hound, gulpsound, vol = 60, vary = 1, falloff = 0.1, preference = /datum/client_preference/eating_noises)
if(istype(target,/obj/item))
var/obj/item/tech_item = target
for(var/T in tech_item.origin_tech)
to_chat(user, "<span class='notice'>\The [tech_item] has level [tech_item.origin_tech[T]] in [CallTechName(T)].</span>")
update_patient()
return
else if(ishuman(target))
var/mob/living/carbon/human/trashman = target
if(patient)
to_chat(user, "<span class='warning'>Your [src.name] is already occupied.</span>")
return
if(trashman.buckled)
to_chat(user, "<span class='warning'>[trashman] is buckled and can not be put into your [src.name].</span>")
return
user.visible_message("<span class='warning'>[hound.name] is ingesting [trashman] into their [src.name].</span>", "<span class='notice'>You start ingesting [trashman] into your [src.name]...</span>")
if(do_after(user, 30, trashman) && !patient && !trashman.buckled && length(contents) < max_item_count)
trashman.forceMove(src)
trashman.reset_view(src)
processing_objects |= src
user.visible_message("<span class='warning'>[hound.name]'s internal analyzer groans lightly as [trashman] slips inside.</span>", "<span class='notice'>Your internal analyzer groans lightly as [trashman] slips inside.</span>")
playsound(hound, gulpsound, vol = 100, vary = 1, falloff = 0.1, preference = /datum/client_preference/eating_noises)
update_patient()
return
return
if(compactor == TRUE)
if(compactor)
if(istype(target, /obj/item) || istype(target, /obj/effect/decal/remains))
var/obj/target_obj = target
if(target_obj.w_class > ITEMSIZE_LARGE)
@@ -99,8 +68,16 @@
user.visible_message("<span class='warning'>[hound.name] is ingesting [target.name] into their [src.name].</span>", "<span class='notice'>You start ingesting [target] into your [src.name]...</span>")
if(do_after(user, 30, target) && length(contents) < max_item_count)
target.forceMove(src)
user.visible_message("<span class='warning'>[hound.name]'s garbage processor groans lightly as [target.name] slips inside.</span>", "<span class='notice'>Your garbage compactor groans lightly as [target] slips inside.</span>")
user.visible_message("<span class='warning'>[hound.name]'s [src.name] groans lightly as [target.name] slips inside.</span>", "<span class='notice'>Your [src.name] groans lightly as [target] slips inside.</span>")
playsound(hound, gulpsound, vol = 60, vary = 1, falloff = 0.1, preference = /datum/client_preference/eating_noises)
if(analyzer && istype(target,/obj/item))
var/obj/item/tech_item = target
for(var/T in tech_item.origin_tech)
to_chat(user, "<span class='notice'>\The [tech_item] has level [tech_item.origin_tech[T]] in [CallTechName(T)].</span>")
if(delivery)
if(islist(deliverylists[delivery_tag]))
deliverylists[delivery_tag] |= target
to_chat(user, "<span class='notice'>\The [target.name] added to cargo compartment slot: [delivery_tag].</span>")
update_patient()
return
@@ -110,8 +87,12 @@
if(do_after(user, 30, trashmouse) && length(contents) < max_item_count)
trashmouse.forceMove(src)
trashmouse.reset_view(src)
user.visible_message("<span class='warning'>[hound.name]'s garbage processor groans lightly as [trashmouse] slips inside.</span>", "<span class='notice'>Your garbage compactor groans lightly as [trashmouse] slips inside.</span>")
user.visible_message("<span class='warning'>[hound.name]'s [src.name] groans lightly as [trashmouse] slips inside.</span>", "<span class='notice'>Your [src.name] groans lightly as [trashmouse] slips inside.</span>")
playsound(hound, gulpsound, vol = 60, vary = 1, falloff = 0.1, preference = /datum/client_preference/eating_noises)
if(delivery)
if(islist(deliverylists[delivery_tag]))
deliverylists[delivery_tag] |= trashmouse
to_chat(user, "<span class='notice'>\The [trashmouse] added to cargo compartment slot: [delivery_tag].</span>")
update_patient()
return
@@ -128,11 +109,18 @@
trashman.forceMove(src)
trashman.reset_view(src)
processing_objects |= src
user.visible_message("<span class='warning'>[hound.name]'s garbage processor groans lightly as [trashman] slips inside.</span>", "<span class='notice'>Your garbage compactor groans lightly as [trashman] slips inside.</span>")
user.visible_message("<span class='warning'>[hound.name]'s [src.name] groans lightly as [trashman] slips inside.</span>", "<span class='notice'>Your [src.name] groans lightly as [trashman] slips inside.</span>")
message_admins("[key_name(hound)] has eaten [key_name(patient)] as a dogborg. ([hound ? "<a href='?_src_=holder;adminplayerobservecoodjump=1;X=[hound.x];Y=[hound.y];Z=[hound.z]'>JMP</a>" : "null"])")
playsound(hound, gulpsound, vol = 100, vary = 1, falloff = 0.1, preference = /datum/client_preference/eating_noises)
if(delivery)
if(islist(deliverylists[delivery_tag]))
deliverylists[delivery_tag] |= trashman
to_chat(user, "<span class='notice'>\The [trashman] added to cargo compartment slot: [delivery_tag].</span>")
to_chat(trashman, "<span class='notice'>[hound.name] has added you to their cargo compartment slot: [delivery_tag].</span>")
update_patient()
return
return
else if(ishuman(target))
var/mob/living/carbon/human/H = target
if(H.buckled)
@@ -143,48 +131,38 @@
return
user.visible_message("<span class='warning'>[hound.name] is ingesting [H.name] into their [src.name].</span>", "<span class='notice'>You start ingesting [H] into your [src]...</span>")
if(!patient && !H.buckled && do_after (user, 50, H))
if(!proximity) return //If they moved away, you can't eat them.
if(patient) return //If you try to eat two people at once, you can only eat one.
if(!proximity)
return //If they moved away, you can't eat them.
if(patient)
return //If you try to eat two people at once, you can only eat one.
else //If you don't have someone in you, proceed.
H.forceMove(src)
H.reset_view(src)
update_patient()
processing_objects |= src
user.visible_message("<span class='warning'>[hound.name]'s medical pod lights up as [H.name] slips inside into their [src.name].</span>", "<span class='notice'>Your medical pod lights up as [H] slips into your [src]. Life support functions engaged.</span>")
user.visible_message("<span class='warning'>[hound.name]'s [src.name] lights up as [H.name] slips inside.</span>", "<span class='notice'>Your [src] lights up as [H] slips inside. Life support functions engaged.</span>")
message_admins("[key_name(hound)] has eaten [key_name(patient)] as a dogborg. ([hound ? "<a href='?_src_=holder;adminplayerobservecoodjump=1;X=[hound.x];Y=[hound.y];Z=[hound.z]'>JMP</a>" : "null"])")
playsound(hound, gulpsound, vol = 100, vary = 1, falloff = 0.1, preference = /datum/client_preference/eating_noises)
/obj/item/device/dogborg/sleeper/proc/go_out(var/target)
hound = src.loc
items_preserved.Cut()
cleaning = 0
for(var/list/dlist in deliverylists)
dlist.Cut()
if(length(contents) > 0)
hound.visible_message("<span class='warning'>[hound.name] empties out their contents via their [eject_port] port.</span>", "<span class='notice'>You empty your contents via your [eject_port] port.</span>")
if(target)
if(ishuman(target))
var/mob/living/carbon/human/person = target
for(var/C in contents)
if(ishuman(C))
var/mob/living/carbon/human/person = C
person.forceMove(get_turf(src))
person.reset_view()
else
var/obj/T = target
var/obj/T = C
T.loc = hound.loc
else
for(var/C in contents)
if(ishuman(C))
var/mob/living/carbon/human/person = C
person.forceMove(get_turf(src))
person.reset_view()
else
var/obj/T = C
T.loc = hound.loc
items_preserved.Cut()
cleaning = 0
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
update_patient()
else //You clicked eject with nothing in you, let's just reset stuff to be sure.
items_preserved.Cut()
cleaning = 0
update_patient()
/obj/item/device/dogborg/sleeper/proc/drain(var/amt = 3) //Slightly reduced cost (before, it was always injecting inaprov)
@@ -220,15 +198,33 @@
dat += "<A href='?src=\ref[src];clean=1'>Self-Clean</A>"
else
dat += "<span class='linkOff'>Self-Clean</span>"
if(delivery)
dat += "<BR><h3>Cargo Compartment</h3><BR>"
dat += "<A href='?src=\ref[src];deliveryslot=1'>Active Slot: [delivery_tag]</A>"
if(islist(deliverylists[delivery_tag]))
dat += "<A href='?src=\ref[src];slot_eject=1'>Eject Slot</A>"
dat += "<div class='statusDisplay'>"
if(compactor == TRUE && length(contents))//garbage counter for trashpup
var/obj/item/device/dogborg/sleeper/compactor/garbo = src
dat += "<font color='red'><B>Current load:</B> [length(contents)] / [garbo.max_item_count] objects.</font><BR>"
if(!delivery && compactor && length(contents))//garbage counter for trashpup
dat += "<font color='red'><B>Current load:</B> [length(contents)] / [max_item_count] objects.</font><BR>"
dat += "<font color='gray'>([list2text(contents,", ")])</font><BR><BR>"
if(analyzer == TRUE && synced == FALSE)
if(delivery && length(contents))
dat += "<font color='red'><B>Current load:</B> [length(contents)] / [max_item_count] objects.</font><BR>"
dat += "<font color='gray'>Cargo compartment slot: Cargo 1.</font><BR>"
if(length(deliveryslot_1))
dat += "<font color='gray'>([list2text(deliveryslot_1,", ")])</font><BR>"
dat += "<font color='gray'>Cargo compartment slot: Cargo 2.</font><BR>"
if(length(deliveryslot_2))
dat += "<font color='gray'>([list2text(deliveryslot_2,", ")])</font><BR>"
dat += "<font color='gray'>Cargo compartment slot: Cargo 3.</font><BR>"
if(length(deliveryslot_3))
dat += "<font color='gray'>([list2text(deliveryslot_3,", ")])</font><BR>"
dat += "<font color='red'>Cargo compartment slot: Fuel.</font><BR>"
dat += "<font color='red'>([list2text(contents - (deliveryslot_1 + deliveryslot_2 + deliveryslot_3),", ")])</font><BR><BR>"
if(analyzer && synced)
dat += "<A href='?src=\ref[src];sync=1'>Sync Files</A><BR>"
//Cleaning and there are still un-preserved items
@@ -328,7 +324,29 @@
eject_port = "ingestion"
sleeperUI(usr)
return
if(href_list["deliveryslot"])
var/tag = input("Select active delivery slot.") as null|anything in deliverylists
if(!tag)
return 0
delivery_tag = tag
sleeperUI(usr)
return
if(href_list["slot_eject"])
if(length(deliverylists[delivery_tag]) > 0)
hound.visible_message("<span class='warning'>[hound.name] empties out their cargo compartment via their [eject_port] port.</span>", "<span class='notice'>You empty your cargo compartment via your [eject_port] port.</span>")
for(var/C in deliverylists[delivery_tag])
if(ishuman(C))
var/mob/living/carbon/human/person = C
person.forceMove(get_turf(src))
person.reset_view()
else
var/obj/T = C
T.loc = hound.loc
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
update_patient()
deliverylists[delivery_tag].Cut()
sleeperUI(usr)
return
if(href_list["sync"])
synced = TRUE
var/success = 0
@@ -380,6 +398,13 @@
if(UI_open == TRUE)
sleeperUI(hound)
//Cleaning looks better with red on, even with nobody in it
if(cleaning || (length(contents) > 10) || (decompiler && (length(contents) > 5)) || (analyzer && (length(contents) > 1)))
hound.sleeper_r = TRUE
hound.sleeper_g = FALSE
hound.updateicon()
return
//Well, we HAD one, what happened to them?
if(patient in contents)
if(patient_laststat != patient.stat)
@@ -420,18 +445,8 @@
hound.updateicon()
return(C)
//Cleaning looks better with red on, even with nobody in it
if(cleaning || (length(contents) > 11))
hound.sleeper_r = TRUE
hound.sleeper_g = FALSE
//Letting analyzer gut swell if overloaded.
if(analyzer == TRUE && (length(contents) > 1))
hound.sleeper_r = TRUE
hound.sleeper_g = FALSE
//Couldn't find anyone, and not cleaning
else if(!cleaning && !patient && !length(contents))
if(!cleaning && !patient)
hound.sleeper_r = FALSE
hound.sleeper_g = FALSE
@@ -448,7 +463,7 @@
if(!(I in contents))
items_preserved -= I
var/list/touchable_items = contents - items_preserved
var/list/touchable_items = contents - items_preserved - (deliveryslot_1 + deliveryslot_2 + deliveryslot_3)
//Belly is entirely empty
if(!length(touchable_items))
@@ -493,7 +508,7 @@
for(var/mob/living/T in (touchable_items))
touchable_items -= T //Exclude mobs from loose item picking.
if((T.status_flags & GODMODE) || !T.digestable)
items_preserved += T
items_preserved |= T
else
var/old_brute = T.getBruteLoss()
var/old_burn = T.getFireLoss()
@@ -535,7 +550,7 @@
if(brain)
hound.remove_from_mob(brain,src)
brain.forceMove(src)
items_preserved += brain
items_preserved |= brain
else
T.drop_from_inventory(I, src)
if(ishuman(T))
@@ -568,12 +583,12 @@
drain(-50 * digested)
if(volume)
water.add_charge(volume)
if(!analyzer && compactor && T.matter)
if(!analyzer && !delivery && compactor && T.matter)
for(var/material in T.matter)
var/total_material = T.matter[material]
if(istype(T,/obj/item/stack))
var/obj/item/stack/stack = T
total_material *= stack.get_amount()
total_material *= (0.5 * stack.get_amount())
if(material == DEFAULT_WALL_MATERIAL)
metal.add_charge(total_material)
if(material == "glass")
@@ -641,4 +656,11 @@
desc = "A mounted matter decompiling unit with fuel processor."
icon_state = "decompiler"
max_item_count = 10
decompiler = TRUE
decompiler = TRUE
/obj/item/device/dogborg/sleeper/compactor/delivery //Unfinished and unimplemented, still testing.
name = "Cargo Belly"
desc = "A mounted cargo bay unit for tagged deliveries."
icon_state = "decompiler"
max_item_count = 20
delivery = TRUE
@@ -148,7 +148,7 @@
var/datum/matter_synth/water = new /datum/matter_synth()
water.name = "Water reserves"
water.recharge_rate = 0
water.max_energy = 1000
water.max_energy = 500
water.energy = 0
R.water_res = water
synths += water
@@ -159,6 +159,7 @@
var/obj/item/device/dogborg/sleeper/K9/B = new /obj/item/device/dogborg/sleeper/K9(src) //Eat criminals. Bring them to the brig.
B.water = water
src.modules += B
R.icon = 'icons/mob/widerobot_vr.dmi'
R.hands.icon = 'icons/mob/screen1_robot_vr.dmi'
@@ -216,7 +217,7 @@
var/datum/matter_synth/water = new /datum/matter_synth()
water.name = "Water reserves"
water.recharge_rate = 0
water.max_energy = 1000
water.max_energy = 500
water.energy = 0
R.water_res = water
synths += water
@@ -227,6 +228,7 @@
var/obj/item/device/dogborg/sleeper/B = new /obj/item/device/dogborg/sleeper(src) //So they can nom people and heal them
B.water = water
src.modules += B
R.icon = 'icons/mob/widerobot_vr.dmi'
R.hands.icon = 'icons/mob/screen1_robot_vr.dmi'
@@ -260,7 +262,7 @@
var/datum/matter_synth/water = new /datum/matter_synth()
water.name = "Water reserves"
water.recharge_rate = 0
water.max_energy = 1000
water.max_energy = 500
water.energy = 0
R.water_res = water
synths += water
@@ -271,6 +273,7 @@
var/obj/item/device/dogborg/sleeper/K9/B = new /obj/item/device/dogborg/sleeper/K9(src)
B.water = water
src.modules += B
R.icon = 'icons/mob/64x64robot_vr.dmi'
R.hands.icon = 'icons/mob/screen1_robot_vr.dmi'
@@ -301,17 +304,17 @@
var/datum/matter_synth/metal = new /datum/matter_synth/metal()
metal.name = "Steel reserves"
metal.recharge_rate = 0
metal.max_energy = 100000
metal.max_energy = 50000
metal.energy = 0
var/datum/matter_synth/glass = new /datum/matter_synth/glass()
glass.name = "Glass reserves"
glass.recharge_rate = 0
glass.max_energy = 100000
glass.max_energy = 50000
glass.energy = 0
var/datum/matter_synth/water = new /datum/matter_synth()
water.name = "Water reserves"
water.recharge_rate = 0
water.max_energy = 1000
water.max_energy = 500
water.energy = 0
R.water_res = water
@@ -383,7 +386,7 @@
var/datum/matter_synth/water = new /datum/matter_synth()
water.name = "Water reserves"
water.recharge_rate = 0
water.max_energy = 1000
water.max_energy = 500
water.energy = 0
R.water_res = water
synths += water
@@ -394,6 +397,7 @@
var/obj/item/device/dogborg/sleeper/compactor/analyzer/B = new /obj/item/device/dogborg/sleeper/compactor/analyzer(src)
B.water = water
src.modules += B
R.icon = 'icons/mob/widerobot_vr.dmi'
R.hands.icon = 'icons/mob/screen1_robot_vr.dmi'
@@ -426,7 +430,7 @@
src.modules += new /obj/item/device/t_scanner(src)
src.modules += new /obj/item/taperoll/engineering(src)
src.modules += new /obj/item/weapon/inflatable_dispenser/robot(src)
src.modules += new /obj/item/device/geiger(src)
src.modules += new /obj/item/weapon/pickaxe(src)
src.modules += new /obj/item/weapon/dogborg/jaws/small(src)
src.modules += new /obj/item/device/dogborg/boop_module(src)
src.emag = new /obj/item/weapon/dogborg/pounce(src)
@@ -435,27 +439,27 @@
var/datum/matter_synth/metal = new /datum/matter_synth/metal()
metal.name = "Steel reserves"
metal.recharge_rate = 50
metal.max_energy = 100000
metal.max_energy = 50000
metal.energy = 5000
var/datum/matter_synth/glass = new /datum/matter_synth/glass()
glass.name = "Glass reserves"
glass.recharge_rate = 50
glass.max_energy = 100000
glass.max_energy = 50000
glass.energy = 5000
var/datum/matter_synth/wood = new /datum/matter_synth/wood()
wood.name = "Wood reserves"
wood.recharge_rate = 50
wood.max_energy = 100000
wood.max_energy = 50000
wood.energy = 5000
var/datum/matter_synth/plastic = new /datum/matter_synth/plastic()
plastic.name = "Plastic reserves"
plastic.recharge_rate = 50
plastic.max_energy = 100000
plastic.max_energy = 50000
plastic.energy = 5000
var/datum/matter_synth/water = new /datum/matter_synth()
water.name = "Water reserves"
water.recharge_rate = 0
water.max_energy = 1000
water.max_energy = 500
water.energy = 0
R.water_res = water