mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 10:33:30 +01:00
refactor match and lighter code to use procs, some code cleanup
lighting mobs on fire with a match is now logged
This commit is contained in:
@@ -23,7 +23,7 @@ LIGHTERS ARE IN LIGHTERS.DM
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
body_parts_covered = null
|
||||
attack_verb = null
|
||||
var/lit = 0
|
||||
var/lit = FALSE
|
||||
var/icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi
|
||||
var/icon_off = "cigoff"
|
||||
var/type_butt = /obj/item/weapon/cigbutt
|
||||
@@ -129,11 +129,10 @@ LIGHTERS ARE IN LIGHTERS.DM
|
||||
if(!src.lit)
|
||||
src.lit = 1
|
||||
name = "lit [name]"
|
||||
if(!istype(src, /obj/item/clothing/mask/cigarette/pipe)) //can't burn people with pipes
|
||||
attack_verb = list("burnt", "singed")
|
||||
hitsound = 'sound/items/welder.ogg'
|
||||
damtype = "fire"
|
||||
force = 4
|
||||
attack_verb = list("burnt", "singed")
|
||||
hitsound = 'sound/items/welder.ogg'
|
||||
damtype = "fire"
|
||||
force = 4
|
||||
if(reagents.get_reagent_amount("plasma")) // the plasma explodes when exposed to fire
|
||||
var/datum/effect_system/reagents_explosion/e = new()
|
||||
e.set_up(round(reagents.get_reagent_amount("plasma") / 2.5, 1), get_turf(src), 0, 0)
|
||||
|
||||
@@ -152,7 +152,8 @@
|
||||
desc = "A simple match stick, used for lighting fine smokables."
|
||||
icon = 'icons/obj/cigarettes.dmi'
|
||||
icon_state = "match_unlit"
|
||||
var/lit = 0
|
||||
var/lit = FALSE
|
||||
var/burnt = FALSE
|
||||
var/smoketime = 5
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
origin_tech = "materials=1"
|
||||
@@ -162,44 +163,63 @@
|
||||
var/turf/location = get_turf(src)
|
||||
smoketime--
|
||||
if(smoketime < 1)
|
||||
lit = -1
|
||||
damtype = "brute"
|
||||
force = 0
|
||||
icon_state = "match_burnt"
|
||||
item_state = "cigoff"
|
||||
name = "burnt match"
|
||||
desc = "A match. This one has seen better days."
|
||||
attack_verb = null
|
||||
processing_objects.Remove(src)
|
||||
return
|
||||
matchburnout()
|
||||
if(location)
|
||||
location.hotspot_expose(700, 5)
|
||||
return
|
||||
|
||||
/obj/item/weapon/match/dropped(mob/user)
|
||||
if(lit == 1)
|
||||
lit = -1
|
||||
/obj/item/match/fire_act()
|
||||
matchignite()
|
||||
|
||||
/obj/item/match/proc/matchignite()
|
||||
if(!lit && !burnt)
|
||||
lit = TRUE
|
||||
icon_state = "match_lit"
|
||||
damtype = "fire"
|
||||
force = 3
|
||||
hitsound = 'sound/items/welder.ogg'
|
||||
item_state = "cigon"
|
||||
name = "lit match"
|
||||
desc = "A match. This one is lit."
|
||||
attack_verb = list("burnt","singed")
|
||||
processing_objects.Add(src)
|
||||
update_icon()
|
||||
|
||||
/obj/item/match/proc/matchburnout()
|
||||
if(lit)
|
||||
lit = FALSE
|
||||
burnt = TRUE
|
||||
damtype = "brute"
|
||||
force = initial(force)
|
||||
icon_state = "match_burnt"
|
||||
item_state = "cigoff"
|
||||
name = "burnt match"
|
||||
desc = "A match. This one has seen better days."
|
||||
attack_verb = null
|
||||
attack_verb = list("flicked")
|
||||
processing_objects.Remove(src)
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/match/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
|
||||
/obj/item/match/dropped(mob/user)
|
||||
matchburnout()
|
||||
. = ..()
|
||||
|
||||
/obj/item/weapon/match/attack(mob/living/carbon/M, mob/living/carbon/user)
|
||||
if(!isliving(M))
|
||||
return ..()
|
||||
if(lit == 1) M.IgniteMob()
|
||||
if(!istype(M, /mob))
|
||||
return ..()
|
||||
|
||||
if(istype(M.wear_mask, /obj/item/clothing/mask/cigarette) && user.zone_sel.selecting == "mouth" && lit == 1)
|
||||
var/obj/item/clothing/mask/cigarette/cig = M.wear_mask
|
||||
if(lit && M.IgniteMob())
|
||||
message_admins("[key_name_admin(user)] set [key_name_admin(M)] on fire")
|
||||
log_game("[key_name(user)] set [key_name(M)] on fire")
|
||||
var/obj/item/clothing/mask/cigarette/cig = help_light_cig(M)
|
||||
if(lit && cig && user.a_intent == INTENT_HELP)
|
||||
if(cig.lit)
|
||||
to_chat(user, "<span class='notice'>[cig] is already lit.</span>")
|
||||
if(M == user)
|
||||
cig.attackby(src, user)
|
||||
else
|
||||
cig.light("<span class='notice'>[user] holds the [name] out for [M], and lights the [cig.name].</span>")
|
||||
cig.light("<span class='notice'>[user] holds [src] out for [M], and lights [cig].</span>")
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/proc/help_light_cig(mob/living/M)
|
||||
var/mask_item = M.get_item_by_slot(slot_wear_mask)
|
||||
if(istype(mask_item, /obj/item/clothing/mask/cigarette))
|
||||
return mask_item
|
||||
|
||||
@@ -645,18 +645,9 @@
|
||||
new /obj/item/weapon/match(src)
|
||||
|
||||
/obj/item/weapon/storage/box/matches/attackby(obj/item/weapon/match/W, mob/user, params)
|
||||
if(istype(W, /obj/item/weapon/match) && W.lit == 0)
|
||||
W.lit = 1
|
||||
W.icon_state = "match_lit"
|
||||
W.damtype = "fire"
|
||||
W.force = 3
|
||||
W.item_state = "cigon"
|
||||
W.name = "lit match"
|
||||
W.desc = "A match. This one is lit."
|
||||
W.attack_verb = list("burnt","singed")
|
||||
processing_objects.Add(W)
|
||||
if(istype(W, /obj/item/weapon/match) && !W.lit)
|
||||
W.matchignite()
|
||||
playsound(user.loc, 'sound/goonstation/misc/matchstick_light.ogg', 50, 1)
|
||||
W.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/box/autoinjectors
|
||||
|
||||
Reference in New Issue
Block a user