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,35 +17,34 @@
|
|||||||
/obj/item/ashtray/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
/obj/item/ashtray/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||||
if (health < 1)
|
if (health < 1)
|
||||||
return
|
return
|
||||||
if (istype(W,/obj/item/clothing/mask/cigarette) || istype(W, /obj/item/weapon/match))
|
if (istype(W,/obj/item/weapon/cigbutt) || istype(W,/obj/item/clothing/mask/cigarette) || istype(W, /obj/item/weapon/match))
|
||||||
if(user)
|
if (contents.len >= max_butts)
|
||||||
if (contents.len >= max_butts)
|
user << "This ashtray is full."
|
||||||
user << "This ashtray is full."
|
return
|
||||||
return
|
user.u_equip(W)
|
||||||
user.u_equip(W)
|
W.loc = src
|
||||||
W.loc = src
|
|
||||||
if ((user.client && user.s_active != src))
|
if (istype(W,/obj/item/clothing/mask/cigarette))
|
||||||
user.client.screen -= W
|
|
||||||
var/obj/item/clothing/mask/cigarette/cig = W
|
var/obj/item/clothing/mask/cigarette/cig = W
|
||||||
if (cig.lit == 1)
|
if (cig.lit == 1)
|
||||||
src.visible_message("[user] crushes [cig] in [src], putting it out.")
|
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)
|
else if (cig.lit == 0)
|
||||||
if(istype(cig, /obj/item/weapon/match))
|
user << "You place [cig] in [src] without even smoking it. Why would you do that?"
|
||||||
user << "You place [cig] in [src] without even lighting it. Why would you do that?"
|
|
||||||
else
|
src.visible_message("[user] places [W] in [src].")
|
||||||
user << "You place [cig] in [src] without even smoking it. Why would you do that?"
|
user.update_inv_l_hand()
|
||||||
else if (cig.lit == -1)
|
user.update_inv_r_hand()
|
||||||
src.visible_message("[user] places [cig] in [src].")
|
add_fingerprint(user)
|
||||||
user.update_inv_l_hand()
|
if (contents.len == max_butts)
|
||||||
user.update_inv_r_hand()
|
icon_state = icon_full
|
||||||
add_fingerprint(user)
|
desc = empty_desc + " It's stuffed full."
|
||||||
if (contents.len == max_butts)
|
else if (contents.len > max_butts/2)
|
||||||
icon_state = icon_full
|
icon_state = icon_half
|
||||||
desc = empty_desc + " It's stuffed full."
|
desc = empty_desc + " It's half-filled."
|
||||||
else if (contents.len > max_butts/2)
|
|
||||||
icon_state = icon_half
|
|
||||||
desc = empty_desc + " It's half-filled."
|
|
||||||
else
|
else
|
||||||
health = max(0,health - W.force)
|
health = max(0,health - W.force)
|
||||||
user << "You hit [src] with [W]."
|
user << "You hit [src] with [W]."
|
||||||
@@ -62,7 +61,6 @@
|
|||||||
if (contents.len)
|
if (contents.len)
|
||||||
src.visible_message("\red [src] slams into [hit_atom] spilling its contents!")
|
src.visible_message("\red [src] slams into [hit_atom] spilling its contents!")
|
||||||
for (var/obj/item/clothing/mask/cigarette/O in contents)
|
for (var/obj/item/clothing/mask/cigarette/O in contents)
|
||||||
contents -= O
|
|
||||||
O.loc = src.loc
|
O.loc = src.loc
|
||||||
icon_state = icon_empty
|
icon_state = icon_empty
|
||||||
return ..()
|
return ..()
|
||||||
@@ -70,7 +68,6 @@
|
|||||||
/obj/item/ashtray/proc/die()
|
/obj/item/ashtray/proc/die()
|
||||||
src.visible_message("\red [src] shatters spilling its contents!")
|
src.visible_message("\red [src] shatters spilling its contents!")
|
||||||
for (var/obj/item/clothing/mask/cigarette/O in contents)
|
for (var/obj/item/clothing/mask/cigarette/O in contents)
|
||||||
contents -= O
|
|
||||||
O.loc = src.loc
|
O.loc = src.loc
|
||||||
icon_state = icon_broken
|
icon_state = icon_broken
|
||||||
|
|
||||||
|
|||||||
@@ -157,14 +157,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
|||||||
var/turf/location = get_turf(src)
|
var/turf/location = get_turf(src)
|
||||||
smoketime--
|
smoketime--
|
||||||
if(smoketime < 1)
|
if(smoketime < 1)
|
||||||
new type_butt(location)
|
die()
|
||||||
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)
|
|
||||||
return
|
return
|
||||||
if(location)
|
if(location)
|
||||||
location.hotspot_expose(700, 5)
|
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)
|
/obj/item/clothing/mask/cigarette/attack_self(mob/user as mob)
|
||||||
if(lit == 1)
|
if(lit == 1)
|
||||||
user.visible_message("<span class='notice'>[user] calmly drops and treads on the lit [src], putting it out instantly.</span>")
|
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)
|
die()
|
||||||
new type_butt(T)
|
|
||||||
processing_objects.Remove(src)
|
|
||||||
del(src)
|
|
||||||
return ..()
|
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 //
|
// CIGARS //
|
||||||
@@ -229,6 +230,12 @@ CIGARETTE PACKETS ARE IN FANCY.DM
|
|||||||
w_class = 1
|
w_class = 1
|
||||||
throwforce = 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
|
/obj/item/weapon/cigbutt/cigarbutt
|
||||||
name = "cigar butt"
|
name = "cigar butt"
|
||||||
desc = "A manky old cigar butt."
|
desc = "A manky old cigar butt."
|
||||||
|
|||||||
Reference in New Issue
Block a user