From 2903560dc1f8fa1221d91415cf95ad5f3bf3bf42 Mon Sep 17 00:00:00 2001
From: Migratingcocofruit
<69551563+Migratingcocofruit@users.noreply.github.com>
Date: Fri, 24 May 2024 21:30:45 +0300
Subject: [PATCH] Pipe fix/tweak (#25431)
* Pipe fixes and tweaks.
Allows refilling of pipes using dried plants, removes their ability to conjure nicotine, and applies the May 22, 2015 pipe tweak to cob pipes, and make them start empty(corn has no nicotine).
* refilling pipes now sets smoketime
* oops
* Adding spaces to comments
---
code/game/objects/items/weapons/cigs.dm | 31 ++++++++++++++++++-------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/code/game/objects/items/weapons/cigs.dm b/code/game/objects/items/weapons/cigs.dm
index efd1ea57792..718851cda55 100644
--- a/code/game/objects/items/weapons/cigs.dm
+++ b/code/game/objects/items/weapons/cigs.dm
@@ -1,3 +1,5 @@
+#define REAGENT_TIME_RATIO 2.5
+
/*
CONTAINS:
CIGARETTES
@@ -502,7 +504,7 @@ LIGHTERS ARE IN LIGHTERS.DM
return
smoke()
-/obj/item/clothing/mask/cigarette/pipe/attack_self(mob/user) //Refills the pipe. Can be changed to an attackby later, if loose tobacco is added to vendors or something.
+/obj/item/clothing/mask/cigarette/pipe/attack_self(mob/user) // Extinguishes the pipe.
if(lit)
user.visible_message("[user] puts out [src].")
lit = FALSE
@@ -510,17 +512,27 @@ LIGHTERS ARE IN LIGHTERS.DM
item_state = icon_off
STOP_PROCESSING(SSobj, src)
return
- if(smoketime <= 0)
- to_chat(user, "You refill the pipe with tobacco.")
- reagents.add_reagent("nicotine", chem_volume)
- smoketime = initial(smoketime)
- first_puff = TRUE
/obj/item/clothing/mask/cigarette/pipe/try_light(obj/item/cigar, obj/item/lighting_item)
if(can_light_fancy(lighting_item))
return ..()
+// Refill or light the pipe
/obj/item/clothing/mask/cigarette/pipe/attackby(obj/item/I, mob/user, params)
+ if(istype(I, /obj/item/food/snacks/grown))
+ var/obj/item/food/snacks/grown/O = I
+ if(O.dry)
+ if(reagents.total_volume == reagents.maximum_volume)
+ to_chat(user, "[src] is full!")
+ return
+ O.reagents.trans_to(src, chem_volume)
+ to_chat(user, "You stuff the [O.name] into the pipe.")
+ smoketime = max(reagents.total_volume * REAGENT_TIME_RATIO, smoketime)
+ qdel(O)
+ else
+ to_chat(user, "You need to dry this first!")
+ return
+
if(!is_type_in_typecache(I, things_that_light))
return
if(can_light_fancy(I))
@@ -535,8 +547,9 @@ LIGHTERS ARE IN LIGHTERS.DM
item_state = "cobpipeoff"
icon_on = "cobpipeon" //Note - these are in masks.dmi
icon_off = "cobpipeoff"
- smoketime = 800
- chem_volume = 40
+ smoketime = 0 //there is nothing to smoke initially
+ chem_volume = 160
+ list_reagents = list()
///////////
//ROLLING//
@@ -569,3 +582,5 @@ LIGHTERS ARE IN LIGHTERS.DM
to_chat(user, "You need to dry this first!")
else
..()
+
+#undef REAGENT_TIME_RATIO