Skip to content

Commit

Permalink
Datumizes Cult. (ParadiseSS13#24379)
Browse files Browse the repository at this point in the history
* cult 1

* massive data refactor

* progress

* More crap

* IM SCARED IT COMPILES

* oops

* more fixes

* good comment

* hell yeah, team control

* lol

* blamo

* blam

* More stuff

* team refactor

* epic merge fail

* src not _src_

* more

* progress

* cult

* more stuff

* water

* goodbye __IMPLIED_TYPE__

* time to undraft

* FUCK FUCK FUCK

* okay this is better

* goodbye todos

* fix

* order of operations

* last fix? maybe

* yeah

* oops

* okay this should be ALL the fixes

* wow

* hell yeah

* wow

* fixes duplicate teams + adds more team safeties

* how the fuck did this happen

* admin objective improvements

* wah more bullshit

* guh

* fuuuuck

* fucking hell

* fixes
  • Loading branch information
Contrabang committed Mar 16, 2024
1 parent 0c25bf4 commit 2ec55db
Show file tree
Hide file tree
Showing 69 changed files with 1,327 additions and 1,136 deletions.
11 changes: 7 additions & 4 deletions code/__DEFINES/cult_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define RUNE_COLOR_EMP "#4D94FF"
#define RUNE_COLOR_SUMMON "#00FF00"

#define is_sacrifice_target(A) SSticker.mode?.cult_objs.is_sac_target(A)
#define IS_SACRIFICE_TARGET(A) SSticker?.mode?.cult_team?.is_sac_target(A)

// Blood magic
/// Maximum number of spells with an empowering rune
Expand Down Expand Up @@ -42,9 +42,6 @@
#define DEFAULT_TOOLTIP "6:-29,5:-2"

// Text
#define CULT_GREETING "<span class='cultlarge'>You catch a glimpse of the Realm of [SSticker.cultdat.entity_name], [SSticker.cultdat.entity_title3]. \
You now see how flimsy the world is, you see that it should be open to the knowledge of [SSticker.cultdat.entity_name].</span>"

#define CULT_CURSES list("A fuel technician just slit his own throat and begged for death.", \
"The shuttle's navigation programming was replaced by a file containing two words, IT COMES.", \
"The shuttle's custodian tore out his guts and began painting strange shapes on the floor.", \
Expand All @@ -66,3 +63,9 @@
#define NARSIE_NEEDS_SUMMONING 2
#define NARSIE_HAS_RISEN 3
#define NARSIE_HAS_FALLEN -1

/// Safely accesses SSticker.cult_data, returns the default if cult data is not set up yet. Allows for both variable and proc call access.
#define GET_CULT_DATA(var_or_proc, default) (SSticker.cult_data ? SSticker.cult_data.var_or_proc : default)

/// Checks that the given element is living an has a cult antag datum
#define IS_CULTIST(mob) (isliving(mob) && mob?:mind?:has_antag_datum(/datum/antagonist/cultist)) // for someone TODO, move all antag checks over to TG's `IS_TRAITOR` defines. Also remove `isliving()` from this call someday
2 changes: 1 addition & 1 deletion code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@
#define COMSIG_AIRLOCK_CLOSE "airlock_close"

// /datum/objective signals
///from datum/objective/proc/find_target()
///from datum/objective/proc/find_target(list/target_blacklist)
#define COMSIG_OBJECTIVE_TARGET_FOUND "objective_target_found"
///from datum/objective/is_invalid_target()
#define COMSIG_OBJECTIVE_CHECK_VALID_TARGET "objective_check_valid_target"
Expand Down
24 changes: 13 additions & 11 deletions code/__DEFINES/gamemode.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
//objective defines
#define TARGET_INVALID_IS_OWNER 1
#define TARGET_INVALID_NOT_HUMAN 2
#define TARGET_INVALID_DEAD 3
#define TARGET_INVALID_NOCKEY 4
#define TARGET_INVALID_UNREACHABLE 5
#define TARGET_INVALID_GOLEM 6
#define TARGET_INVALID_EVENT 7
#define TARGET_INVALID_IS_TARGET 8
#define TARGET_INVALID_BLACKLISTED 9
#define TARGET_INVALID_CHANGELING 10
#define TARGET_INVALID_NOTHEAD 11
#define TARGET_INVALID_IS_OWNER 1
#define TARGET_INVALID_NOT_HUMAN 2
#define TARGET_INVALID_DEAD 3
#define TARGET_INVALID_NOCKEY 4
#define TARGET_INVALID_UNREACHABLE 5
#define TARGET_INVALID_GOLEM 6
#define TARGET_INVALID_EVENT 7
#define TARGET_INVALID_IS_TARGET 8
#define TARGET_INVALID_BLACKLISTED 9
#define TARGET_INVALID_CHANGELING 10
#define TARGET_INVALID_NOTHEAD 11
#define TARGET_INVALID_CULTIST 12
#define TARGET_INVALID_CULT_CONVERTABLE 13

//gamemode istype helpers
#define GAMEMODE_IS_CULT (SSticker && istype(SSticker.mode, /datum/game_mode/cult))
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/misc_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -690,3 +690,7 @@ do { \

#define RETURN_POINT_VECTOR(ATOM, ANGLE, SPEED) (new /datum/point_precise/vector(ATOM, null, null, null, null, ANGLE, SPEED))
#define RETURN_POINT_VECTOR_INCREMENT(ATOM, ANGLE, SPEED, AMT) (new /datum/point_precise/vector(ATOM, null, null, null, null, ANGLE, SPEED, AMT))

#define TEAM_ADMIN_ADD_OBJ_SUCCESS (1<<0)
#define TEAM_ADMIN_ADD_OBJ_CANCEL_LOG (1<<1)
#define TEAM_ADMIN_ADD_OBJ_PURPOSEFUL_CANCEL (1<<2)
7 changes: 4 additions & 3 deletions code/controllers/subsystem/SSticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ SUBSYSTEM_DEF(ticker)
var/Bible_name
/// Name of the bible deity
var/Bible_deity_name
/// Cult data. Here instead of cult for adminbus purposes
var/datum/cult_info/cultdat = null
/// Cult static info, used for things like sprites. Someone should refactor the sprites out of it someday and just use SEPERATE ICONS DEPNDING ON THE TYPE OF CULT... like a sane person
var/datum/cult_info/cult_data
/// If set to nonzero, ALL players who latejoin or declare-ready join will have random appearances/genders
var/random_players = FALSE
/// Did we broadcast the tip of the round yet?
Expand Down Expand Up @@ -159,7 +159,8 @@ SUBSYSTEM_DEF(ticker)
reboot_helper("Round ended.", "proper completion")

/datum/controller/subsystem/ticker/proc/setup()
cultdat = setupcult()
var/random_cult = pick(typesof(/datum/cult_info))
cult_data = new random_cult()
score = new()

// Create and announce mode
Expand Down
44 changes: 18 additions & 26 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,6 @@
var/mob/living/carbon/human/H = new_character
if(H.mind in SSticker.mode.syndicates)
SSticker.mode.update_synd_icons_added()
if(H.mind in SSticker.mode.cult)
SSticker.mode.update_cult_icons_added(H.mind) // Adds the cult antag hud
SSticker.mode.add_cult_actions(H.mind) // And all the actions
if(SSticker.mode.cult_risen)
SSticker.mode.rise(H)
if(SSticker.mode.cult_ascendant)
SSticker.mode.ascend(H)

/datum/mind/proc/store_memory(new_text)
memory += "[new_text]<br>"
Expand Down Expand Up @@ -339,7 +332,7 @@

/datum/mind/proc/memory_edit_cult(mob/living/carbon/human/H)
. = _memory_edit_header("cult")
if(src in SSticker.mode.cult)
if(has_antag_datum(/datum/antagonist/cultist))
. += "<a href='?src=[UID()];cult=clear'>no</a>|<b><font color='red'>CULTIST</font></b>"
. += "<br>Give <a href='?src=[UID()];cult=dagger'>dagger</a>|<a href='?src=[UID()];cult=runedmetal'>runedmetal</a>."
else
Expand Down Expand Up @@ -818,8 +811,7 @@
to_chat(H, "<span class='userdanger'>You somehow have become the recipient of a mindshield transplant, and it just activated!</span>")
var/datum/antagonist/rev/has_rev = has_antag_datum(/datum/antagonist/rev)
if(has_rev)
has_rev.silent = TRUE // we have some custom text, lets make the removal silent
remove_antag_datum(/datum/antagonist/rev)
remove_antag_datum(/datum/antagonist/rev, silent_removal = TRUE) // we have some custom text, lets make the removal silent
to_chat(H, "<span class='userdanger'>The nanobots in the mindshield implant remove all thoughts about being a revolutionary. Get back to work!</span>")

else if(href_list["revolution"])
Expand Down Expand Up @@ -911,27 +903,25 @@
else if(href_list["cult"])
switch(href_list["cult"])
if("clear")
if(src in SSticker.mode.cult)
SSticker.mode.remove_cultist(src)
special_role = null
if(has_antag_datum(/datum/antagonist/cultist))
remove_antag_datum(/datum/antagonist/cultist)
log_admin("[key_name(usr)] has de-culted [key_name(current)]")
message_admins("[key_name_admin(usr)] has de-culted [key_name_admin(current)]")
if("cultist")
if(!(src in SSticker.mode.cult))
to_chat(current, CULT_GREETING)
SSticker.mode.add_cultist(src)
to_chat(current, "<span class='cultitalic'>Assist your new compatriots in their dark dealings. Their goal is yours, and yours is theirs. You serve [SSticker.cultdat.entity_title2] above all else. Bring It back.</span>")
log_and_message_admins("[key_name(usr)] has culted [key_name(current)]")
if(!has_antag_datum(/datum/antagonist/cultist))
add_antag_datum(/datum/antagonist/cultist)
to_chat(current, "<span class='cultitalic'>Assist your new compatriots in their dark dealings. Their goal is yours, and yours is theirs. You serve [GET_CULT_DATA(entity_title2, "your god")] above all else. Bring It back.</span>")
log_and_message_admins("has culted [key_name(current)]")
if("dagger")
var/mob/living/carbon/human/H = current
if(!SSticker.mode.cult_give_item(/obj/item/melee/cultblade/dagger, H))
var/datum/antagonist/cultist/cultist = has_antag_datum(/datum/antagonist/cultist)
if(!cultist.cult_give_item(/obj/item/melee/cultblade/dagger))
to_chat(usr, "<span class='warning'>Spawning dagger failed!</span>")
log_and_message_admins("[key_name(usr)] has equipped [key_name(current)] with a cult dagger")
log_and_message_admins("has equipped [key_name(current)] with a cult dagger")
if("runedmetal")
var/mob/living/carbon/human/H = current
if(!SSticker.mode.cult_give_item(/obj/item/stack/sheet/runed_metal/ten, H))
var/datum/antagonist/cultist/cultist = has_antag_datum(/datum/antagonist/cultist)
if(!cultist.cult_give_item(/obj/item/stack/sheet/runed_metal/ten))
to_chat(usr, "<span class='warning'>Spawning runed metal failed!</span>")
log_and_message_admins("[key_name(usr)] has equipped [key_name(current)] with 10 runed metal sheets")
log_and_message_admins("has equipped [key_name(current)] with 10 runed metal sheets")

else if(href_list["wizard"])

Expand Down Expand Up @@ -1536,9 +1526,11 @@
* Arguments:
* * datum_type - an antag datum typepath
*/
/datum/mind/proc/remove_antag_datum(datum_type, check_subtypes = TRUE)
/datum/mind/proc/remove_antag_datum(datum_type, check_subtypes = TRUE, silent_removal = FALSE)
var/datum/antagonist/A = has_antag_datum(datum_type, check_subtypes)
qdel(A)
if(A)
A.silent |= silent_removal
qdel(A)

/**
* Removes all antag datums from the src mind.
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/construct_spells.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
if(C.holy)
C.set_light(3, 5, LIGHT_COLOR_DARK_BLUE)
else
C.set_light(2, 3, l_color = SSticker.cultdat ? SSticker.cultdat.construct_glow : LIGHT_COLOR_BLOOD_MAGIC)
C.set_light(2, 3, l_color = GET_CULT_DATA(construct_glow, LIGHT_COLOR_BLOOD_MAGIC))

/obj/effect/proc_holder/spell/ethereal_jaunt/shift/jaunt_steam(mobloc)
return
Expand Down
21 changes: 10 additions & 11 deletions code/game/gamemodes/cult/blood_magic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
..()

/datum/action/innate/cult/blood_spell/IsAvailable()
if(!iscultist(owner) || owner.incapacitated() || !charges)
if(!IS_CULTIST(owner) || owner.incapacitated() || !charges)
return FALSE
return ..()

Expand Down Expand Up @@ -229,8 +229,7 @@
button_icon_state = "cult_dagger"

/datum/action/innate/cult/blood_spell/dagger/New()
if(SSticker.mode)
button_icon_state = SSticker.cultdat.dagger_icon
button_icon_state = GET_CULT_DATA(dagger_icon, "cult_dagger")
..()

/datum/action/innate/cult/blood_spell/dagger/Activate()
Expand Down Expand Up @@ -298,7 +297,7 @@
/obj/effect/proc_holder/horror/InterceptClickOn(mob/living/user, params, atom/target)
if(..())
return
if(ranged_ability_user.incapacitated() || !iscultist(user))
if(ranged_ability_user.incapacitated() || !IS_CULTIST(user))
user.ranged_ability.remove_ranged_ability(user)
return
if(user.holy_check())
Expand All @@ -307,7 +306,7 @@
if(!isturf(T))
return FALSE
if(target in view(7, ranged_ability_user))
if(!ishuman(target) || iscultist(target))
if(!ishuman(target) || IS_CULTIST(target))
return
var/mob/living/carbon/human/H = target
H.Hallucinate(120 SECONDS)
Expand Down Expand Up @@ -336,7 +335,7 @@
owner.visible_message("<span class='warning'>Thin grey dust falls from [owner]'s hand!</span>", \
"<span class='cultitalic'>You invoke the veiling spell, hiding nearby runes and cult structures.</span>")
charges--
if(!SSticker.mode.cult_risen || !SSticker.mode.cult_ascendant)
if(!SSticker.mode.cult_team.cult_risen || !SSticker.mode.cult_team.cult_ascendant)
playsound(owner, 'sound/magic/smoke.ogg', 25, TRUE, SOUND_RANGE_SET(4)) // If Cult is risen/ascendant.
else
playsound(owner, 'sound/magic/smoke.ogg', 25, TRUE, SOUND_RANGE_SET(1)) // If Cult is unpowered.
Expand All @@ -352,7 +351,7 @@
"<span class='cultitalic'>You invoke the counterspell, revealing nearby runes and cult structures.</span>")
charges--
owner.whisper(invocation)
if(!SSticker.mode.cult_risen || !SSticker.mode.cult_ascendant)
if(!SSticker.mode.cult_team.cult_risen || !SSticker.mode.cult_team.cult_ascendant)
playsound(owner, 'sound/misc/enter_blood.ogg', 25, TRUE, SOUND_RANGE_SET(7)) // If Cult is risen/ascendant.
else
playsound(owner, 'sound/magic/smoke.ogg', 25, TRUE, SOUND_RANGE_SET(1)) // If Cult is unpowered.
Expand Down Expand Up @@ -429,7 +428,7 @@
afterattack(user, user, TRUE)

/obj/item/melee/blood_magic/attack(mob/living/M, mob/living/carbon/user)
if(!iscarbon(user) || !iscultist(user))
if(!iscarbon(user) || !IS_CULTIST(user))
uses = 0
qdel(src)
return
Expand Down Expand Up @@ -462,7 +461,7 @@
if(!isliving(target) || !proximity)
return
var/mob/living/L = target
if(iscultist(target))
if(IS_CULTIST(target))
return
if(user.holy_check())
return
Expand Down Expand Up @@ -511,7 +510,7 @@
var/list/teleportnames = list()
var/list/duplicaterunecount = list()
var/atom/movable/teleportee
if(!iscultist(target) || !proximity)
if(!IS_CULTIST(target) || !proximity)
to_chat(user, "<span class='warning'>You can only teleport adjacent cultists with this spell!</span>")
return
if(user != target) // So that the teleport effect shows on the correct mob
Expand Down Expand Up @@ -875,7 +874,7 @@
if(!proximity)
return ..()
if(ishuman(target))
if(iscultist(target))
if(IS_CULTIST(target))
heal_cultist(user, target)
target.clean_blood()
else
Expand Down
20 changes: 8 additions & 12 deletions code/game/gamemodes/cult/cult_actions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
buttontooltipstyle = "cult"

/datum/action/innate/cult/IsAvailable()
if(!iscultist(owner))
if(!IS_CULTIST(owner))
return FALSE
return ..()

Expand Down Expand Up @@ -55,7 +55,7 @@

living_message = "<span class='cult[(large ? "large" : "speech")]'>[title]: [message]</span>"
for(var/mob/M in GLOB.player_list)
if(iscultist(M))
if(IS_CULTIST(M))
to_chat(M, living_message)
else if((M in GLOB.dead_mob_list) && !isnewplayer(M))
to_chat(M, "<span class='cult[(large ? "large" : "speech")]'>[title] ([ghost_follow_link(user, ghost=M)]): [message]</span>")
Expand All @@ -78,7 +78,7 @@
living_message = "<span class='cultlarge'>[title]: [message]</span>"

for(var/mob/M in GLOB.player_list)
if(iscultist(M))
if(IS_CULTIST(M))
to_chat(M, living_message)
else if((M in GLOB.dead_mob_list) && !isnewplayer(M))
to_chat(M, "<span class='cultlarge'>[title] ([ghost_follow_link(user, ghost=M)]): [message]</span>")
Expand All @@ -92,20 +92,17 @@
check_flags = AB_CHECK_CONSCIOUS

/datum/action/innate/cult/check_progress/New()
if(SSticker.mode)
button_icon_state = SSticker.cultdat.tome_icon
button_icon_state = GET_CULT_DATA(tome_icon, "tome")
..()

/datum/action/innate/cult/check_progress/IsAvailable()
if(iscultist(owner) || isobserver(owner))
return TRUE
return FALSE
return IS_CULTIST(owner) || isobserver(owner)

/datum/action/innate/cult/check_progress/Activate()
if(!IsAvailable())
return
if(SSticker && SSticker.mode)
SSticker.mode.cult_objs.study(usr, TRUE)
if(SSticker?.mode?.cult_team)
SSticker.mode.cult_team.study_objectives(usr, TRUE)
else
to_chat(usr, "<span class='cultitalic'>You fail to study the Veil. (This should never happen, adminhelp and/or yell at a coder)</span>")

Expand All @@ -117,8 +114,7 @@
button_icon_state = "blood_dagger"

/datum/action/innate/cult/use_dagger/Grant()
if(SSticker.mode)
button_icon_state = SSticker.cultdat.dagger_icon
button_icon_state = GET_CULT_DATA(dagger_icon, "blood_dagger")
..()

/datum/action/innate/cult/use_dagger/override_location()
Expand Down
3 changes: 0 additions & 3 deletions code/game/gamemodes/cult/cult_datums.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@
var/airlock_unruned_icon_file = 'icons/obj/doors/airlocks/cult/unruned/cult.dmi'
var/airlock_unruned_overlays_file = 'icons/obj/doors/airlocks/cult/unruned/cult-overlays.dmi'

/// Are cultist mirror shields active yet?
var/mirror_shields_active = FALSE


/datum/cult_info/fire
name = "Cult of Kha'Rin"
Expand Down
Loading

0 comments on commit 2ec55db

Please sign in to comment.