mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Revisiting my first commits.
Updated ashtray to actually accept cig butts and crush lit cigs properly. Applied random transform to cig butts, and made fingerprints from original cig carry over.
This commit is contained in:
@@ -17,26 +17,25 @@
|
||||
/obj/item/ashtray/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if (health < 1)
|
||||
return
|
||||
if (istype(W,/obj/item/clothing/mask/cigarette) || istype(W, /obj/item/weapon/match))
|
||||
if(user)
|
||||
if (istype(W,/obj/item/weapon/cigbutt) || istype(W,/obj/item/clothing/mask/cigarette) || istype(W, /obj/item/weapon/match))
|
||||
if (contents.len >= max_butts)
|
||||
user << "This ashtray is full."
|
||||
return
|
||||
user.u_equip(W)
|
||||
W.loc = src
|
||||
if ((user.client && user.s_active != src))
|
||||
user.client.screen -= W
|
||||
|
||||
if (istype(W,/obj/item/clothing/mask/cigarette))
|
||||
var/obj/item/clothing/mask/cigarette/cig = W
|
||||
if (cig.lit == 1)
|
||||
src.visible_message("[user] crushes [cig] in [src], putting it out.")
|
||||
cig.smoketime = 0
|
||||
processing_objects.Remove(cig)
|
||||
var/obj/item/butt = new cig.type_butt(src)
|
||||
cig.transfer_fingerprints_to(butt)
|
||||
del(cig)
|
||||
else if (cig.lit == 0)
|
||||
if(istype(cig, /obj/item/weapon/match))
|
||||
user << "You place [cig] in [src] without even lighting it. Why would you do that?"
|
||||
else
|
||||
user << "You place [cig] in [src] without even smoking it. Why would you do that?"
|
||||
else if (cig.lit == -1)
|
||||
src.visible_message("[user] places [cig] in [src].")
|
||||
|
||||
src.visible_message("[user] places [W] in [src].")
|
||||
user.update_inv_l_hand()
|
||||
user.update_inv_r_hand()
|
||||
add_fingerprint(user)
|
||||
@@ -62,7 +61,6 @@
|
||||
if (contents.len)
|
||||
src.visible_message("\red [src] slams into [hit_atom] spilling its contents!")
|
||||
for (var/obj/item/clothing/mask/cigarette/O in contents)
|
||||
contents -= O
|
||||
O.loc = src.loc
|
||||
icon_state = icon_empty
|
||||
return ..()
|
||||
@@ -70,7 +68,6 @@
|
||||
/obj/item/ashtray/proc/die()
|
||||
src.visible_message("\red [src] shatters spilling its contents!")
|
||||
for (var/obj/item/clothing/mask/cigarette/O in contents)
|
||||
contents -= O
|
||||
O.loc = src.loc
|
||||
icon_state = icon_broken
|
||||
|
||||
|
||||
@@ -157,14 +157,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
||||
var/turf/location = get_turf(src)
|
||||
smoketime--
|
||||
if(smoketime < 1)
|
||||
new type_butt(location)
|
||||
processing_objects.Remove(src)
|
||||
if(ismob(loc))
|
||||
var/mob/living/M = loc
|
||||
M << "<span class='notice'>Your [name] goes out.</span>"
|
||||
M.u_equip(src) //un-equip it so the overlays can update
|
||||
M.update_inv_wear_mask(0)
|
||||
del(src)
|
||||
die()
|
||||
return
|
||||
if(location)
|
||||
location.hotspot_expose(700, 5)
|
||||
@@ -182,13 +175,21 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
||||
/obj/item/clothing/mask/cigarette/attack_self(mob/user as mob)
|
||||
if(lit == 1)
|
||||
user.visible_message("<span class='notice'>[user] calmly drops and treads on the lit [src], putting it out instantly.</span>")
|
||||
var/turf/T = get_turf(src)
|
||||
new type_butt(T)
|
||||
processing_objects.Remove(src)
|
||||
del(src)
|
||||
die()
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/clothing/mask/cigarette/proc/die()
|
||||
var/turf/T = get_turf(src)
|
||||
var/obj/item/butt = new type_butt(T)
|
||||
transfer_fingerprints_to(butt)
|
||||
if(ismob(loc))
|
||||
var/mob/living/M = loc
|
||||
M << "<span class='notice'>Your [name] goes out.</span>"
|
||||
M.u_equip(src) //un-equip it so the overlays can update
|
||||
M.update_inv_wear_mask(0)
|
||||
processing_objects.Remove(src)
|
||||
del(src)
|
||||
|
||||
////////////
|
||||
// CIGARS //
|
||||
@@ -229,6 +230,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
||||
w_class = 1
|
||||
throwforce = 1
|
||||
|
||||
/obj/item/weapon/cigbutt/New()
|
||||
..()
|
||||
pixel_x = rand(-10,10)
|
||||
pixel_y = rand(-10,10)
|
||||
transform = turn(transform,rand(0,360))
|
||||
|
||||
/obj/item/weapon/cigbutt/cigarbutt
|
||||
name = "cigar butt"
|
||||
desc = "A manky old cigar butt."
|
||||
|
||||
Reference in New Issue
Block a user