Skip to content

Commit

Permalink
missions and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Oct 13, 2024
1 parent 0d7c46e commit bcc7714
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 54 deletions.
1 change: 1 addition & 0 deletions _maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -7415,6 +7415,7 @@
/area/overmap_encounter/planetoid/jungle/explored)
"YA" = (
/obj/machinery/blackbox_recorder,
/obj/effect/landmark/mission_poi/main/blackbox,
/turf/open/floor/mineral/plastitanium/red,
/area/ruin/jungle/starport/tower)
"YC" = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
/obj/effect/turf_decal/siding/thinplating/dark{
dir = 4
},
/obj/effect/landmark/mission_poi/main/blackbox,
/turf/open/floor/plasteel/dark,
/area/ruin/unpowered/listening_post/operations)
"db" = (
Expand Down
6 changes: 2 additions & 4 deletions _maps/RandomRuins/SpaceRuins/power_puzzle.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@
/obj/structure/chair/office{
dir = 8
},
/obj/machinery/firealarm/directional/north,
/obj/machinery/firealarm/directional/east,
/turf/open/floor/plasteel,
/area/ruin/space/has_grav/powerpuzzle/secure)
"jy" = (
Expand Down Expand Up @@ -3506,9 +3506,7 @@
/turf/open/floor/plasteel/dark,
/area/ruin/space/has_grav/powerpuzzle/secure)
"UV" = (
/obj/structure/salvageable/computer{
dir = 1
},
/obj/effect/landmark/mission_poi/main,
/obj/machinery/door/poddoor/shutters{
id = "vaultshutters2"
},
Expand Down
1 change: 1 addition & 0 deletions code/datums/ruins/jungle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
description = "A bombed out airbase from the ICW, taken back over by nature"
suffix = "jungle_bombed_starport.dmm"
ruin_tags = list(RUIN_TAG_MEDIUM_COMBAT, RUIN_TAG_MAJOR_LOOT, RUIN_TAG_HAZARDOUS, RUIN_TAG_LIVEABLE)
dynamic_mission_types = list(/datum/mission/dynamic/blackbox)

/datum/map_template/ruin/jungle/medtech
name = "MedTech facility"
Expand Down
1 change: 1 addition & 0 deletions code/datums/ruins/lavaland.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
id = "abandonedlistening"
description = "An abandoned Cybersun listening post. Seems like the Ramzi Clique has an interest in the site."
suffix = "lavaland_abandonedlisteningpost.dmm"
dynamic_mission_types = list(/datum/mission/dynamic/blackbox)
1 change: 1 addition & 0 deletions code/datums/ruins/space.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
description = "an abandoned secure storage location. there is no power left in the batteries and the former ocupants locked it pretty tight before leaving.\
You will have to power areas to raise the bolts on the doors. look out for secrets."
ruin_tags = list(RUIN_TAG_MINOR_COMBAT, RUIN_TAG_MAJOR_LOOT, RUIN_TAG_SHELTER, RUIN_TAG_HAZARDOUS)
dynamic_mission_types = list(/datum/mission/dynamic/data_reterival)

/datum/map_template/ruin/space/astraeus
id = "astraeus"
Expand Down
39 changes: 0 additions & 39 deletions code/modules/awaymissions/mission_code/undergroundoutpost45.dm

This file was deleted.

7 changes: 4 additions & 3 deletions code/modules/dynamic_missions/mission.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var/duration /// The amount of time in which to complete the mission. Setting it to 0 will result in no time limit
var/weight = 0 /// The relative probability of this mission being selected. 0-weight missions are never selected.

///Only needed if you have multipe missiosn that use the same poi's on the map
///Only needed if you have multipe missiosn that use the same poi's on the map. Set at new.
var/mission_index

var/location_specific = TRUE
Expand All @@ -31,9 +31,10 @@
/// is a callback to be invoked upon the atom's qdeletion.
var/list/atom/movable/bound_atoms

/datum/mission/New(_location)
/datum/mission/New(location, mission_index)
//source_outpost = _outpost
mission_location = _location
src.mission_location = location
src.mission_index = mission_index
SSmissions.inactive_missions += list(src)
//RegisterSignal(source_outpost, COMSIG_PARENT_QDELETING, PROC_REF(on_vital_delete))
RegisterSignal(mission_location, COMSIG_PARENT_QDELETING, PROC_REF(on_vital_delete))
Expand Down
39 changes: 34 additions & 5 deletions code/modules/dynamic_missions/missions/dynamic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,31 @@

/datum/mission/dynamic/spawn_mission_setpiece(datum/overmap/dynamic/planet)
for(var/obj/effect/landmark/mission_poi/mission_poi in planet.spawned_mission_pois)
if(mission_poi.type == setpiece_poi)
if(!isnull(mission_poi.mission_index) && (mission_index != mission_poi.mission_index))
continue
if(istype(mission_poi, setpiece_poi))
//Spawns the item or gets it via use_poi then sets it as bound so the mission fails if its deleted
spawn_main_piece(planet, mission_poi)
return
CRASH("[src] was unable to find its required landmark")
break

spawn_custom_pois(planet)

// Reiterate through the loop and attemp to spawn any mission that matches our index but dont pass any type so it will need its own
for(var/obj/effect/landmark/mission_poi/mission_poi in planet.spawned_mission_pois)
if(isnull(mission_poi.mission_index) || (mission_index != mission_poi.mission_index))
continue
mission_poi.use_poi()

if(!isatom(setpiece_item))
CRASH("[src] was unable to find its required landmark")

/datum/mission/dynamic/proc/spawn_main_piece(datum/overmap/dynamic/planet, obj/effect/landmark/mission_poi/mission_poi)
required_item = set_bound(mission_poi.use_poi(setpiece_item), mission_poi.loc, null, TRUE, TRUE)

/// For handling logic outside of main piece thats too complex for the basic reiteration or you want to not require indexs to match.
/datum/mission/dynamic/proc/spawn_custom_pois(datum/overmap/dynamic/planet)
return

/datum/mission/dynamic/can_turn_in(atom/movable/item_to_check)
if(istype(required_item))
if(specific_item)
Expand All @@ -31,14 +47,27 @@

/datum/mission/dynamic/data_reterival
name = "data recovery"
///Assumes its a list
setpiece_item = list(
/obj/item/blackbox,
/obj/item/research_notes/loot
/obj/item/research_notes/loot,
/obj/item/documents
)

/datum/mission/dynamic/data_reterival/generate_mission_details()
. = ..()
if(ispath(setpiece_item, /obj/item))
var/obj/item/mission_item = setpiece_item
desc = "We are looking for a [mission_item::name]"

/obj/effect/landmark/mission_poi/main/blackbox
icon_state = "main_blackbox"
already_spawned = TRUE

/obj/effect/landmark/mission_poi/main/blackbox/use_poi(_type_to_spawn)
var/obj/machinery/blackbox_recorder/recorder = ..()
if(istype(recorder, /obj/machinery/blackbox_recorder))
if(istype(recorder.stored, /obj/item/blackbox))
return recorder.stored

/datum/mission/dynamic/blackbox
setpiece_item = /obj/machinery/blackbox_recorder
4 changes: 3 additions & 1 deletion code/modules/dynamic_missions/missions/kill.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner,
/mob/living/simple_animal/hostile/megafauna/claw,
)
. = ..()

/datum/mission/dynamic/kill/elite

Expand All @@ -54,5 +55,6 @@
/mob/living/simple_animal/hostile/asteroid/elite/broodmother,
/mob/living/simple_animal/hostile/asteroid/elite/herald,
/mob/living/simple_animal/hostile/asteroid/elite/legionnaire,
/mob/living/simple_animal/hostile/asteroid/elite/pandora
/mob/living/simple_animal/hostile/asteroid/elite/pandora,
)
. = ..()
17 changes: 17 additions & 0 deletions code/modules/dynamic_missions/missions/signaled.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/datum/mission/dynamic/signaled
var/registered_type
var/atom/movable/registered_item
/// What signal will spawn the required item
var/mission_main_signal

/datum/mission/dynamic/signaled/spawn_main_piece(obj/effect/landmark/mission_poi/mission_poi)
var/registered_item = set_bound(mission_poi.use_poi(registered_type), null, FALSE, TRUE)
RegisterSignal(registered_item, mission_main_signal, PROC_REF(on_signaled))

/datum/mission/dynamic/signaled/proc/on_signaled(atom/movable/registered_item)
SIGNAL_HANDLER

required_item = new setpiece_item(registered_item.loc)
set_bound(required_item, null, FALSE, TRUE)
UnregisterSignal(registered_item, mission_main_signal)
remove_bound(registered_item)
2 changes: 1 addition & 1 deletion code/modules/overmap/objects/dynamic_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
var/datum/map_template/ruin/used_ruin = ispath(selected_ruin) ? (new selected_ruin()) : selected_ruin
if(istype(used_ruin))
for(var/mission_type in used_ruin.dynamic_mission_types)
dynamic_missions += new mission_type(src)
dynamic_missions += new mission_type(src, 1 + length(dynamic_missions))

if(vlevel_height >= 255 && vlevel_width >= 255) //little easter egg
planet_name = "LV-[pick(rand(11111,99999))]"
Expand Down
2 changes: 1 addition & 1 deletion shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,6 @@
#include "code\modules\awaymissions\mission_code\research.dm"
#include "code\modules\awaymissions\mission_code\snowdin.dm"
#include "code\modules\awaymissions\mission_code\spacebattle.dm"
#include "code\modules\awaymissions\mission_code\undergroundoutpost45.dm"
#include "code\modules\balloon_alert\balloon_alert.dm"
#include "code\modules\buildmode\bm_mode.dm"
#include "code\modules\buildmode\buildmode.dm"
Expand Down Expand Up @@ -2061,6 +2060,7 @@
#include "code\modules\dynamic_missions\missions\dynamic.dm"
#include "code\modules\dynamic_missions\missions\guarded.dm"
#include "code\modules\dynamic_missions\missions\kill.dm"
#include "code\modules\dynamic_missions\missions\signaled.dm"
#include "code\modules\economy\_economy.dm"
#include "code\modules\economy\account.dm"
#include "code\modules\economy\pay_stand.dm"
Expand Down

0 comments on commit bcc7714

Please sign in to comment.