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

Traitors 2.0: Priority directives #10745

Closed
Closed
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
15ced36
Directive framework
PowerfulBacon Mar 12, 2024
f672e58
Directives
PowerfulBacon Mar 12, 2024
22bd6f7
stuff
PowerfulBacon Mar 12, 2024
eb6915a
Update Uplink.js
PowerfulBacon Mar 12, 2024
e54d4ee
Wraps it all together
PowerfulBacon Mar 12, 2024
fbcf141
Merge branch 'priority-directives' of https://github.com/PowerfulBaco…
PowerfulBacon Mar 12, 2024
94bb2d5
Resizable radar component
PowerfulBacon Mar 13, 2024
97cc819
Completes the UI with a ringing notification bell
PowerfulBacon Mar 13, 2024
ba85b19
Updates directives to work with uplinks instead of antag datums
PowerfulBacon Mar 13, 2024
d82a58d
A bit of morning integration coding
PowerfulBacon Mar 14, 2024
3b0afb9
Steal objectives can now be tracked
PowerfulBacon Mar 14, 2024
b6c4179
Live objective tracking
PowerfulBacon Mar 14, 2024
e82058e
Completes secure deaddrop
PowerfulBacon Mar 14, 2024
397c077
Update secure_deaddrop.dm
PowerfulBacon Mar 14, 2024
2d45631
Moves the uplink styling sheets to the correct place
PowerfulBacon Mar 14, 2024
6a6b45e
Executes TGUI prettier.
PowerfulBacon Mar 14, 2024
ec48143
Update tgui/packages/tgui/interfaces/Uplink.js
PowerfulBacon Mar 14, 2024
d819134
Uses SSticker.minds instead of looping through mobs
PowerfulBacon Mar 15, 2024
7cefd47
Make things in different orbital locations not trackable entirely
PowerfulBacon Mar 15, 2024
c0a7f2b
Clearly indicates internal function vs public ones, renames activate(…
PowerfulBacon Mar 15, 2024
fc2f357
Start of the beacon objective
PowerfulBacon Mar 15, 2024
5fda2f0
Play a sound when the box unlocks
PowerfulBacon Mar 15, 2024
86eab2f
Adds in a notification when a new directive comes in
PowerfulBacon Mar 15, 2024
eb60dad
Traitors lose 5 TC
PowerfulBacon Mar 15, 2024
f87e1d3
Fixes review
PowerfulBacon Mar 15, 2024
0fef14e
Adds the beacon calibration UI
PowerfulBacon Mar 15, 2024
f6db5e0
Stuff
PowerfulBacon Mar 15, 2024
f337ce1
A few more beacon things
PowerfulBacon Mar 16, 2024
5937fef
Completes the beacon deployment
PowerfulBacon Mar 20, 2024
d9d17b7
Removes some debug code
PowerfulBacon Mar 20, 2024
cef507a
Fixes late joining traitors
PowerfulBacon Mar 20, 2024
626760b
Pretty TGUI
PowerfulBacon Mar 20, 2024
8e5a90f
Repeat directives, fixes directive spawning
PowerfulBacon Mar 20, 2024
3a26e31
Stupid prettier again
PowerfulBacon Mar 20, 2024
fc0ff96
Anchors the beacon
PowerfulBacon Mar 21, 2024
6ee4f9f
Makes the deaddrop box big, makes the priority directive messages fol…
PowerfulBacon Mar 22, 2024
ff60ffe
Runtime fix
PowerfulBacon Mar 22, 2024
0731a15
Fixes traitors starting with too much TC
PowerfulBacon Mar 22, 2024
f61e035
Makes it so that the beacon objective will not timeout
PowerfulBacon Mar 22, 2024
141d749
Makes it more clear when you are losing
PowerfulBacon Mar 22, 2024
3d0b692
Fixes some compilation issues
PowerfulBacon Mar 22, 2024
d8ad703
Bug fixes
PowerfulBacon Mar 22, 2024
3bd6c61
Beacon explodes again
PowerfulBacon Mar 22, 2024
ee6f790
Some uplink improvements
PowerfulBacon Mar 26, 2024
da3594a
Merge branch 'master' into priority-directives
PowerfulBacon Mar 28, 2024
671efd6
Rank Cards
PowerfulBacon Mar 30, 2024
b06371f
ig this is iron now
PowerfulBacon Mar 30, 2024
1399e36
Career homepage
PowerfulBacon Mar 30, 2024
f92d4d7
Backend reputation and a host of balancing changes to the uplink
PowerfulBacon Mar 31, 2024
b06f5bc
Adds in ranks and reputation
PowerfulBacon Mar 31, 2024
48a2374
Ties reputation to directives
PowerfulBacon Apr 8, 2024
39f0752
Compilation issue
PowerfulBacon Apr 8, 2024
042cc03
Fixes victory not working
PowerfulBacon Apr 8, 2024
cb8e5a5
Stops bags from spawning under objects
PowerfulBacon Apr 8, 2024
af4b579
Update beacon.dm
PowerfulBacon Apr 8, 2024
6508273
Protect from nulls in ui_itneract
PowerfulBacon Apr 8, 2024
02a9ac9
Display reputation and fix nukies
PowerfulBacon Apr 11, 2024
b21b4a4
Revert DB config
PowerfulBacon Apr 11, 2024
932cbbd
Runs TGUI uglify
PowerfulBacon Apr 11, 2024
b970c8d
Fixes this being wrong
PowerfulBacon Apr 11, 2024
80ff3e2
Fixes TC amounts being given away, makes beacons appear more often
PowerfulBacon Apr 12, 2024
06aa32e
Further decreases TC amounts gained
PowerfulBacon Apr 13, 2024
ff2f1c2
Delays the first directive a bit
PowerfulBacon Apr 13, 2024
39c8b2c
Merge remote-tracking branch 'upstream/master' into priority-directives
PowerfulBacon May 14, 2024
f1644b3
Update priority_directive.dm
PowerfulBacon May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
#include "code\__HELPERS\string_lists.dm"
#include "code\__HELPERS\text.dm"
#include "code\__HELPERS\time.dm"
#include "code\__HELPERS\tuples.dm"
#include "code\__HELPERS\turfs.dm"
#include "code\__HELPERS\type2type.dm"
#include "code\__HELPERS\type_processing.dm"
Expand Down Expand Up @@ -443,6 +444,7 @@
#include "code\controllers\subsystem\pathfinder.dm"
#include "code\controllers\subsystem\persistence.dm"
#include "code\controllers\subsystem\preferences.dm"
#include "code\controllers\subsystem\priority_directives.dm"
#include "code\controllers\subsystem\profiler.dm"
#include "code\controllers\subsystem\radiation.dm"
#include "code\controllers\subsystem\radio.dm"
Expand Down Expand Up @@ -685,6 +687,7 @@
#include "code\datums\components\team_monitor.dm"
#include "code\datums\components\tether.dm"
#include "code\datums\components\thermite.dm"
#include "code\datums\components\trackable.dm"
#include "code\datums\components\twohanded.dm"
#include "code\datums\components\udder.dm"
#include "code\datums\components\uplink.dm"
Expand Down Expand Up @@ -2125,6 +2128,11 @@
#include "code\modules\antagonists\traitor\backstory\traitor_backstory_ui.dm"
#include "code\modules\antagonists\traitor\backstory\traitor_datum_backstory.dm"
#include "code\modules\antagonists\traitor\backstory\traitor_factions.dm"
#include "code\modules\antagonists\traitor\directives\priority_directive.dm"
#include "code\modules\antagonists\traitor\directives\deploy_beacon\beacon.dm"
#include "code\modules\antagonists\traitor\directives\deploy_beacon\deploy_beacon.dm"
#include "code\modules\antagonists\traitor\directives\secure_deaddrop\deaddrop_box.dm"
#include "code\modules\antagonists\traitor\directives\secure_deaddrop\secure_deaddrop.dm"
#include "code\modules\antagonists\traitor\equipment\contractor.dm"
#include "code\modules\antagonists\traitor\equipment\Malf_Modules.dm"
#include "code\modules\antagonists\traitor\IAA\internal_affairs.dm"
Expand Down
32 changes: 29 additions & 3 deletions code/__DEFINES/antagonists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,39 @@
#define BLOB_REROLL_COST 40

/// How many telecrystals a normal traitor starts with
#define TELECRYSTALS_DEFAULT 20
#define TELECRYSTALS_DEFAULT 15
/// How many telecrystals mapper/admin only "precharged" uplink implant
#define TELECRYSTALS_PRELOADED_IMPLANT 10
/// The normal cost of an uplink implant; used for calcuating how many
/// The cost of a roundstart uplink implant; used for calcuating how many
/// TC to charge someone if they get a free implant through choice or
/// because they have nothing else that supports an implant.
#define UPLINK_IMPLANT_TELECRYSTAL_COST 3
#define UPLINK_IMPLANT_TELECRYSTAL_COST 1

/// Traitor reputation levels

/// Ex-communicated
#define REPUTATION_EXCOMMUNICATED 0
/// Blood brother level: Untrusted
#define REPUTATION_LOW 100
/// Standard traitor level
#define REPUTATION_STANDARD 200
/// Good reputation, additional gear
#define REPUTATION_GOOD 400
/// Excellent reputation, more murderboney stuff
#define REPUTATION_EXCELLENT 600
/// Elite reputation, access to rare and unique items.
/// Nuclear operative level
#define REPUTATION_ELITE 800
/// Access to anything your heart could ever desire
#define REPUTATION_MAX 1000

/// How much reputation is gained per completed directive
#define REPUTATION_GAIN_PER_DIRECTIVE 200

/// How much reputation you lose for failing a solo directive
#define REPUTATION_LOSS_SOLO_DIRECTIVE 50
/// How much reputation you lose for failing a team-directive
#define REPUTATION_LOSS_TEAM_DIRECTIVE 100

///Checks if given mob is a hive host
#define IS_HIVEHOST(mob) (mob.mind?.has_antag_datum(/datum/antagonist/hivemind))
Expand Down
21 changes: 21 additions & 0 deletions code/__HELPERS/tuples.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Tuple types are basic types that hold data.
* It is a shorthand for creating basic types.
* This can be simplified with pointers.
*/

#define NAMED_TUPLE_1(NAME, TYPE_1, NAME_1) /datum/##NAME {\
##TYPE_1/##NAME_1;\
}\
/datum/##NAME/New(...) {\
src.##NAME_1 = args[1];\
}

#define NAMED_TUPLE_2(NAME, TYPE_1, NAME_1, TYPE_2, NAME_2) /datum/##NAME {\
##TYPE_1/##NAME_1;\
##TYPE_2/##NAME_2;\
}\
/datum/##NAME/New(...) {\
src.##NAME_1 = args[1];\
src.##NAME_2 = args[2];\
}
113 changes: 113 additions & 0 deletions code/controllers/subsystem/priority_directives.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
SUBSYSTEM_DEF(directives)
name = "Priority Directives"
wait = 10 SECONDS
EvilDragonfiend marked this conversation as resolved.
Show resolved Hide resolved
var/datum/priority_directive/active_directive = null
var/next_directive_time
var/list/directives = list()

/datum/controller/subsystem/directives/Initialize(start_timeofday)
. = ..()
next_directive_time = world.time + rand(10 MINUTES, 15 MINUTES)
for (var/directive_type in subtypesof(/datum/priority_directive))
directives += new directive_type()

/datum/controller/subsystem/directives/fire(resumed)
if (active_directive)
// Are we completed or ended?
if (active_directive.is_completed() || active_directive.is_timed_out())
active_directive.finish()
return
// Check if we are ready to spawn our next active_directive
if (world.time < next_directive_time)
return
// Find all the minds
var/list/player_minds = list()
for (var/datum/mind/player_mind in SSticker.minds)
if (!ishuman(player_mind.current) || !is_station_level(player_mind.current.z))
continue
player_minds += player_mind
// Bring on the mission
var/list/valid_directives = list()
for (var/datum/priority_directive/directive in directives)
if (!directive.can_run(GLOB.uplinks, player_minds))
continue
valid_directives += directive
if (!length(valid_directives))
// Try again in a minute
next_directive_time = world.time + 1 MINUTES
return
var/datum/priority_directive/selected = pick(valid_directives)
selected.start(GLOB.uplinks, player_minds)
next_directive_time = INFINITY
active_directive = selected

/*
/client/verb/force_directive()
set name = "force directive"
set category = "powerfulbacon"
if (SSdirectives.active_directive)
message_admins("not yet")
return
// Find all the minds
var/list/player_minds = list()
for (var/mob/player in GLOB.alive_mob_list)
if (!ishuman(player) || !is_station_level(player.z) || !player.mind)
continue
player_minds += player.mind
var/datum/priority_directive/selected = input(src, "What do you want?", "What do you want?") as null|anything in SSdirectives.directives
if (!selected)
return
selected.can_run(GLOB.uplinks, player_minds, TRUE)
selected.start(GLOB.uplinks, player_minds)
SSdirectives.next_directive_time = INFINITY
SSdirectives.active_directive = selected
*/

/datum/controller/subsystem/directives/proc/get_uplink_data(datum/component/uplink/uplink)
var/data = list()
data["time"] = world.time
var/atom/uplink_owner = uplink.parent
var/turf/uplink_turf = uplink_owner && get_turf(uplink_owner)
if (istype(uplink_turf))
data["pos_x"] = uplink_turf?.x
data["pos_y"] = uplink_turf?.y
data["pos_z"] = uplink_turf?.z
Comment on lines +72 to +74
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ? is redundant. it's typechecked.

// The uplink can only detect syndicate assigned objectives of the owner
if (uplink.owner)
var/list/known_objectives = list()
for (var/datum/antagonist/antagonist_type in uplink.owner.antag_datums)
// The syndicate uplink is only aware of syndicate-given objectives.
if (antagonist_type.faction != FACTION_SYNDICATE)
continue
for (var/datum/objective/objective in antagonist_type.objectives)
var/atom/tracking_target = objective.get_tracking_target(uplink_turf)
var/turf/tracking_turf = tracking_target && get_turf(tracking_target)
known_objectives += list(list(
"name" = objective.name,
"tasks" = list(objective.explanation_text),
"track_x" = tracking_turf?.x,
"track_y" = tracking_turf?.y,
"track_z" = tracking_turf?.z,
))
// Add the priority directive
if (active_directive)
var/atom/track_atom = active_directive.get_track_atom()
var/turf/track_turf = get_turf(track_atom)
known_objectives += list(list(
"name" = active_directive.name,
"tasks" = list(active_directive.get_explanation(uplink)),
"time" = active_directive.end_at,
"details" = active_directive.get_details(uplink),
"reward" = active_directive.tc_reward,
"track_x" = track_turf?.x,
"track_y" = track_turf?.y,
"track_z" = track_turf?.z,
"action" = active_directive.get_special_action()?.action_name
))
data["objectives"] = known_objectives
return data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

z information isn't sufficient. people won't know if 1 is centcom, or 8 is multifloored station or away. try to use compare_z proc since it just tells if compared things are at the same z category.
(altho It looks I need to improve the proc a bit)


/datum/controller/subsystem/directives/proc/directive_action(datum/component/uplink/uplink, mob/living/user)
if (!active_directive)
return
active_directive.perform_special_action(uplink, user)
11 changes: 9 additions & 2 deletions code/datums/components/deployable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
var/empty_icon
/// The type that we can use to reload this deployable
var/reload_type
/// The can deploy check. Parameters are user and location, a nullable atom and a turf.
var/datum/callback/can_deploy_check = null
/// For when consumed is false, is the carrier object currently loaded and ready to deploy its payload item?
/// Private as we don't want external modifications to this
VAR_PRIVATE/loaded = FALSE
/// The atom parent of this
VAR_PRIVATE/obj/item/item_parent

/datum/component/deployable/Initialize(deployed_object, consumed = TRUE, time_to_deploy = 0 SECONDS, ignores_mob_density = TRUE, dense_deployment = FALSE, empty_icon = null, loaded = FALSE, reload_type = null)
/datum/component/deployable/Initialize(deployed_object, consumed = TRUE, time_to_deploy = 0 SECONDS, ignores_mob_density = TRUE, dense_deployment = FALSE, empty_icon = null, loaded = FALSE, reload_type = null, datum/callback/can_deploy_check)
. = ..()
if (!isitem(parent))
return COMPONENT_INCOMPATIBLE
Expand All @@ -34,6 +36,7 @@
src.empty_icon = empty_icon
src.loaded = loaded
src.reload_type = reload_type
src.can_deploy_check = can_deploy_check

RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(on_attack_self))
RegisterSignal(parent, COMSIG_ITEM_AFTERATTACK, PROC_REF(on_afterattack))
Expand Down Expand Up @@ -111,6 +114,8 @@
if (user)
to_chat(user, "<span class='warning'>[item_parent] has nothing to deploy!</span>")
return
if (can_deploy_check && !can_deploy_check.Invoke(user, location))
return
if(!location) //if no location was passed we use the current location.
location = item_parent.loc
if(isopenturf(location))
Expand Down Expand Up @@ -146,6 +151,8 @@

///Do not call this directly, use try_deploy instead or else deployed items may end up in invalid locations
/datum/component/deployable/proc/deploy(mob/user, atom/location)
if (can_deploy_check && !can_deploy_check.Invoke(user, location))
return
if (user)
item_parent.add_fingerprint(user)
if(isnull(deployed_object)) //then this must have saved contents to dump directly instead
Expand All @@ -154,7 +161,7 @@
if (!QDELETED(item_parent))
item_parent.transfer_fingerprints_to(A)
else
var/atom/R = new deployed_object(location)
var/atom/R = new deployed_object(location, user)
for(var/atom/movable/A in item_parent.contents)
A.forceMove(R)
if (!QDELETED(item_parent))
Expand Down
24 changes: 24 additions & 0 deletions code/datums/components/trackable.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
GLOBAL_LIST_EMPTY(tracks_by_type)

/datum/component/trackable/Initialize(...)
var/atom/object = parent
if (!istype(object))
return COMPONENT_INCOMPATIBLE
if (!GLOB.tracks_by_type[object.type])
GLOB.tracks_by_type[object.type] = list(object)
else
GLOB.tracks_by_type[object.type] += object

/datum/component/trackable/Destroy(force, silent)
var/atom/object = parent
if (istype(object))
GLOB.tracks_by_type[object.type] -= object
return ..()

/proc/get_trackables_by_type(typepath, locate_subtypes)
if (locate_subtypes)
var/list/results = list()
for (var/type in typesof(typepath))
results += GLOB.tracks_by_type[type]
return results
return GLOB.tracks_by_type[typepath]
Loading
Loading