Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Virgin Mary (item) code fixes #2554

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading