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

refactor: godmode #5920

Merged
merged 14 commits into from
Sep 22, 2024
1 change: 0 additions & 1 deletion code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#define PASSEMOTES (1<<6) //Mob has a cortical borer or holders inside of it that need to see emotes.
#define IGNORESLOWDOWN (1<<7)
#define IGNORE_SPEED_CHANGES (1<<8)
#define GODMODE (1<<9)

//Health Defines
#define HEALTH_THRESHOLD_CRIT 0
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_LAVA_STOPPED "lava_stopped"

//mob traits
#define TRAIT_GODMODE "godmode"
#define TRAIT_PACIFISM "pacifism"
#define TRAIT_WATERBREATH "waterbreathing"
#define TRAIT_BLOODCRAWL "bloodcrawl"
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_FORCED_STANDING" = TRAIT_FORCED_STANDING,
"TRAIT_GENE_STRONG" = TRAIT_GENE_STRONG,
"TRAIT_GENE_WEAK" = TRAIT_GENE_WEAK,
"TRAIT_GODMODE" = TRAIT_GODMODE,
"TRAIT_HANDS_BLOCKED" = TRAIT_HANDS_BLOCKED,
"TRAIT_HAS_LIPS" = TRAIT_HAS_LIPS,
"TRAIT_HAS_REGENERATION" = TRAIT_HAS_REGENERATION,
Expand Down
6 changes: 2 additions & 4 deletions code/datums/spells/rod_form.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
setDir(wizard.dir)
src.wizard = wizard
wizard.forceMove(src)
wizard.status_flags |= GODMODE
ADD_TRAIT(wizard, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
wizard.add_traits(list(TRAIT_GODMODE, TRAIT_NO_TRANSFORM), UNIQUE_TRAIT_SOURCE(src))


/**
Expand All @@ -97,8 +96,7 @@
if(QDELETED(wizard))
wizard = null
return
REMOVE_TRAIT(wizard, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
wizard.status_flags &= ~GODMODE
wizard.remove_traits(list(TRAIT_GODMODE, TRAIT_NO_TRANSFORM), UNIQUE_TRAIT_SOURCE(src))
wizard.forceMove(get_turf(src))
wizard = null

Expand Down
10 changes: 5 additions & 5 deletions code/datums/spells/shapeshift.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@


/obj/effect/proc_holder/spell/shapeshift/proc/Shapeshift(mob/living/caster)
for(var/mob/living/M in caster)
if(M.status_flags & GODMODE)
to_chat(caster, "<span class='warning'>You're already shapeshifted!</span>")
for(var/mob/living/mob in caster)
if(HAS_TRAIT(mob, TRAIT_GODMODE))
Antoonij marked this conversation as resolved.
Show resolved Hide resolved
to_chat(caster, span_warning("You're already shapeshifted!"))
return

var/mob/living/shape = new shapeshift_type(get_turf(caster))
caster.forceMove(shape)
caster.status_flags |= GODMODE
ADD_TRAIT(caster, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))

current_shapes |= shape
current_casters |= caster
Expand All @@ -75,7 +75,7 @@
if(!caster)
return
caster.forceMove(get_turf(shape))
caster.status_flags &= ~GODMODE
REMOVE_TRAIT(caster, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))

clothes_req = initial(clothes_req)
human_req = initial(human_req)
Expand Down
8 changes: 4 additions & 4 deletions code/datums/status_effects/neutral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@

/// So we don't leave folks with god-mode
/datum/status_effect/high_five/proc/wiz_cleanup(mob/living/carbon/user, mob/living/carbon/highfived)
user.status_flags &= ~GODMODE
highfived.status_flags &= ~GODMODE
REMOVE_TRAIT(user, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))
REMOVE_TRAIT(highfived, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))
user.remove_status_effect(type)
highfived.remove_status_effect(type)

Expand All @@ -112,8 +112,8 @@
continue
if(is_wiz && iswizard(check))
user.visible_message(span_dangerbigger("<b>[user.name]</b> and <b>[check.name]</b> [critical_success]"))
user.status_flags |= GODMODE
check.status_flags |= GODMODE
ADD_TRAIT(user, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))
ADD_TRAIT(check, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))
explosion(get_turf(user), 5, 2, 1, 3, cause = id)
// explosions have a spawn so this makes sure that we don't get gibbed
addtimer(CALLBACK(src, PROC_REF(wiz_cleanup), user, check), 0.3 SECONDS) //I want to be sure this lasts long enough, with lag.
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/clockwork/cogscarab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@


/mob/living/silicon/robot/cogscarab/updatehealth(reason = "none given", should_log = FALSE)
if(status_flags & GODMODE)
if(HAS_TRAIT(src, TRAIT_GODMODE))
return ..()
set_health(maxHealth - (getBruteLoss() + getFireLoss() + (suiciding ? getOxyLoss() : 0)))
update_stat("updatehealth([reason])", should_log)


/mob/living/silicon/robot/cogscarab/update_stat(reason = "none given", should_log = FALSE)
if(status_flags & GODMODE)
if(HAS_TRAIT(src, TRAIT_GODMODE))
return ..()
if(health <= 0 && stat != DEAD)
ghostize(TRUE)
Expand Down
26 changes: 13 additions & 13 deletions code/game/gamemodes/devil/devilinfo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ GLOBAL_LIST_INIT(lawlorify, list (
form = BASIC_DEVIL

/datum/devilinfo/proc/regress_blood_lizard()
var/mob/living/carbon/true_devil/D = owner.current
to_chat(D, "<span class='warning'>Your powers weaken, have more contracts be signed to regain power.</span>")
D.oldform.loc = D.loc
owner.transfer_to(D.oldform)
D.oldform.status_flags &= ~GODMODE
var/mob/living/carbon/true_devil/devil = owner.current
to_chat(devil, span_warning("Your powers weaken, have more contracts be signed to regain power."))
devil.oldform.loc = devil.loc
owner.transfer_to(devil.oldform)
REMOVE_TRAIT(devil.oldform, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))
give_lizard_spells()
qdel(D)
qdel(devil)
form = BLOOD_LIZARD
update_hud()

Expand All @@ -251,14 +251,14 @@ GLOBAL_LIST_INIT(lawlorify, list (


/datum/devilinfo/proc/increase_true_devil()
var/mob/living/carbon/true_devil/A = new /mob/living/carbon/true_devil(owner.current.loc, owner.current)
A.faction |= "hell"
var/mob/living/carbon/true_devil/ascended = new /mob/living/carbon/true_devil(owner.current.loc, owner.current)
ascended.faction |= "hell"
// Put the old body in stasis
owner.current.status_flags |= GODMODE
owner.current.loc = A
A.oldform = owner.current
owner.transfer_to(A)
A.set_name()
ADD_TRAIT(owner.current, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))
owner.current.loc = ascended
ascended.oldform = owner.current
owner.transfer_to(ascended)
ascended.set_name()
give_true_spells()
form = TRUE_DEVIL
update_hud()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ GLOBAL_LIST_INIT(possibleShadowlingNames, list("U'ruan", "Y`shej", "Nex", "Hel-u
new /obj/structure/alien/weeds/node(shadowturf) //Dim lighting in the chrysalis -- removes itself afterwards

//Can't die while hatching
user.status_flags |= GODMODE
ADD_TRAIT(user, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))

user.visible_message(span_warning("A chrysalis forms around [user], sealing [user.p_them()] inside."), \
span_shadowling("You create your chrysalis and begin to contort within."))
Expand Down Expand Up @@ -101,9 +101,7 @@ GLOBAL_LIST_INIT(possibleShadowlingNames, list("U'ruan", "Y`shej", "Nex", "Hel-u
user.real_name = newNameId
user.name = user.real_name
to_chat(user, span_mind_control("YOU LIVE!!!"))

user.status_flags &= ~GODMODE
REMOVE_TRAIT(user, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
user.remove_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))

for(var/obj/structure/alien/resin/wall/shadowling/resin in orange(user, 1))
qdel(resin)
Expand Down
2 changes: 1 addition & 1 deletion code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@

else if(isliving(bumped_atom))
var/mob/living/bumped_living = bumped_atom
if(bumped_living.flags & GODMODE)
if(HAS_TRAIT(bumped_living, TRAIT_GODMODE))
return
var/static/list/mecha_hit_sound = list('sound/weapons/genhit1.ogg','sound/weapons/genhit2.ogg','sound/weapons/genhit3.ogg')
bumped_living.take_overall_damage(5)
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/items/theft_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
if(!isliving(hit_atom))
return ..()
var/mob/living/victim = hit_atom
if(victim.incorporeal_move || victim.status_flags & GODMODE) //try to keep this in sync with supermatter's consume fail conditions
if(victim.incorporeal_move || HAS_TRAIT(victim, TRAIT_GODMODE)) //try to keep this in sync with supermatter's consume fail conditions
return ..()
if(throwingdatum?.thrower)
var/mob/user = throwingdatum.thrower
Expand All @@ -244,7 +244,7 @@


/obj/item/nuke_core/supermatter_sliver/pickup(mob/living/user)
if(!isliving(user) || user.status_flags & GODMODE) //try to keep this in sync with supermatter's consume fail conditions
if(!isliving(user) || HAS_TRAIT(user, TRAIT_GODMODE)) //try to keep this in sync with supermatter's consume fail conditions
return ..()
user.visible_message(
span_danger("[user] reaches out and tries to pick up [src]. [user.p_their()] body starts to glow and bursts into flames before bursting into flames!"),
Expand Down Expand Up @@ -331,7 +331,7 @@

/obj/item/nuke_core_container/supermatter/attack_hand(mob/user)
if(cracked && sliver) //What did we say about touching the shard...
if(!isliving(user) || user.status_flags & GODMODE)
if(!isliving(user) || HAS_TRAIT(user, TRAIT_GODMODE))
return FALSE
user.visible_message("<span class='danger'>[user] reaches out and tries to pick up [sliver]. [user.p_their()] body starts to glow and bursts into flames!</span>",
"<span class='userdanger'>You reach for [sliver] with your hands. That was dumb.</span>",
Expand Down Expand Up @@ -413,7 +413,7 @@
if(!isliving(AM))
return
var/mob/living/victim = AM
if(victim.incorporeal_move || victim.status_flags & GODMODE) //try to keep this in sync with supermatter's consume fail conditions
if(victim.incorporeal_move || HAS_TRAIT(victim, TRAIT_GODMODE)) //try to keep this in sync with supermatter's consume fail conditions
return
victim.gib()
message_admins("[src] has consumed [key_name_admin(victim)] [ADMIN_JMP(src)].")
Expand Down
11 changes: 4 additions & 7 deletions code/game/objects/items/weapons/anomaly_extract.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@

original_body = user
ADD_TRAIT(original_body, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
ADD_TRAIT(slimeme, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
slimeme.status_flags |= GODMODE
user.status_flags |= GODMODE
slimeme.add_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))
ADD_TRAIT(user, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))
Antoonij marked this conversation as resolved.
Show resolved Hide resolved
user.mind.transfer_to(slimeme)
slimeme.update_sight()
user.move_to_null_space()
Expand All @@ -141,8 +140,7 @@
if(QDELETED(src) || QDELETED(slimeme))
return

REMOVE_TRAIT(slimeme, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
slimeme.status_flags &= ~GODMODE
slimeme.remove_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))
is_transformed = TRUE


Expand Down Expand Up @@ -174,8 +172,7 @@
stack_trace("Spell or original_body was qdeled during the [src] work.")
return

REMOVE_TRAIT(original_body, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
original_body.status_flags &= ~GODMODE
original_body.remove_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))
is_transformed = FALSE
original_body = null

Expand Down
12 changes: 8 additions & 4 deletions code/modules/admin/verbs/randomverbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,21 @@



/client/proc/cmd_admin_godmode(mob/M as mob in GLOB.mob_list)
/client/proc/cmd_admin_godmode(mob/mob as mob in GLOB.mob_list)
set category = "Admin"
set name = "Godmode"

if(!check_rights(R_ADMIN))
return

M.status_flags ^= GODMODE
to_chat(usr, "<span class='notice'>Toggled [(M.status_flags & GODMODE) ? "ON" : "OFF"]</span>", confidential=TRUE)
var/had_trait = HAS_TRAIT_FROM(mob, TRAIT_GODMODE, ADMIN_TRAIT)
if(had_trait)
REMOVE_TRAIT(mob, TRAIT_GODMODE, ADMIN_TRAIT)
else
ADD_TRAIT(mob, TRAIT_GODMODE, ADMIN_TRAIT)

log_and_message_admins("has toggled [key_name_admin(M)]'s nodamage to [(M.status_flags & GODMODE) ? "On" : "Off"]")
to_chat(usr, span_notice("Toggled [had_trait ? "OFF" : "ON"]"), confidential=TRUE)
log_and_message_admins("has toggled [key_name_admin(mob)]'s nodamage to [had_trait ? "Off" : "On"]")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Godmode") //If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!


Expand Down
16 changes: 6 additions & 10 deletions code/modules/antagonists/vampire/vampire_powers/bestia_powers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1010,10 +1010,8 @@

vampire.stop_sucking()
original_body = user
user.status_flags |= GODMODE
vampire_animal.status_flags |= GODMODE
ADD_TRAIT(user, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
ADD_TRAIT(vampire_animal, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
user.add_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))
vampire_animal.add_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))
Antoonij marked this conversation as resolved.
Show resolved Hide resolved
user.forceMove(vampire_animal)
user.mind.transfer_to(vampire_animal)
vampire.draw_HUD()
Expand All @@ -1027,8 +1025,7 @@
if(QDELETED(src) || QDELETED(vampire_animal))
return

vampire_animal.status_flags &= ~GODMODE
REMOVE_TRAIT(vampire_animal, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
vampire_animal.remove_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))
is_transformed = TRUE
var/list/all_spells = vampire_animal.mind.spell_list + vampire_animal.mob_spell_list
for(var/obj/effect/proc_holder/spell/vampire/spell in all_spells)
Expand Down Expand Up @@ -1072,8 +1069,7 @@
stack_trace("Spell or original_body was qdeled during the [src] work.")
return

REMOVE_TRAIT(original_body, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
original_body.status_flags &= ~GODMODE
original_body.remove_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))
is_transformed = FALSE
var/list/all_spells = original_body.mind.spell_list + original_body.mob_spell_list
for(var/obj/effect/proc_holder/spell/vampire/spell in all_spells)
Expand Down Expand Up @@ -1334,7 +1330,7 @@
user_image.add_overlay(user)
user_image.set_light(2, 10, "#700000")
user.forceMove(user_image)
user.status_flags |= GODMODE
ADD_TRAIT(user, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))

animate(user_image, pixel_y = 40, time = 3.7 SECONDS, easing = BOUNCE_EASING|EASE_IN)
animate(pixel_y = 0, time = 0.3 SECONDS, easing = BOUNCE_EASING|EASE_OUT)
Expand Down Expand Up @@ -1378,7 +1374,7 @@
return

coffin.close()
user.status_flags &= ~GODMODE
REMOVE_TRAIT(user, TRAIT_GODMODE, UNIQUE_TRAIT_SOURCE(src))

// we need no companions inside the coffin
for(var/mob/living/victim in (coffin.contents - user))
Expand Down
6 changes: 2 additions & 4 deletions code/modules/mining/lavaland/loot/colossus_loot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -383,17 +383,15 @@
. = ..()
if(isliving(arrived) && holder_animal)
var/mob/living/mob = arrived
mob.add_traits(list(TRAIT_MUTE, TRAIT_NO_TRANSFORM), UNIQUE_TRAIT_SOURCE(src))
mob.status_flags |= GODMODE
mob.add_traits(list(TRAIT_MUTE, TRAIT_GODMODE, TRAIT_NO_TRANSFORM), UNIQUE_TRAIT_SOURCE(src))
mob.mind.transfer_to(holder_animal)
holder_animal.mind.AddSpell(new /obj/effect/proc_holder/spell/exit_possession)


/obj/structure/closet/stasis/dump_contents(kill = TRUE)
STOP_PROCESSING(SSobj, src)
for(var/mob/living/L in src)
L.status_flags &= ~GODMODE
L.remove_traits(list(TRAIT_MUTE, TRAIT_NO_TRANSFORM), UNIQUE_TRAIT_SOURCE(src))
L.remove_traits(list(TRAIT_MUTE, TRAIT_GODMODE, TRAIT_NO_TRANSFORM), UNIQUE_TRAIT_SOURCE(src))
if(holder_animal)
holder_animal.mind.transfer_to(L)
L.mind.RemoveSpell(/obj/effect/proc_holder/spell/exit_possession)
Expand Down
6 changes: 2 additions & 4 deletions code/modules/mining/lavaland/loot/tendril_loot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@
effect.desc = "It's shaped an awful lot like [user.name]."
effect.setDir(user.dir)
user.forceMove(effect)
ADD_TRAIT(user, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
user.status_flags |= GODMODE
user.add_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))

addtimer(CALLBACK(src, PROC_REF(reappear), user, effect), 10 SECONDS)

Expand All @@ -505,8 +504,7 @@
stack_trace("[effect] is outside of the turf contents")
return

user.status_flags &= ~GODMODE
REMOVE_TRAIT(user, TRAIT_NO_TRANSFORM, UNIQUE_TRAIT_SOURCE(src))
user.remove_traits(list(TRAIT_NO_TRANSFORM, TRAIT_GODMODE), UNIQUE_TRAIT_SOURCE(src))
user.forceMove(effect_turf)
user.visible_message(span_danger("[user] pops back into reality!"))
effect.can_destroy = TRUE
Expand Down
6 changes: 5 additions & 1 deletion code/modules/mob/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
density = FALSE
move_force = INFINITY
move_resist = INFINITY
status_flags = GODMODE // You can't damage it.
status_flags = NONE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
invisibility = INVISIBILITY_ABSTRACT // No one can see us
sight = SEE_SELF
move_on_shuttle = 0

/mob/camera/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_GODMODE, INNATE_TRAIT)

/mob/camera/experience_pressure_difference()
return

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/alien/larva/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


/mob/living/carbon/alien/larva/update_stat(reason = "none given", should_log = FALSE)
if(status_flags & GODMODE)
if(HAS_TRAIT(src, TRAIT_GODMODE))
return ..()
if(stat != DEAD)
if(health <= -maxHealth || !get_int_organ(/obj/item/organ/internal/brain))
Expand Down
Loading