Skip to content

Commit

Permalink
RCorp Escort the Payload Objective (#2120)
Browse files Browse the repository at this point in the history
* payload objective

* update

* for testing

* update
  • Loading branch information
Halonexus authored May 13, 2024
1 parent 773d96b commit 88cd1c7
Show file tree
Hide file tree
Showing 9 changed files with 441 additions and 20 deletions.
42 changes: 39 additions & 3 deletions ModularTegustation/tegu_items/rcorp/objective.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Abnormality Supreme Victory - Win against reinforcements
*/

GLOBAL_VAR_INIT(rcorp_wincondition, 0) //what state the game is in.
GLOBAL_VAR_INIT(rcorp_objective_location, null)
GLOBAL_VAR_INIT(rcorp_abno_objective_location, null)
GLOBAL_VAR_INIT(rcorp_payload, null)
//0 is neutral, 1 favors Rcorp and 2 favors abnos

/obj/effect/landmark/objectivespawn
Expand All @@ -20,6 +23,7 @@ GLOBAL_VAR_INIT(rcorp_wincondition, 0) //what state the game is in.
icon_state = "city_of_cogs"

/obj/effect/landmark/objectivespawn/Initialize()
GLOB.rcorp_objective_location = src
switch(GLOB.rcorp_objective)
if("button")
new /obj/structure/bough(get_turf(src))
Expand All @@ -29,7 +33,11 @@ GLOBAL_VAR_INIT(rcorp_wincondition, 0) //what state the game is in.
if("arbiter")
new /obj/structure/bough(get_turf(src))
addtimer(CALLBACK(src, PROC_REF(arbspawn)), 20 MINUTES)
..()
if("payload_abno")
new /mob/payload(get_turf(src), "abno")
if("payload_rcorp")
new /obj/effect/payload_destination(get_turf(src))
return ..()

/obj/effect/landmark/objectivespawn/proc/reinforce()
minor_announce("R-Corp reinforcements are on the way. Hang on tight, commander." , "R-Corp Intelligence Office")
Expand All @@ -46,6 +54,30 @@ GLOBAL_VAR_INIT(rcorp_wincondition, 0) //what state the game is in.
minor_announce("DANGER - HOSTILE ARBITER IN THE AREA. NEUTRALIZE IMMEDIATELY." , "R-Corp Intelligence Office")
GLOB.rcorp_wincondition = 2

/obj/effect/landmark/abno_objectivespawn
name = "abno objective spawner"
desc = "It spawns the abnormality objective. Notify a coder. Thanks!"
icon = 'icons/effects/landmarks_static.dmi'
icon_state = "city_of_cogs"

/obj/effect/landmark/abno_objectivespawn/Initialize()
GLOB.rcorp_abno_objective_location = src
switch(GLOB.rcorp_objective)
if("payload_rcorp")
new /mob/payload(get_turf(src), "rcorp")
if("payload_abno")
new /obj/effect/payload_destination(get_turf(src))
return ..()

/obj/effect/payload_destination
name = "payload destination"
desc = "Payload really wants to be here"
icon = 'icons/effects/effects.dmi'
icon_state = "launchpad_pull"
anchored = TRUE
layer = ABOVE_MOB_LAYER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT

//Golden Bough Objective
/obj/structure/bough
name = "Golden Bough"
Expand Down Expand Up @@ -194,8 +226,12 @@ GLOBAL_VAR_INIT(rcorp_wincondition, 0) //what state the game is in.
resistance_flags = INDESTRUCTIBLE

/obj/structure/rcorpcomms/Initialize()
..()
addtimer(CALLBACK(src, PROC_REF(vulnerable)), 15 MINUTES)
. = ..()
switch(GLOB.rcorp_objective)
if("payload_rcorp", "payload_abno")
return
else
addtimer(CALLBACK(src, PROC_REF(vulnerable)), 15 MINUTES)

/obj/structure/rcorpcomms/proc/vulnerable()
minor_announce("Warning: The communications shields are now disabled. Communications are now vulnerable" , "R-Corporation Command Update")
Expand Down
20 changes: 10 additions & 10 deletions _maps/RandomRooms/rcorp/caves/pit.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/obj/structure/railing{
dir = 1
},
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"d" = (
/obj/structure/railing{
Expand Down Expand Up @@ -42,7 +42,7 @@
/obj/structure/railing{
dir = 8
},
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"m" = (
/obj/effect/landmark/abnospawn/easycombat,
Expand All @@ -51,7 +51,7 @@
"o" = (
/obj/structure/lattice/catwalk,
/obj/structure/railing/corner,
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"p" = (
/obj/structure/railing{
Expand Down Expand Up @@ -97,7 +97,7 @@
/area/city/outskirts)
"H" = (
/obj/structure/lattice/catwalk,
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"K" = (
/turf/open/chasm,
Expand All @@ -107,40 +107,40 @@
/obj/structure/railing{
dir = 9
},
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"O" = (
/obj/structure/lattice/catwalk,
/obj/structure/railing/corner{
dir = 1
},
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"Q" = (
/obj/structure/lattice/catwalk,
/obj/structure/railing{
dir = 4
},
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"T" = (
/obj/structure/lattice/catwalk,
/obj/structure/railing,
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"X" = (
/obj/structure/lattice/catwalk,
/obj/structure/railing{
dir = 6
},
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)
"Y" = (
/obj/structure/lattice/catwalk,
/obj/structure/railing/corner{
dir = 4
},
/turf/open/chasm,
/turf/open/floor/fakepit,
/area/city/outskirts)

(1,1,1) = {"
Expand Down
6 changes: 5 additions & 1 deletion _maps/map_files/Event/rcorp.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
/obj/machinery/telecomms/server/presets/engineering,
/turf/open/floor/circuit/telecomms/mainframe,
/area/city/outskirts)
"co" = (
/obj/effect/landmark/abno_objectivespawn,
/turf/open/floor/plating/asteroid,
/area/city/outskirts)
"cH" = (
/obj/effect/turf_decal/bot,
/obj/machinery/telecomms/relay/preset/telecomms,
Expand Down Expand Up @@ -5525,7 +5529,7 @@ PG
PG
PG
PG
PG
co
PG
PG
PG
Expand Down
8 changes: 5 additions & 3 deletions code/controllers/subsystem/maptype.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ SUBSYSTEM_DEF(maptype)
if(prob(30))
jobtype = "rcorp_fifth"

switch(rand(1,3))
switch(rand(1,5))
if(1) //Find this var in the objectives folder
GLOB.rcorp_objective = "button"
if(2)
GLOB.rcorp_objective = "vip"
if(3)
GLOB.rcorp_objective = "arbiter"


if(4)
GLOB.rcorp_objective = "payload_rcorp"
if(5)
GLOB.rcorp_objective = "payload_abno"
117 changes: 117 additions & 0 deletions code/datums/reusable_visual_pool.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/datum/reusable_visual_pool
var/list/available_objects
var/list/all_objects
var/available_count = 0

/datum/reusable_visual_pool/New(size = 20)
available_objects = new(size)
all_objects = new(size)
. = ..()
INVOKE_ASYNC(src, PROC_REF(InitializeObjects), size)

/datum/reusable_visual_pool/proc/InitializeObjects(amount)
for(var/i in 1 to amount)
var/obj/effect/reusable_visual/RV = new /obj/effect/reusable_visual(src)
all_objects[i] = RV
++available_count
available_objects[available_count] = RV
stoplag()

/datum/reusable_visual_pool/Destroy()
available_objects.Cut()
QDEL_LIST(all_objects)
return ..()

/datum/reusable_visual_pool/proc/TakePoolElement()
var/obj/effect/reusable_visual/RV
if(available_count < 1)
RV = new /obj/effect/reusable_visual(src)
all_objects += RV
available_objects += null
else
RV = available_objects[available_count]
--available_count
RV.is_being_used = TRUE
RV.invisibility = 0
return RV

/datum/reusable_visual_pool/proc/ReturnToPool(obj/effect/reusable_visual/RV, called_from_timer = FALSE)
if(!istype(RV) || RV.pool != src || !RV.is_being_used)
return FALSE
if(!called_from_timer && RV.timer_id)
deltimer(RV.timer_id)
RV.timer_id = null
RV.is_being_used = FALSE
RV.invisibility = 101
RV.can_be_z_moved = FALSE
RV.alpha = 255
RV.color = null
RV.name = "nothing"
RV.icon = 'icons/effects/effects.dmi'
RV.icon_state = "nothing"
RV.duration = 0
RV.animate_movement = NO_STEPS
RV.set_dir_on_move = FALSE
RV.loc = null
RV.transform = matrix()
RV.dir = SOUTH
RV.plane = GAME_PLANE
RV.layer = ABOVE_MOB_LAYER
animate(RV)
++available_count
available_objects[available_count] = RV
return TRUE

#define SET_RV_RETURN_TIMER(RV, DURATION) ##RV.duration = DURATION; ##RV.timer_id = addtimer(CALLBACK(##RV.pool, TYPE_PROC_REF(/datum/reusable_visual_pool, ReturnToPool), ##RV, TRUE), ##RV.duration, TIMER_STOPPABLE);
//Create procs like these for whatever effects
/datum/reusable_visual_pool/proc/NewSmashEffect(turf/location, duration = 3, color = null)
var/obj/effect/reusable_visual/RV = TakePoolElement()
SET_RV_RETURN_TIMER(RV, duration)
RV.name = "smash"
RV.icon_state = "smash"
RV.color = color
RV.loc = location
return RV

/datum/reusable_visual_pool/proc/NewSparkles(turf/location, duration = 10, color = null)
var/obj/effect/reusable_visual/RV = TakePoolElement()
SET_RV_RETURN_TIMER(RV, duration)
RV.name = "sparkles"
RV.icon = 'icons/effects/effects.dmi'
RV.icon_state = "sparkles"
RV.color = color
RV.dir = pick(GLOB.cardinals)
RV.loc = location
return RV

/datum/reusable_visual_pool/proc/NewCultSparks(turf/location, duration = 10)
var/obj/effect/reusable_visual/RV = TakePoolElement()
SET_RV_RETURN_TIMER(RV, duration)
RV.name = "cult sparks"
RV.icon = 'icons/effects/cult_effects.dmi'
RV.icon_state = "bloodsparkles"
RV.dir = pick(GLOB.cardinals)
RV.loc = location
return RV

/datum/reusable_visual_pool/proc/NewCultIn(turf/location, direction = SOUTH)
var/obj/effect/reusable_visual/RV = TakePoolElement()
SET_RV_RETURN_TIMER(RV, 7)
RV.name = "cult in"
RV.icon = 'icons/effects/cult_effects.dmi'
RV.icon_state = "cultin"
RV.dir = direction
RV.loc = location
return RV

/datum/reusable_visual_pool/proc/NewSmoke(turf/location, duration = 10, color = null)
var/obj/effect/reusable_visual/RV = TakePoolElement()
SET_RV_RETURN_TIMER(RV, duration)
RV.name = "smoke"
RV.icon = 'icons/effects/effects.dmi'
RV.icon_state = "smoke"
RV.color = color
RV.dir = pick(GLOB.cardinals)
RV.loc = location
animate(RV, alpha = 0, time = duration)
return RV
39 changes: 36 additions & 3 deletions code/game/gamemodes/management/event/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,22 @@ GLOBAL_VAR_INIT(wcorp_enemy_faction, "") //decides which faction WCorp will be u

//R-Corp stuff.
if("rcorp")
addtimer(CALLBACK(src, PROC_REF(drawround)), 40 MINUTES)
to_chat(world, span_userdanger("Round will end in a draw after 40 minutes.</span>"))
switch(GLOB.rcorp_objective)
if("payload_abno")
addtimer(CALLBACK(src, PROC_REF(endroundRcorp), "Abnormalities have failed to escort the specimen to the destination."), 40 MINUTES)
to_chat(world, span_userdanger("Round will end in an R-Corp victory after 40 minutes."))
var/start_delay = 6 MINUTES
addtimer(CALLBACK(src, PROC_REF(StartPayload)), start_delay)
PayloadFindPath(start_delay)
if("payload_rcorp")
addtimer(CALLBACK(src, PROC_REF(endroundRcorp), "Rcorp has failed to destroy the mission objective."), 40 MINUTES)
to_chat(world, span_userdanger("Round will end in an abnormality victory after 40 minutes."))
var/start_delay = 3 MINUTES
addtimer(CALLBACK(src, PROC_REF(StartPayload)), start_delay)
PayloadFindPath(start_delay)
else
addtimer(CALLBACK(src, PROC_REF(drawround)), 40 MINUTES)
to_chat(world, span_userdanger("Round will end in a draw after 40 minutes."))
addtimer(CALLBACK(src, PROC_REF(rcorp_announce)), 3 MINUTES)

//Limbus Labs
Expand Down Expand Up @@ -78,6 +92,10 @@ GLOBAL_VAR_INIT(wcorp_enemy_faction, "") //decides which faction WCorp will be u
SSticker.force_ending = 1
to_chat(world, span_userdanger("Shift has ended."))

/datum/game_mode/combat/proc/endroundRcorp(text)
SSticker.force_ending = 1
to_chat(world, span_userdanger(text))

/datum/game_mode/combat/proc/roundendwarning()
switch (SSmaptype.maptype)
if("limbus_labs")
Expand All @@ -104,6 +122,21 @@ GLOBAL_VAR_INIT(wcorp_enemy_faction, "") //decides which faction WCorp will be u
announcement_type = "Intelligence has located a golden bough in the vicinity. You are to collect it and wipe all resistance."
if("vip")
announcement_type = "Intelligence has located a highly intelligent target in the vicinity. Destroy it at all costs."
if("payload_rcorp")
announcement_type = "Intelligence has located an entrance to a former L corp facility. Detonate the charge to bury it and prevent further specimens from escaping."
if("payload_abno")
announcement_type = "Intelligence has located a dangerous specimen moving towards your location. Prevent it from escaping at all costs."
minor_announce("[announcement_type]" , "R-Corp Intelligence Office")


/datum/game_mode/combat/proc/StartPayload()
if(!GLOB.rcorp_payload)
CRASH("No payload somehow")
var/mob/payload/P = GLOB.rcorp_payload
P.ready_to_move = TRUE

/datum/game_mode/combat/proc/PayloadFindPath(delay)
var/mob/payload/P = GLOB.rcorp_payload
if(!P)
CRASH("No payload somehow, possibly no landmark")
P.start_delay = delay
P.GetPath()
Loading

0 comments on commit 88cd1c7

Please sign in to comment.