Skip to content

Commit

Permalink
[MIRROR] Virgin Mary (item) code fixes (#1609) (#2554)
Browse files Browse the repository at this point in the history
* Virgin Mary (item) code fixes (#82171)

## About The Pull Request

you can no longer burn multiple at once to get a long name (definitely
unintentional)
some code shuffling
no more one letter variables
also no harddel

## Why It's Good For The Game

fixes #82158

## Changelog
:cl:
fix: the virgin mary picture no longer makes its initiates harddelete
/:cl:

* Virgin Mary (item) code fixes

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: jimmyl <[email protected]>
  • Loading branch information
3 people authored Mar 25, 2024
1 parent 927270a commit 40033b7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// Makes the user handcuff others faster
#define TRAIT_FAST_CUFFING "fast_cuffing"

///Given by /obj/item/virgin_mary, mobs that used this can no longer use it again ever
#define TRAIT_MAFIAINITIATE "mafiainitiate"

///Makes the player appear as their respective job in Binary Talk rather than being a 'Default Cyborg'.
#define DISPLAYS_JOB_IN_BINARY "display_job_in_binary"

Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_XRAY_HEARING" = TRAIT_XRAY_HEARING,
"TRAIT_XRAY_VISION" = TRAIT_XRAY_VISION,
"TRAIT_DISCO_DANCER" = TRAIT_DISCO_DANCER,
"TRAIT_MAFIAINITIATE" = TRAIT_MAFIAINITIATE,
),
/obj/item = list(
"TRAIT_APC_SHOCKING" = TRAIT_APC_SHOCKING,
Expand Down
37 changes: 18 additions & 19 deletions code/game/objects/items/virgin_mary.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,41 @@
resistance_flags = FLAMMABLE
///Has this item been used already.
var/used_up = FALSE
///List of mobs that have already been mobbed.
var/static/list/mob_mobs = list()

#define NICKNAME_CAP (MAX_NAME_LEN/2)
/obj/item/virgin_mary/attackby(obj/item/W, mob/user, params)
/obj/item/virgin_mary/attackby(obj/item/potential_lighter, mob/living/user, params)
. = ..()
if(resistance_flags & ON_FIRE)
return
if(!burn_paper_product_attackby_check(W, user, TRUE))
if(!istype(user) || !user.mind) //A sentient mob needs to be burning it, ya cheezit.
return
if(used_up)
return
if(!isliving(user) || !user.mind) //A sentient mob needs to be burning it, ya cheezit.

if(HAS_TRAIT(user, TRAIT_MAFIAINITIATE)) //Only one nickname fuckhead
to_chat(user, span_warning("You have already been initiated into the mafioso life."))
return
var/mob/living/joe = user

if(joe in mob_mobs) //Only one nickname fuckhead
to_chat(joe, span_warning("You have already been initiated into the mafioso life."))
if(!burn_paper_product_attackby_check(potential_lighter, user, TRUE))
return
if(used_up)
return

to_chat(joe, span_notice("As you burn the picture, a nickname comes to mind..."))
var/nickname = tgui_input_text(joe, "Pick a nickname", "Mafioso Nicknames", max_length = NICKNAME_CAP)
ADD_TRAIT(user, TRAIT_MAFIAINITIATE, TRAIT_GENERIC) // Adding the trait early because you could burn multiple at once for a very long name
to_chat(user, span_notice("As you burn the picture, a nickname comes to mind..."))
var/nickname = tgui_input_text(user, "Pick a nickname", "Mafioso Nicknames", max_length = NICKNAME_CAP)
nickname = reject_bad_name(nickname, allow_numbers = FALSE, max_length = NICKNAME_CAP, ascii_only = TRUE)
if(!nickname)
REMOVE_TRAIT(user, TRAIT_MAFIAINITIATE, TRAIT_GENERIC)
return
var/new_name
var/space_position = findtext(joe.real_name, " ")
var/space_position = findtext(user.real_name, " ")
if(space_position)//Can we find a space?
new_name = "[copytext(joe.real_name, 1, space_position)] \"[nickname]\" [copytext(joe.real_name, space_position)]"
new_name = "[copytext(user.real_name, 1, space_position)] \"[nickname]\" [copytext(user.real_name, space_position)]"
else //Append otherwise
new_name = "[joe.real_name] \"[nickname]\""
joe.real_name = new_name
new_name = "[user.real_name] \"[nickname]\""
user.real_name = new_name
used_up = TRUE
mob_mobs += joe
joe.say("My soul will burn like this saint if I betray my family. I enter alive and I will have to get out dead.", forced = /obj/item/virgin_mary)
to_chat(joe, span_userdanger("Being inducted into the mafia does not grant antagonist status."))
user.say("My soul will burn like this saint if I betray my family. I enter alive and I will have to get out dead.", forced = /obj/item/virgin_mary)
to_chat(user, span_userdanger("Being inducted into the mafia does not grant antagonist status."))

#undef NICKNAME_CAP

Expand Down

0 comments on commit 40033b7

Please sign in to comment.