From 1f2d9ca2efd1e6dda791ba37d28e2354c59b8431 Mon Sep 17 00:00:00 2001
From: Letter N <24603524+LetterN@users.noreply.github.com>
Date: Wed, 12 Aug 2020 19:35:24 +0800
Subject: [PATCH] jar moment
---
code/game/objects/items/pet_carrier.dm | 69 +++++++++++++++++++++++---
1 file changed, 61 insertions(+), 8 deletions(-)
diff --git a/code/game/objects/items/pet_carrier.dm b/code/game/objects/items/pet_carrier.dm
index c6b5a7e224..ff2979dd8b 100644
--- a/code/game/objects/items/pet_carrier.dm
+++ b/code/game/objects/items/pet_carrier.dm
@@ -240,7 +240,29 @@
custom_materials = list(/datum/material/glass = 1000, /datum/material/bluespace = 600)
escape_time = 200 //equal to the time of a bluespace bodybag
alternate_escape_time = 100
+
+ ///gas supply for simplemobs so they don't die
var/datum/gas_mixture/occupant_gas_supply
+ ///level until the reagent gets INGEST ed instead of TOUCH
+ var/sipping_level = 150
+
+/obj/item/pet_carrier/bluespace/Initialize()
+ . = ..()
+ create_reagents(300, NONE, DEFAULT_REAGENTS_VALUE) //equivalent of bsbeakers
+
+/obj/item/pet_carrier/bluespace/Destroy()
+ STOP_PROCESSING(SSobj, src)
+ return ..()
+
+// /obj/item/pet_carrier/bluespace/examine(mob/user)
+// . = ..()
+
+/obj/item/pet_carrier/bluespace/attack_self(mob/living/user)
+ ..()
+ if(open)
+ reagents.reagents_holder_flags = OPENCONTAINER
+ else
+ reagents.reagents_holder_flags = NONE
/obj/item/pet_carrier/bluespace/update_icon_state()
if(open)
@@ -248,11 +270,28 @@
else
icon_state = "bluespace_jar"
-/obj/item/pet_carrier/bluespace/throw_impact()
+/obj/item/pet_carrier/bluespace/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
. = ..()
//delete the item upon impact, releasing the creature inside (this is handled by its deletion)
if(occupants.len)
loc.visible_message("The bluespace jar smashes, releasing [occupants[1]]!")
+
+ if(reagents?.total_volume && ismob(hit_atom) && hit_atom.reagents)
+ reagents.total_volume *= rand(5,10) * 0.1 //Not all of it makes contact with the target
+ var/mob/M = hit_atom
+ var/R = reagents.log_list()
+ hit_atom.visible_message("[M] has been splashed with something!", \
+ "[M] has been splashed with something!")
+ var/turf/TT = get_turf(hit_atom)
+ var/throwerstring
+ if(thrownby)
+ log_combat(thrownby, M, "splashed", R)
+ var/turf/AT = get_turf(thrownby)
+ throwerstring = " THROWN BY [key_name(thrownby)] at [AT] (AREACOORD(AT)]"
+ log_reagent("SPLASH: [src] mob throw_impact() onto [key_name(hit_atom)] at [TT] ([AREACOORD(TT)])[throwerstring] - [R]")
+ reagents.reaction(hit_atom, TOUCH)
+ reagents.clear_reagents()
+
playsound(src, "shatter", 70, 1)
qdel(src)
@@ -260,21 +299,24 @@
. = ..()
if(!occupant_gas_supply)
occupant_gas_supply = new
+
if(isanimal(occupant))
var/mob/living/simple_animal/animal = occupant
occupant_gas_supply[/datum/gas/oxygen] = 0.0064 //make sure it has some gas in so it isn't depressurized
occupant_gas_supply.set_temperature(animal.minbodytemp) //simple animals only care about temperature/pressure when their turf isnt a location
- else
- if(ishuman(occupant)) //humans require resistance to cold/heat and living in no air while inside, and lose this when outside
- ADD_TRAIT(occupant, TRAIT_RESISTCOLD, "bluespace_container_cold_resist")
- ADD_TRAIT(occupant, TRAIT_RESISTHEAT, "bluespace_container_heat_resist")
- ADD_TRAIT(occupant, TRAIT_NOBREATH, "bluespace_container_no_breath")
- ADD_TRAIT(occupant, TRAIT_RESISTHIGHPRESSURE, "bluespace_container_resist_high_pressure")
- ADD_TRAIT(occupant, TRAIT_RESISTLOWPRESSURE, "bluespace_container_resist_low_pressure")
+
+ if(ishuman(occupant)) //humans require resistance to cold/heat and living in no air while inside, and lose this when outside
+ START_PROCESSING(SSobj, src)
+ ADD_TRAIT(occupant, TRAIT_RESISTCOLD, "bluespace_container_cold_resist")
+ ADD_TRAIT(occupant, TRAIT_RESISTHEAT, "bluespace_container_heat_resist")
+ ADD_TRAIT(occupant, TRAIT_NOBREATH, "bluespace_container_no_breath")
+ ADD_TRAIT(occupant, TRAIT_RESISTHIGHPRESSURE, "bluespace_container_resist_high_pressure")
+ ADD_TRAIT(occupant, TRAIT_RESISTLOWPRESSURE, "bluespace_container_resist_low_pressure")
/obj/item/pet_carrier/bluespace/remove_occupant(mob/living/occupant)
. = ..()
if(ishuman(occupant))
+ STOP_PROCESSING(SSobj, src)
REMOVE_TRAIT(occupant, TRAIT_RESISTCOLD, "bluespace_container_cold_resist")
REMOVE_TRAIT(occupant, TRAIT_RESISTHEAT, "bluespace_container_heat_resist")
REMOVE_TRAIT(occupant, TRAIT_NOBREATH, "bluespace_container_no_breath")
@@ -287,6 +329,17 @@
occupant_gas_supply = new
return occupant_gas_supply
+/obj/item/pet_carrier/bluespace/process()
+ if(!reagents)
+ return
+ for(var/mob/living/L in occupants)
+ if(!ishuman(L))
+ continue
+ if(reagents.total_volume >= sipping_level && prob(80))
+ reagents.reaction(L, INGEST) //consume
+ else
+ reagents.reaction(L, TOUCH, show_message = FALSE)
+
/obj/item/pet_carrier/bluespace/load_occupant(mob/living/user, mob/living/target)
if(..())
name = "[initial(name)] ([target])"