Skip to content

Commit

Permalink
Enhances the Smoking Experience - Adds Many New Item Interactions for…
Browse files Browse the repository at this point in the history
… Cigarettes and Items Interacting With Them (#25571)

* Refactoring and other stuff.

* moar

* More smoking

* Update energy_melee_weapons.dm

* Update code/game/objects/items/robot/cyborg_gripper.dm

Co-authored-by: Ryan <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Apply suggestions from code review

Co-authored-by: Ryan <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Update cigs.dm

* Update cigs.dm

* Update cigs.dm

* Update code/game/objects/items/weapons/lighters.dm

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Apply suggestions from code review

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* eee

* Apply suggestions from code review

Co-authored-by: Luc <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* sigh

* Update cigs.dm

* Apply suggestions from code review

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* hell

* Update cigs.dm

* aa

* cool

* Fixing some minor typos for cyborg upgrade flavour text

Throws in some missing apostrophes, capitalisation, and the letter "s."

* Briefcase Full of Cash buff

Increases the amount of cash in the Syndicate Briefcase Full of Cash from 600 Cr to 1000 Cr

* Reverts double-feature PR

* Reverts a broken revert

* Reverting again because Ebba told me to

* And reverting yet again

* Update robot_upgrades.dm

* aa

* aaa

* suffering

* Soon

* Is it done!? Am I finally free!?

* Apply suggestions from code review

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Update

* Update

* No longer assume the cig is in a mouth

* Update tools.dm

* Update pronouns.dm

* Fixing some minor typos for cyborg upgrade flavour text

Throws in some missing apostrophes, capitalisation, and the letter "s."

* Briefcase Full of Cash buff

Increases the amount of cash in the Syndicate Briefcase Full of Cash from 600 Cr to 1000 Cr

* Reverts double-feature PR

* Reverts a broken revert

* Reverting again because Ebba told me to

* And reverting yet again

* Update robot_upgrades.dm

* Fixing some minor typos for cyborg upgrade flavour text

Throws in some missing apostrophes, capitalisation, and the letter "s."

* Briefcase Full of Cash buff

Increases the amount of cash in the Syndicate Briefcase Full of Cash from 600 Cr to 1000 Cr

* Reverts double-feature PR

* Reverts a broken revert

* Reverting again because Ebba told me to

* And reverting yet again

* Update robot_upgrades.dm

* update

* Attack animations for sword lighting!

* Update

* indentation

* Update cigs.dm

* minor refactor

* Update items.dm

* Update items.dm

* Update welder.dm

* Update energy_melee_weapons.dm

* Apply suggestions from code review

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* refactor

* Update items.dm

* Apply suggestions from code review

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Fixing some minor typos for cyborg upgrade flavour text

Throws in some missing apostrophes, capitalisation, and the letter "s."

* Briefcase Full of Cash buff

Increases the amount of cash in the Syndicate Briefcase Full of Cash from 600 Cr to 1000 Cr

* Reverts double-feature PR

* Reverts a broken revert

* Reverting again because Ebba told me to

* And reverting yet again

* Update robot_upgrades.dm

* Update flamethrower.dm

* clipping

* Update legion_loot.dm

* anti attack check

* Fixes a zippo runtime

* Fixes evil runtime and stops unnecessary violence.

* Apply suggestions from code review

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Update based on review

* Update cigs.dm

* Update energy_melee_weapons.dm

* Apply suggestions from code review

Co-authored-by: Burzah <[email protected]>
Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Update toys.dm

* Update energy_melee_weapons.dm

* Update legion_loot.dm

* Update code/game/objects/items/weapons/melee/energy_melee_weapons.dm

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

---------

Signed-off-by: CRUNCH <[email protected]>
Co-authored-by: Ryan <[email protected]>
Co-authored-by: DGamerL <[email protected]>
Co-authored-by: Luc <[email protected]>
Co-authored-by: Burzah <[email protected]>
  • Loading branch information
5 people authored Sep 3, 2024
1 parent c7340b0 commit 9ef47e7
Show file tree
Hide file tree
Showing 18 changed files with 925 additions and 385 deletions.
33 changes: 33 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -994,3 +994,36 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons

/obj/item/proc/should_stack_with(obj/item/other)
return type == other.type && name == other.name

/**
* Handles the bulk of cigarette lighting interactions. You must call `light()` to actually light the cigarette.
*
* Returns: the target's cigarette (or the cigarette itself if attacked directly) if all checks are passed.
* If the cigarette is already lit, or is a fancy smokable being lit by anything other than a zippo or match, will return `FALSE`.
* Otherwise it will return `null`.
* Arguments:
* * user - The mob trying to light the cigarette.
* * target - The mob with the cigarette.
* * direct_attackby_item - Used if the cigarette item is clicked on directly with a lighter instead of a mob wearing a cigarette.
*/
/obj/item/proc/cigarette_lighter_act(mob/living/user, mob/living/target, obj/item/direct_attackby_item)
if(!user || !target)
return null

var/obj/item/clothing/mask/cigarette/cig = direct_attackby_item ? direct_attackby_item : target.wear_mask
if(!istype(cig))
return null

if(user.zone_selected != "mouth" || !user.a_intent == INTENT_HELP)
return null

if(cig.lit)
to_chat(user, "<span class='warning'>[cig] is already lit!</span>")
return FALSE

// Only matches and cigars can light fancy smokables.
if(cig.fancy && !istype(src, /obj/item/match) && !istype(src, /obj/item/lighter/zippo))
to_chat(user, "<span class='danger'>[cig] straight out REFUSES to be lit by such uncivilized means!</span>")
return FALSE

return cig
3 changes: 2 additions & 1 deletion code/game/objects/items/robot/cyborg_gripper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@
/obj/item/coin,
/obj/item/paper,
/obj/item/photo,
/obj/item/toy/plushie
/obj/item/toy/plushie,
/obj/item/clothing/mask/cigarette
)

// Mining Gripper
Expand Down
32 changes: 22 additions & 10 deletions code/game/objects/items/tools/welder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,31 @@
return
remove_fuel(0.5)

/obj/item/weldingtool/attack(mob/living/carbon/M, mob/living/carbon/user)
// For lighting other people's cigarettes.
var/obj/item/clothing/mask/cigarette/cig = M?.wear_mask
if(!istype(cig) || user.zone_selected != "mouth" || !tool_enabled)
/obj/item/weldingtool/attack(mob/living/target, mob/living/user)
if(!cigarette_lighter_act(user, target))
return ..()

if(M == user)
cig.attackby(src, user)
return
/obj/item/weldingtool/cigarette_lighter_act(mob/living/user, mob/living/target, obj/item/direct_attackby_item)
var/obj/item/clothing/mask/cigarette/cig = ..()
if(!cig)
return !isnull(cig)

if(!tool_enabled)
to_chat(user, "<span class='warning'>You need to activate [src] before you can light anything with it!</span>")
return TRUE

cig.light("<span class='notice'>[user] holds out [src] out for [M], and casually lights [cig]. What a badass.</span>")
playsound(src, 'sound/items/lighter/light.ogg', 25, TRUE)
M.update_inv_wear_mask()
if(target == user)
user.visible_message(
"<span class='notice'>[user] casually lights [cig] with [src], what a badass.</span>",
"<span class='notice'>You light [cig] with [src].</span>"
)
else
user.visible_message(
"<span class='notice'>[user] holds out [src] out for [target], and casually lights [cig]. What a badass.</span>",
"<span class='notice'>You light [cig] for [target] with [src].</span>"
)
cig.light(user, target)
return TRUE

/obj/item/weldingtool/use_tool(atom/target, user, delay, amount, volume, datum/callback/extra_checks)
target.add_overlay(GLOB.welding_sparks)
Expand Down
65 changes: 61 additions & 4 deletions code/game/objects/items/toys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
..()
if(istype(W, /obj/item/toy/sword))
if(W == src)
to_chat(user, "<span class='notice'>You try to attach the end of the plastic sword to... itself. You're not very smart, are you?</span>")
to_chat(user, "<span class='notice'>You try to attach the end of the plastic sword to... Itself. You're not very smart, are you?</span>")
if(ishuman(user))
user.adjustBrainLoss(10)
else if((W.flags & NODROP) || (flags & NODROP))
Expand All @@ -229,10 +229,64 @@
/// Sets to TRUE once the character using it hits something and realises it's not a real energy sword
var/pranked = FALSE

/obj/item/toy/sword/attack(mob/target, mob/living/user)
if(!cigarette_lighter_act(user, target))
return ..()

/obj/item/toy/sword/cigarette_lighter_act(mob/living/user, mob/living/target, obj/item/direct_attackby_item)
var/obj/item/clothing/mask/cigarette/cig = ..()
if(!cig)
return !isnull(cig)

if(!active)
to_chat(user, "<span class='warning'>You must activate [src] before you can light [cig] with it!</span>")
return TRUE

user.do_attack_animation(target)

// 1% chance to light the cig. Somehow...
if(prob(1))
if(target == user)
user.visible_message(
"<span class='warning'>[user] makes a violent slashing motion, barely missing [user.p_their()] nose as light flashes! \
[user.p_they(TRUE)] light[user.p_s()] [user.p_their()] [cig] with [src] in the process. Somehow...</span>",
"<span class='notice'>You casually slash [src] at [cig], lighting it with the blade. Somehow...</span>",
"<span class='danger'>You hear an energy blade slashing something!</span>"
)
else
user.visible_message(
"<span class='danger'>[user] makes a violent slashing motion, barely missing the nose of [target] as light flashes! \
[user.p_they(TRUE)] light[user.p_s()] [cig] in the mouth of [target] with [src] in the process. Somehow...</span>",
"<span class='notice'>You casually slash [src] at [cig] in the mouth of [target], lighting it with the blade. Somehow...</span>",
"<span class='danger'>You hear an energy blade slashing something!</span>"
)
playsound(user.loc, 'sound/weapons/blade1.ogg', 50, TRUE)
cig.light(user, target)
return TRUE

// Else, bat it out of the target's mouth.
if(target == user)
user.visible_message(
"<span class='warning'>[user] makes a violent slashing motion, barely missing [user.p_their()] nose as light flashes! \
[user.p_they(TRUE)] instead hit [cig], knocking it out of [user.p_their()] mouth and dropping it to the floor.</span>",
"<span class='warning'>You casually slash [src] at [cig], swatting it out of your mouth.</span>",
"<span class='notice'>You hear a gentle tapping.</span>"
)
else
user.visible_message(
"<span class='warning'>[user] makes a violent slashing motion, barely missing the nose of [target] as light flashes! \
[user] does hit [cig], knocking it out of the mouth of [target] and dropping it to the floor. Wow, rude!</span>",
"<span class='warning'>You casually slash [src] at [cig] in the mouth of [target], swatting it to the floor!</span>",
"<span class='notice'>You hear a gentle tapping.</span>"
)
playsound(loc, 'sound/weapons/tap.ogg', vary = TRUE)
target.unEquip(cig, TRUE)
return TRUE

/obj/item/toy/sword/chaosprank/afterattack(mob/living/target, mob/living/user, proximity)
..()
if(!pranked)
to_chat(user, "<span class='chaosverybad'>Oh... it's a fake.</span>")
to_chat(user, "<span class='chaosverybad'>Oh... It's a fake.</span>")
name = "toy sword"
pranked = TRUE

Expand All @@ -241,7 +295,7 @@
*/
/obj/item/dualsaber/toy
name = "double-bladed toy sword"
desc = "A cheap, plastic replica of TWO energy swords. Double the fun!"
desc = "A cheap, plastic replica of TWO energy swords. Double the fun!"
force = 0
throwforce = 0
throw_speed = 3
Expand Down Expand Up @@ -280,7 +334,10 @@
hitsound = 'sound/weapons/bladeslice.ogg'

/obj/item/toy/katana/suicide_act(mob/user)
var/dmsg = pick("[user] tries to stab \the [src] into [user.p_their()] abdomen, but it shatters! [user.p_they(TRUE)] look[user.p_s()] as if [user.p_they()] might die from the shame.","[user] tries to stab \the [src] into [user.p_their()] abdomen, but \the [src] bends and breaks in half! [user.p_they(TRUE)] look[user.p_s()] as if [user.p_they()] might die from the shame.","[user] tries to slice [user.p_their()] own throat, but the plastic blade has no sharpness, causing [user.p_them()] to lose [user.p_their()] balance, slip over, and break [user.p_their()] neck with a loud snap!")
var/dmsg = pick(
"[user] tries to stab [src] into [user.p_their()] abdomen, but it shatters! [user.p_they(TRUE)] look[user.p_s()] as if [user.p_they()] might die from the shame.",
"[user] tries to stab [src] into [user.p_their()] abdomen, but [src] bends and breaks in half! [user.p_they(TRUE)] look[user.p_s()] as if [user.p_they()] might die from the shame.",
"[user] tries to slice [user.p_their()] own throat, but the plastic blade has no sharpness, causing [user.p_them()] to lose [user.p_their()] balance, slip over, and break [user.p_their()] neck with a loud snap!")
user.visible_message("<span class='suicide'>[dmsg] It looks like [user.p_theyre()] trying to commit suicide!</span>")
return BRUTELOSS

Expand Down
Loading

0 comments on commit 9ef47e7

Please sign in to comment.