Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
wraith-54321 committed Nov 7, 2024
1 parent b899167 commit c8bc820
Show file tree
Hide file tree
Showing 27 changed files with 372 additions and 166 deletions.
5 changes: 4 additions & 1 deletion code/__DEFINES/~monkestation/clock_cult.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define MAX_IMPORTANT_CLOCK_DAMAGE 30

///how many anchoring crystals need to be active before the ark can open
#define ANCHORING_CRYSTALS_TO_SUMMON 2
#define ANCHORING_CRYSTALS_TO_SUMMON 3

///the map path of the reebe map
#define REEBE_MAP_PATH "_maps/~monkestation/templates/reebe.dmm"
Expand All @@ -34,3 +34,6 @@

///up to how many tiles away will the ark stop certain things from breaking turfs
#define ARK_TURF_DESTRUCTION_BLOCK_RANGE 9

///how long in seconds do anchoring crystals take to charge after being placed, 6 minutes
#define ANCHORING_CRYSTAL_CHARGE_DURATION 360
8 changes: 7 additions & 1 deletion code/__DEFINES/~monkestation/dcs/signals/signals_object.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
//flag to block the qdel that normally happens when a projectile is blocked
///flag to block the qdel that normally happens when a projectile is blocked
#define PROJECTILE_INTERRUPT_BLOCK_QDEL (4<<0)

///sent by the ark SS whenever an anchoring crystal charges (/obj/structure/destructible/clockwork/anchoring_crystal/charged_crystal)
#define COMSIG_ANCHORING_CRYSTAL_CHARGED "anchoring_crystal_charged"

///sent by the ark SS whenever an anchoring crystal is created (/obj/structure/destructible/clockwork/anchoring_crystal/charged_crystal)
#define COMSIG_ANCHORING_CRYSTAL_CREATED "anchoring_crystal_created"
2 changes: 2 additions & 0 deletions code/modules/admin/verbs/adminevents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
SSshuttle.admin_emergency_no_recall = TRUE
SSshuttle.emergency.setTimer(0)
SSshuttle.emergency.mode = SHUTTLE_DISABLED
SSshuttle.admin_emergency_disabled = TRUE //monkestation edit
priority_announce(
text = "Emergency Shuttle uplink failure, shuttle disabled until further notice.",
title = "Uplink Failure",
Expand All @@ -249,6 +250,7 @@
message_admins(span_adminnotice("[key_name_admin(usr)] enabled the emergency shuttle."))
SSshuttle.admin_emergency_no_recall = FALSE
SSshuttle.emergency_no_recall = FALSE
SSshuttle.admin_emergency_disabled = FALSE //monkestation edit
if(SSshuttle.last_mode == SHUTTLE_DISABLED) //If everything goes to shit, fix it.
SSshuttle.last_mode = SHUTTLE_IDLE

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/damage_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,12 @@

/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL)
var/area/target_area = get_area(src)
if(target_area)
if(target_area && !forced) //monkestation edit
if((target_area.area_flags & PASSIVE_AREA) && amount > 0)
return FALSE
if(!can_adjust_tox_loss(amount, forced, required_biotype))
return FALSE
if(amount < 0 && HAS_TRAIT(src, TRAIT_NO_HEALS))
if(!forced && amount < 0 && HAS_TRAIT(src, TRAIT_NO_HEALS)) //monkestation edit
return FALSE
if(!forced && (status_flags & GODMODE))
return FALSE
Expand Down
16 changes: 6 additions & 10 deletions monkestation/code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
///The static info we use so we only have to actually update our data once each tick
var/static/static_desc


/atom/movable/screen/alert/clockwork/clocksense/Initialize(mapload)
. = ..()
if(!static_desc)
static_desc = get_static_desc()
desc = static_desc
START_PROCESSING(SSprocessing, src)
if(!GLOB.ratvar_risen)
START_PROCESSING(SSprocessing, src)

/atom/movable/screen/alert/clockwork/clocksense/Destroy()
STOP_PROCESSING(SSprocessing, src)
Expand Down Expand Up @@ -47,18 +47,14 @@
new_desc += "The Ark will open in [600 - GLOB.clock_ark.charging_for] seconds!<br>"
return //we dont care about anchoring crystals at this point

var/datum/objective/anchoring_crystals/crystals_objective = locate() in GLOB.main_clock_cult.objectives
if(!crystals_objective)
return

var/static/list/cached_valid_areas
if(length(cached_valid_areas) != length(crystals_objective.valid_areas)) //using length due to the cache being area names and not areas themselves
if(length(cached_valid_areas) != length(SSthe_ark.valid_crystal_areas)) //using length due to the cache being area names and not areas themselves
cached_valid_areas = list()
for(var/area/added_area in crystals_objective.valid_areas)
cached_valid_areas += added_area.get_original_area_name()
for(var/area/added_area in SSthe_ark.valid_crystal_areas)
cached_valid_areas += SSthe_ark.valid_crystal_areas[added_area]
new_desc += "Anchoring Crystals can be summoned in [english_list(cached_valid_areas)].<br>"

var/crystal_diff = ANCHORING_CRYSTALS_TO_SUMMON - length(GLOB.anchoring_crystals)
var/crystal_diff = ANCHORING_CRYSTALS_TO_SUMMON - length(SSthe_ark.anchoring_crystals)
if(crystal_diff > 0)
new_desc += "We must summon [crystal_diff] more Anchoring Crystal[crystal_diff > 1 ? "s" : ""] before the ark may open.<br>"
return new_desc
Expand Down
3 changes: 3 additions & 0 deletions monkestation/code/controllers/subsystem/shuttle.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/controller/subsystem/shuttle
///Are we disabled due to admins
var/admin_emergency_disabled = FALSE
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
/datum/status_effect/clock_warp_sickness
alert_type = /atom/movable/screen/alert/status_effect/clock_warp_sickness

/datum/status_effect/clock_warp_sickness/on_creation(mob/living/new_owner, _duration = 1 SECOND)
duration = _duration
return ..()

/datum/status_effect/clock_warp_sickness/on_apply()
. = ..()
owner.add_actionspeed_modifier(/datum/actionspeed_modifier/clock_warp_sickness)
owner.add_movespeed_modifier(/datum/movespeed_modifier/clock_warp_sickness)
owner.adjust_confusion(duration)
owner.adjust_dizzy(duration)
owner.add_client_colour(/datum/client_colour/clock_warp)

/datum/status_effect/clock_warp_sickness/on_remove()
. = ..()
owner.remove_actionspeed_modifier(/datum/actionspeed_modifier/clock_warp_sickness)
owner.remove_movespeed_modifier(/datum/movespeed_modifier/clock_warp_sickness)
owner.remove_client_colour(/datum/client_colour/clock_warp)

/atom/movable/screen/alert/status_effect/clock_warp_sickness
name = "Warp Sickness"
desc = "You are disoriented from recently teleporting."
icon = 'monkestation/icons/mob/clock_cult/actions_clock.dmi'
icon_state = "warp_down"
alerttooltipstyle = "clockwork"

/datum/movespeed_modifier/clock_warp_sickness
multiplicative_slowdown = 1

/datum/actionspeed_modifier/clock_warp_sickness
multiplicative_slowdown = 0.6

/datum/client_colour/clock_warp
colour = LIGHT_COLOR_CLOCKWORK
priority = 2
fade_out = 5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
///How much do we subtract from the base cose of adding a new area
#define AREAS_TO_IGNORE_FOR_COST 10
///How many areas are observation consoles able to warp to at the start
#define STARTING_WARP_AREAS 8
///how much vitality does each already marked area increase the cost by
#define COST_PER_AREA 4

/datum/action/innate/clockcult/add_warp_area
name = "Add Warp Area"
Expand Down Expand Up @@ -32,7 +32,7 @@
if(!input_area)
return

var/cost = max((length(GLOB.clock_warp_areas) * 3) - (STARTING_WARP_AREAS * 3), 0)
var/cost = max((length(GLOB.clock_warp_areas) * COST_PER_AREA) - (STARTING_WARP_AREAS * COST_PER_AREA), 0)
if(is_type_in_typecache(input_area.type, costly_areas))
cost *= 2

Expand Down Expand Up @@ -90,5 +90,4 @@
to_chat(owner, examine_block(span_brass("Current areas observation consoles can warp to: [english_list(GLOB.clock_warp_areas)] <br/>\
You can add additional areas with the \"Add Warp Area\" action."))) //anyone who has this action should also have add warp area

#undef AREAS_TO_IGNORE_FOR_COST
#undef STARTING_WARP_AREAS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GLOBAL_DATUM(main_clock_cult, /datum/team/clock_cult)

//this is effectively 2 higher due to the first anchoring crystal always allowing 2 more servants
#define DEFAULT_MAX_HUMAN_SERVANTS 10
#define DEFAULT_MAX_HUMAN_SERVANTS 8
#define CONVERSION_WARNING_NONE 0
#define CONVERSION_WARNING_HALFWAY 1
#define CONVERSION_WARNING_THREEQUARTERS 2
Expand Down Expand Up @@ -72,7 +72,7 @@ GLOBAL_DATUM(main_clock_cult, /datum/team/clock_cult)
max_human_servants = round(max((get_active_player_count() / 8), max_human_servants))
var/human_servant_count = length(human_servants)
var/main_message = "The Ark will be torn open if [max_human_servants - human_servant_count] more minds are converted to the faith of Rat'var\
[get_charged_anchor_crystals() >= ANCHORING_CRYSTALS_TO_SUMMON ? "." : " and \
[SSthe_ark.charged_anchoring_crystals >= ANCHORING_CRYSTALS_TO_SUMMON ? "." : " and \
[ANCHORING_CRYSTALS_TO_SUMMON] Anchoring Crystal[ANCHORING_CRYSTALS_TO_SUMMON > 1 ? "s are" : " is"] summoned and protected on the station."]"

if((human_servant_count * 2) > max_human_servants && warning_stage < CONVERSION_WARNING_HALFWAY)
Expand All @@ -84,13 +84,13 @@ GLOBAL_DATUM(main_clock_cult, /datum/team/clock_cult)
sent_sound = 'sound/magic/clockwork/scripture_tier_up.ogg')
warning_stage = CONVERSION_WARNING_THREEQUARTERS

else if((human_servant_count == max_human_servants - 1) && warning_stage < CONVERSION_WARNING_CRITIAL && get_charged_anchor_crystals() >= 2)
else if((human_servant_count == max_human_servants - 1) && warning_stage < CONVERSION_WARNING_CRITIAL && SSthe_ark.charged_anchoring_crystals >= ANCHORING_CRYSTALS_TO_SUMMON)
send_clock_message(span_bigbrass("The internal cogs of the Ark begin spinning, ready for activation.<br> \
Upon the next conversion, the dimensional barrier will become too weak for The Ark to remain closed and it will be forced open."), \
sent_sound = 'sound/magic/clockwork/scripture_tier_up.ogg')
warning_stage = CONVERSION_WARNING_CRITIAL

else if((human_servant_count >= max_human_servants) && get_charged_anchor_crystals() >= ANCHORING_CRYSTALS_TO_SUMMON)
else if((human_servant_count >= max_human_servants) && SSthe_ark.charged_anchoring_crystals >= ANCHORING_CRYSTALS_TO_SUMMON)
GLOB.clock_ark?.prepare_ark()

///check that our human_servants and non_human_servants lists are correct and if not then set them to be correct
Expand Down Expand Up @@ -131,27 +131,30 @@ GLOBAL_DATUM(main_clock_cult, /datum/team/clock_cult)

#define POSSIBLE_CRYSTAL_AREAS 6
/datum/objective/anchoring_crystals
var/list/valid_areas = list()

/datum/objective/anchoring_crystals/New()
. = ..()
if(SSthe_ark.valid_crystal_areas)
return

SSthe_ark.valid_crystal_areas = list()
var/sanity = 0
while(length(valid_areas) < POSSIBLE_CRYSTAL_AREAS && sanity < 100)
var/area/summon_area = pick(GLOB.areas - valid_areas)
var/list/areas_copy = GLOB.areas.Copy()
while(length(SSthe_ark.valid_crystal_areas) < POSSIBLE_CRYSTAL_AREAS && sanity < 100)
var/area/summon_area = pick_n_take(areas_copy)
if(summon_area && is_station_level(summon_area.z) && (summon_area.area_flags & VALID_TERRITORY))
valid_areas += summon_area
SSthe_ark.valid_crystal_areas += summon_area
sanity++
update_explanation_text()

/datum/objective/anchoring_crystals/update_explanation_text()
var/plural = ANCHORING_CRYSTALS_TO_SUMMON > 1
explanation_text = "Summon [ANCHORING_CRYSTALS_TO_SUMMON] anchoring crystal[plural ? "s" : ""] on the station and protect [plural ? "them" : "it"] for 5 \
minutes to allow the ark to open. Crystals after the first one must be summoned in [english_list(valid_areas)]. \
minutes to allow the ark to open. Crystals after the first one must be summoned in [english_list(SSthe_ark.valid_crystal_areas)]. \
Up to 2 additional crystals can be created for extra power."

/datum/objective/anchoring_crystals/check_completion()
return get_charged_anchor_crystals() >= ANCHORING_CRYSTALS_TO_SUMMON || completed
return SSthe_ark.charged_anchoring_crystals >= ANCHORING_CRYSTALS_TO_SUMMON || completed

/datum/objective/ratvar
explanation_text = "Protect The Ark so that Rat'var may enlighten this world!"
Expand Down
102 changes: 102 additions & 0 deletions monkestation/code/modules/antagonists/clock_cult/ark_subsystem.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
///A subsystem to manage the global effects of clock cult
//#define SERVANT_CAPACITY_TO_GIVE 2 //how many extra servant slots do we give on first charged crystal
SUBSYSTEM_DEF(the_ark)
name = "The Clockwork Ark"
wait = 1 SECOND
flags = SS_KEEP_TIMING | SS_NO_INIT
runlevels = RUNLEVEL_GAME

///The list of anchoring crystals, value is 0 is uncharged and 1 if charged
var/list/anchoring_crystals
///How many charged anchoring crystals are there
var/charged_anchoring_crystals = 0
///Dimension theme used for transforming turfs
var/datum/dimension_theme/clockwork/clock_dimension_theme
///Assoc list of the original names of areas that are valid to summon anchoring crystals keyed to its area
var/list/valid_crystal_areas
///The pool of hallucinations we can trigger
var/list/hallucination_pool

/datum/controller/subsystem/the_ark/Initialize()
anchoring_crystals = list()
clock_dimension_theme = new(is_cult = TRUE)
hallucination_pool = list(
/datum/hallucination/fake_item/clockwork_slab = 2,
/datum/hallucination/nearby_fake_item/clockwork_slab = 2,
/datum/hallucination/hazard/clockwork_skewer = 1,
/datum/hallucination/delusion/preset/clock_cultists = 1,
/datum/hallucination/fake_sound/weird/clockcult_kindle = 2,
/datum/hallucination/fake_sound/weird/clockcult_warp = 2,
)
initialized = TRUE

/datum/controller/subsystem/the_ark/fire(resumed)
if(charged_anchoring_crystals)
handle_charged_crystals()

/datum/controller/subsystem/the_ark/proc/handle_charged_crystals()
if(prob(charged_anchoring_crystals))
var/mob/living/selected_player = pick(GLOB.alive_player_list)
if(prob(50))
selected_player.cause_hallucination(pick_weight(hallucination_pool), "The Clockwork Ark")
else
to_chat(selected_player, span_notice(pick(list("You hear a faint ticking in the back of your mind", "You smell something metallic", \
"You see a flash of light out of the corner of your eye", "You feel an otherworldly presence", "You feel like your forgetting something"))))

if(charged_anchoring_crystals >= 2)
return

/datum/controller/subsystem/the_ark/proc/on_crystal_charged(obj/structure/destructible/clockwork/anchoring_crystal/charged_crystal)
charged_anchoring_crystals++
anchoring_crystals[charged_crystal] = 1
SEND_SIGNAL(src, COMSIG_ANCHORING_CRYSTAL_CHARGED, charged_crystal)
var/datum/scripture/create_structure/anchoring_crystal/crystal_script
addtimer(CALLBACK(src, PROC_REF(clear_shuttle_interference), charged_crystal), \
(ANCHORING_CRYSTAL_COOLDOWN - (ANCHORING_CRYSTAL_CHARGE_DURATION SECONDS)) + initial(crystal_script.invocation_time))

/*if(1) //add 2 more max servants and increase replica fabricator build speed
GLOB.main_clock_cult.max_human_servants += SERVANT_CAPACITY_TO_GIVE*/
if(charged_anchoring_crystals == ANCHORING_CRYSTALS_TO_SUMMON + 1) //create a steam helios on reebe
if(length(GLOB.abscond_markers))
var/turf/created_at = get_turf(pick(GLOB.abscond_markers))
new /obj/vehicle/sealed/mecha/steam_helios(created_at)
new /obj/effect/temp_visual/steam(created_at)
else if(GLOB.clock_ark)
new /obj/vehicle/sealed/mecha/steam_helios(get_turf(GLOB.clock_ark))
else
message_admins("No valid location for Steam Helios creation.")

///fully disables the shuttle similar to the admin verb
/datum/controller/subsystem/the_ark/proc/block_shuttle(datum/blocker)
if(SSshuttle.admin_emergency_disabled || SSshuttle.emergency.mode == SHUTTLE_DISABLED)
return

SSshuttle.last_mode = SSshuttle.emergency.mode
SSshuttle.last_call_time = SSshuttle.emergency.timeLeft(1)
SSshuttle.emergency_no_recall = TRUE
SSshuttle.emergency.setTimer(0)
SSshuttle.emergency.mode = SHUTTLE_DISABLED

///renables the shuttle
/datum/controller/subsystem/the_ark/proc/clear_shuttle_interference(datum/unblocker)
if(SSshuttle.admin_emergency_disabled || SSshuttle.emergency.mode != SHUTTLE_DISABLED || (unblocker && istype(unblocker, /obj/structure/destructible/clockwork/anchoring_crystal)))
return

SSshuttle.emergency_no_recall = FALSE
if(SSshuttle.last_mode == SHUTTLE_DISABLED)
SSshuttle.last_mode = SHUTTLE_IDLE

SSshuttle.emergency.mode = SSshuttle.last_mode
if(SSshuttle.last_call_time < 10 SECONDS && SSshuttle.last_mode != SHUTTLE_IDLE)
SSshuttle.last_call_time = 10 SECONDS //Make sure no insta departures.
SSshuttle.emergency.setTimer(SSshuttle.last_call_time)
priority_announce("Emergency shuttle uplink connection regained.", "Higher Dimensional Affairs", ANNOUNCER_SPANOMALIES, has_important_message = TRUE)

///returns how many charged anchor crystals there are
/datum/controller/subsystem/the_ark/proc/get_charged_anchor_crystals()
var/charged_count = 0
for(var/crystal in SSthe_ark.anchoring_crystals)
charged_count += SSthe_ark.anchoring_crystals[crystal]
return charged_count

//#undef SERVANT_CAPACITY_TO_GIVE
9 changes: 8 additions & 1 deletion monkestation/code/modules/antagonists/clock_cult/helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@
do_sparks(3, TRUE, servant)
do_sparks(3, TRUE, target_turf)
do_teleport(servant, target_turf, 0, no_effects = TRUE, channel = TELEPORT_CHANNEL_CULT, forced = TRUE)
to_chat(servant, "You warp to [get_area(target_turf)].")
if(!IS_CLOCK(servant) || !on_reebe(servant))
servant.apply_status_effect(/datum/status_effect/clock_warp_sickness, 15 SECONDS)

if(ishuman(servant)) //looks weird on non-humanoids
new /obj/effect/temp_visual/ratvar/warp(target_turf)
to_chat(servant, "You warp to [get_area(target_turf)].")

if(istype(pulled))
do_teleport(pulled, target_turf, 0, no_effects = TRUE, channel = TELEPORT_CHANNEL_CULT, forced = TRUE)
if(!IS_CLOCK(pulled))
pulled.Paralyze(3 SECONDS)
to_chat(pulled, span_warning("You feel sick and confused."))
pulled.apply_status_effect(/datum/status_effect/clock_warp_sickness, 15 SECONDS)
else if(!on_reebe(pulled))
pulled.apply_status_effect(/datum/status_effect/clock_warp_sickness, 15 SECONDS)
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
var/calculated_creation_delay = 1
if(on_reebe(user))
calculated_creation_delay = selected_output.reebe_mult
if(!get_charged_anchor_crystals())
if(!SSthe_ark.charged_anchoring_crystals)
calculated_creation_delay += SLOWDOWN_FROM_NO_ANCHOR_CRYSTAL
else if(GLOB.clock_ark?.current_state >= ARK_STATE_ACTIVE)
calculated_creation_delay += (iscogscarab(user) ? 2.5 : 5)
Expand Down
Loading

0 comments on commit c8bc820

Please sign in to comment.