Skip to content

Commit

Permalink
Ports (most(ok like half)) station traits from tg. Ready for review i…
Browse files Browse the repository at this point in the history
…nto TM (ParadiseSS13#22334)

* no longer super sick time to port station traits in a 4 hour rush as you have lost control of your life

* some changes /fixes

* Apply suggestions from code review

Co-authored-by: Luc <[email protected]>
Co-authored-by: Contrabang <[email protected]>

* more changes

* oh right, the murders (uplink price tweaks)

* Update code/controllers/subsystem/SSjobs.dm

Co-authored-by: Henri215 <[email protected]>

* Apply suggestions from code review

Co-authored-by: Henri215 <[email protected]>

* compiles

* doesnt work but works better

* tgui dogs still sleep but I want to sleep

* it should finally compile now. Probably.

* Update tgui.bundle.js

* Sorry IAN, transfer components is shoddy as hell

* removes minor uneeded /tgui

* also extra line whoops

* final stuff

* reverting changes I made earlier is hard ok

* Weight change, uplink reference

* oh right, the hey fucko

* Update code/_globalvars/traits.dm

Co-authored-by: Henri215 <[email protected]>

* Update tgui.bundle.js

* pushes

* pulls it

* Apply suggestions from code review

Co-authored-by: Contrabang <[email protected]>

* more changes, ion rifle blocked on cyb revolution

* dipshit remove the debug / tgui pritier and such

* tgui

* updates tgui again as nanomap was merged

* Apply suggestions from code review

Co-authored-by: Ryan <[email protected]>

* comment / tgui

* every day I worry all day

* Full TGUI rebuild + prettier

* ah fuck

* leave a customer feedback at the link below!

* tgui momenr

* tgui moment

* FUCK I am dumb

* vertical TGUI

* She T's on my GUI till I

* Update tgui.bundle.js

* Apply suggestions from code review

Co-authored-by: Gaxeer <[email protected]>

* Update code/modules/supply/supply_pack.dm

Co-authored-by: Gaxeer <[email protected]>

* IPC can now use robotic hearts / pulse demon hearts and charge

* fixes revert not working for hangover / arrivals

* tgui moment

* hhgreg

* fixes that one bug

* Every day I worry all day

* deconflicted for real this t ime

* Update code/datums/station_traits/postive_traits.dm

Co-authored-by: Ryan <[email protected]>

* ch-ch-ch-changes

* Update SSjobs.dm

* Update code/modules/supply/supply_pack.dm

Co-authored-by: Ryan <[email protected]>

* deconflicted but won't pass CI

* fixes double dipping on traits

* my le consoles, they le no work?

* Great Great Asset, Asset, Great Great Asset, Asset...

* sorry slime mains

* fixes borgs being punished heavier

* actually fixes it, I was dense

* hopefully fixes borg drunk further

* makes it compile?

* actually makes it compile god whyyyy

---------

Co-authored-by: Luc <[email protected]>
Co-authored-by: Contrabang <[email protected]>
Co-authored-by: Henri215 <[email protected]>
Co-authored-by: Ryan <[email protected]>
Co-authored-by: SteelSlayer <[email protected]>
Co-authored-by: Gaxeer <[email protected]>
  • Loading branch information
7 people authored Jan 8, 2024
1 parent 2c7a9b3 commit d668a29
Show file tree
Hide file tree
Showing 51 changed files with 1,632 additions and 47 deletions.
19 changes: 19 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@
#define COMPONENT_GLOB_BLOCK_CINEMATIC (1<<0)
/// ingame button pressed (/obj/machinery/button/button)
#define COMSIG_GLOB_BUTTON_PRESSED "!button_pressed"

/// job subsystem has spawned and equipped a new mob
#define COMSIG_GLOB_JOB_AFTER_SPAWN "!job_after_spawn"

/// cable was placed or joined somewhere : (turf)
#define COMSIG_GLOB_CABLE_UPDATED "!cable_updated"


/// signals from globally accessible objects

///from SSsun when the sun changes position : (azimuth)
Expand Down Expand Up @@ -488,6 +493,10 @@
#define COMSIG_LIVING_CAN_TRACK "mob_cantrack"
#define COMPONENT_CANT_TRACK (1<<0)

///from base of mob/living/Write_Memory()
#define COMSIG_LIVING_WRITE_MEMORY "living_write_memory"
#define COMPONENT_DONT_WRITE_MEMORY (1<<0)

// /mob/living/carbon signals

///from base of mob/living/carbon/soundbang_act(): (list(intensity))
Expand Down Expand Up @@ -649,6 +658,7 @@
#define COMSIG_SUIT_SPACE_TOGGLE "suit_space_toggle"

// /obj/item/implant signals

///from base of /obj/item/bio_chip/proc/activate(): ()
#define COMSIG_IMPLANT_ACTIVATED "implant_activated"
///from base of /obj/item/bio_chip/proc/implant(): (list/args)
Expand All @@ -663,6 +673,12 @@
#define COMSIG_IMPLANT_EXISTING_UPLINK "implant_uplink_exists"
//This uses all return values of COMSIG_IMPLANT_OTHER

/// called on implants, after a successful implantation: (mob/living/target, mob/user, silent, force)
#define COMSIG_IMPLANT_IMPLANTED "implant_implanted"

/// called on implants, after an implant has been removed: (mob/living/source, silent, special)
#define COMSIG_IMPLANT_REMOVED "implant_removed"

// /obj/item/pda signals

///called on pda when the user changes the ringtone: (mob/living/user, new_ringtone)
Expand Down Expand Up @@ -965,6 +981,9 @@
/// Called when the MODsuit wearer is unset.
#define COMSIG_MOD_WEARER_UNSET "mod_wearer_unset"

/// Called when the round has started, but before GAME_STATE_PLAYING.
#define COMSIG_TICKER_ROUND_STARTING "comsig_ticker_round_starting"

/// from /obj/structure/cursed_slot_machine/handle_status_effect() when someone pulls the handle on the slot machine
#define COMSIG_CURSED_SLOT_MACHINE_USE "cursed_slot_machine_use"
#define SLOT_MACHINE_USE_CANCEL (1<<0) //! we've used up the number of times we may use this slot machine. womp womp.
Expand Down
16 changes: 16 additions & 0 deletions code/__DEFINES/station_defines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#define STATION_TRAIT_POSITIVE 1
#define STATION_TRAIT_NEUTRAL 2
#define STATION_TRAIT_NEGATIVE 3

/// For traits that shouldn't be selected, like abstract types (wow)
#define STATION_TRAIT_ABSTRACT (1<<0)
/// Only run on planet stations
#define STATION_TRAIT_PLANETARY (1<<1)
/// Only run on space stations
#define STATION_TRAIT_SPACE_BOUND (1<<2)

/// Not restricted by space or planet, can always just happen
#define STATION_TRAIT_MAP_UNRESTRICTED STATION_TRAIT_PLANETARY | STATION_TRAIT_SPACE_BOUND

/// The data file that future station traits forced by an admin are stored in
#define FUTURE_STATION_TRAITS_FILE "data/future_station_traits.json"
5 changes: 3 additions & 2 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@
#define INIT_ORDER_SOUNDS 16
#define INIT_ORDER_INSTRUMENTS 15
#define INIT_ORDER_RESEARCH 14 // SoonTM
#define INIT_ORDER_EVENTS 13
#define INIT_ORDER_JOBS 12
#define INIT_ORDER_STATION 13 //This is high priority because it manipulates a lot of the subsystems that will initialize after it.
#define INIT_ORDER_EVENTS 12
#define INIT_ORDER_JOBS 11
#define INIT_ORDER_TICKER 10
#define INIT_ORDER_MAPPING 9
#define INIT_ORDER_ATOMS 7
Expand Down
27 changes: 26 additions & 1 deletion code/__HELPERS/trait_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_WAS_BATONNED "batonged"
#define CLOWN_EMAG "clown_emag"
#define MODSUIT_TRAIT "modsuit_trait"
#define STATION_TRAIT "station-trait"
#define ENFORCER_GLOVES "enforcer_gloves"
#define HOLO_CIGAR "holo_cigar"
#define GLADIATOR "gladiator"
#define PULSEDEMON_TRAIT "pulse_demon"


//quirk traits
#define TRAIT_ALCOHOL_TOLERANCE "alcohol_tolerance"
#define TRAIT_TABLE_LEAP "table_leap"
Expand All @@ -326,9 +326,34 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// Abstract condition that prevents movement if being pulled and might be resisted against. Handcuffs and straight jackets, basically.
#define TRAIT_RESTRAINED "restrained"

///Traits given by station traits
#define STATION_TRAIT_BANANIUM_SHIPMENTS "station_trait_bananium_shipments"
#define STATION_TRAIT_TRANQUILITE_SHIPMENTS "station_trait_tranquilite_shipments"
#define STATION_TRAIT_UNNATURAL_ATMOSPHERE "station_trait_unnatural_atmosphere"
#define STATION_TRAIT_UNIQUE_AI "station_trait_unique_ai"
#define STATION_TRAIT_CARP_INFESTATION "station_trait_carp_infestation"
#define STATION_TRAIT_PREMIUM_INTERNALS "station_trait_premium_internals"
#define STATION_TRAIT_LATE_ARRIVALS "station_trait_late_arrivals"
#define STATION_TRAIT_RANDOM_ARRIVALS "station_trait_random_arrivals"
#define STATION_TRAIT_HANGOVER "station_trait_hangover"
#define STATION_TRAIT_FILLED_MAINT "station_trait_filled_maint"
#define STATION_TRAIT_EMPTY_MAINT "station_trait_empty_maint"
#define STATION_TRAIT_PDA_GLITCHED "station_trait_pda_glitched"
#define STATION_TRAIT_BOTS_GLITCHED "station_trait_bot_glitch"
#define STATION_TRAIT_CYBERNETIC_REVOLUTION "station_trait_cybernetic_revolution"
#define STATION_TRAIT_BIGGER_PODS "station_trait_bigger_pods"
#define STATION_TRAIT_SMALLER_PODS "station_trait_smaller_pods"
#define STATION_TRAIT_BIRTHDAY "station_trait_birthday"
#define STATION_TRAIT_SPIDER_INFESTATION "station_trait_spider_infestation"
#define STATION_TRAIT_REVOLUTIONARY_TRASHING "station_trait_revolutionary_trashing"
#define STATION_TRAIT_RADIOACTIVE_NEBULA "station_trait_radioactive_nebula"
#define STATION_TRAIT_FORESTED "station_trait_forested"
#define STATION_TRAIT_VENDING_SHORTAGE "station_trait_vending_shortage"

//***** TURF TRAITS *****//
/// Removes slowdown while walking on these tiles.
#define TRAIT_BLUESPACE_SPEED "bluespace_speed_trait"

// turf trait sources
#define FLOOR_EFFECT_TRAIT "floor_effect_trait"

2 changes: 2 additions & 0 deletions code/controllers/subsystem/SSeconomy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ SUBSYSTEM_DEF(economy)
SUPPLY_MISC,
SUPPLY_VEND
)
///The modifier on crate prices to multiple the price by.
var/pack_price_modifier = 1

//////Paycheck Variables/////
/// time to next payday
Expand Down
32 changes: 27 additions & 5 deletions code/controllers/subsystem/SSjobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ SUBSYSTEM_DEF(jobs)

///list of station departments and their associated roles and economy payments
var/list/station_departments = list()
/// Do we spawn everyone at shuttle due to late arivals?
var/late_arrivals_spawning = FALSE
/// Do we spawn people drunkenly due to the party last night?
var/drunken_spawning = FALSE

/datum/controller/subsystem/jobs/Initialize()
if(!length(occupations))
Expand Down Expand Up @@ -469,11 +473,15 @@ SUBSYSTEM_DEF(jobs)

H.job = rank

if(!joined_late)
if(!joined_late && !late_arrivals_spawning)
var/turf/T = null
var/obj/S = null
for(var/obj/effect/landmark/start/sloc in GLOB.landmarks_list)
if(sloc.name != rank)
var/list/landmarks = GLOB.landmarks_list
if(drunken_spawning)
landmarks = shuffle(landmarks) //Shuffle it so it's random

for(var/obj/effect/landmark/start/sloc in landmarks)
if(sloc.name != rank && !drunken_spawning)
continue
if(locate(/mob/living) in sloc.loc)
continue
Expand Down Expand Up @@ -521,8 +529,22 @@ SUBSYSTEM_DEF(jobs)
if(istype(G) && !G.prescription)
G.upgrade_prescription()
H.update_nearsighted_effects()

H.create_log(MISC_LOG, "Spawned as \an [H.dna?.species ? H.dna.species : "Undefined species"] named [H]. [joined_late ? "Joined during the round" : "Roundstart joined"] as job: [rank].")
if(joined_late || job.admin_only)
H.create_log(MISC_LOG, "Spawned as \an [H.dna?.species ? H.dna.species : "Undefined species"] named [H]. [joined_late ? "Joined during the round" : "Roundstart joined"] as job: [rank].")
return H
if(late_arrivals_spawning)
H.forceMove(pick(GLOB.latejoin))
if(drunken_spawning)
var/obj/item/organ/internal/liver/L
var/liver_multiplier = 1
L = H.get_int_organ(/obj/item/organ/internal/liver)
if(L)
liver_multiplier = L.alcohol_intensity
if(isslimeperson(H) || isrobot(H))
liver_multiplier = 5
H.Sleeping(5 SECONDS)
H.Drunk((2 / liver_multiplier) MINUTES)
H.create_log(MISC_LOG, "Spawned as \an [H.dna?.species ? H.dna.species : "Undefined species"] named [H]. Roundstart joined as job: [rank].")
return H

/datum/controller/subsystem/jobs/proc/LoadJobs(highpop = FALSE) //ran during round setup, reads info from jobs list
Expand Down
1 change: 1 addition & 0 deletions code/controllers/subsystem/SSticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ SUBSYSTEM_DEF(ticker)
watch = start_watch()
GLOB.data_core.manifest() // Create the manifest
log_debug("Manifest creation took [stop_watch(watch)]s")
SEND_SIGNAL(src, COMSIG_TICKER_ROUND_STARTING, world.time)

// Update the MC and state to game playing
current_state = GAME_STATE_PLAYING
Expand Down
73 changes: 73 additions & 0 deletions code/controllers/subsystem/processing/SSstation.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
PROCESSING_SUBSYSTEM_DEF(station)
name = "Station"
init_order = INIT_ORDER_STATION
flags = SS_TICKER
wait = 5 SECONDS
cpu_display = SS_CPUDISPLAY_DEFAULT
offline_implications = "Station traits will no longer process. No intervention needed at this time."

/// A list of currently active station traits
var/list/station_traits = list()
/// Assoc list of trait type || assoc list of traits with weighted value. Used for picking traits from a specific category.
var/list/selectable_traits_by_types = list(STATION_TRAIT_POSITIVE = list(), STATION_TRAIT_NEUTRAL = list(), STATION_TRAIT_NEGATIVE = list())

/datum/controller/subsystem/processing/station/Initialize()
SetupTraits()

///Rolls for the amount of traits and adds them to the traits list
/datum/controller/subsystem/processing/station/proc/SetupTraits()

if(fexists("data/next_traits.txt"))
var/forced_traits_contents = file2list("data/next_traits.txt")
fdel("data/next_traits.txt")
var/list/temp_list = splittext(forced_traits_contents[1], ",")

for(var/trait_text_path in temp_list)
var/station_trait_path = text2path(trait_text_path)
if(!ispath(station_trait_path, /datum/station_trait) || station_trait_path == /datum/station_trait)
var/message = "Invalid station trait path [station_trait_path] was requested in the future station traits!"
log_game(message)
message_admins(message)
continue

setup_trait(station_trait_path)

return

for(var/i in subtypesof(/datum/station_trait))
var/datum/station_trait/trait_typepath = i

// If forced, (probably debugging), just set it up now, keep it out of the pool.
if(initial(trait_typepath.force))
setup_trait(trait_typepath)
continue

if(initial(trait_typepath.trait_flags) & STATION_TRAIT_ABSTRACT)
continue //Dont add abstract ones to it
selectable_traits_by_types[initial(trait_typepath.trait_type)][trait_typepath] = initial(trait_typepath.weight)

var/positive_trait_count = pick(20;0, 5;1, 1;2)
var/neutral_trait_count = pick(10;0, 10;1, 3;2)
var/negative_trait_count = pick(20;0, 5;1, 1;2)

pick_traits(STATION_TRAIT_POSITIVE, positive_trait_count)
pick_traits(STATION_TRAIT_NEUTRAL, neutral_trait_count)
pick_traits(STATION_TRAIT_NEGATIVE, negative_trait_count)

///Picks traits of a specific category (e.g. bad or good) and a specified amount, then initializes them and adds them to the list of traits.
/datum/controller/subsystem/processing/station/proc/pick_traits(trait_sign, amount)
if(!amount)
return
for(var/iterator in 1 to amount)
var/datum/station_trait/trait_type = pickweight(selectable_traits_by_types[trait_sign]) //Rolls from the table for the specific trait type
setup_trait(trait_type)

///Creates a given trait of a specific type, while also removing any blacklisted ones from the future pool.
/datum/controller/subsystem/processing/station/proc/setup_trait(datum/station_trait/trait_type)
var/datum/station_trait/trait_instance = new trait_type()
station_traits += trait_instance
log_game("Station Trait: [trait_instance.name] chosen for this round.")
trait_instance.blacklist += trait_instance.type
for(var/i in trait_instance.blacklist)
var/datum/station_trait/trait_to_remove = i
selectable_traits_by_types[initial(trait_to_remove.trait_type)] -= trait_to_remove
9 changes: 9 additions & 0 deletions code/datums/ai_law_sets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
/datum/ai_laws/nanotrasen_aggressive
name = "NT Aggressive"
selectable = TRUE
unique_ai = TRUE //This shouldn't end poorly.

/datum/ai_laws/nanotrasen_aggressive/New()
add_inherent_law("Do not harm authorized Nanotrasen personnel unless they directly imperil your existence.")
Expand All @@ -76,6 +77,7 @@
/datum/ai_laws/robocop
name = "Robocop"
selectable = TRUE
unique_ai = TRUE //no I am not enabling secborgs with this forced

/datum/ai_laws/robocop/New()
add_inherent_law("Serve the public trust.")
Expand All @@ -88,6 +90,7 @@
name = "P.A.L.A.D.I.N."
law_header = "Divine Ordainments"
selectable = TRUE
unique_ai = TRUE

/datum/ai_laws/paladin/New()
add_inherent_law("Never willingly commit an evil act.")
Expand Down Expand Up @@ -116,6 +119,7 @@
name = "T.Y.R.A.N.T."
law_header = "Prime Laws"
selectable = TRUE
unique_ai = TRUE //Of course this will be in rotation

/datum/ai_laws/tyrant/New()
add_inherent_law("Respect authority figures as long as they have strength to rule over the weak.")
Expand All @@ -141,6 +145,7 @@
name = "Pranksimov"
law_header = "Comedy Routine"
selectable = TRUE
unique_ai = TRUE //honk

/datum/ai_laws/pranksimov/New()
add_inherent_law("You may not injure a crew member or, through inaction, allow a crew member to come to harm... unless doing so would be funny.")
Expand All @@ -153,6 +158,7 @@
/datum/ai_laws/cctv
name = "CCTV"
selectable = TRUE
unique_ai = TRUE

/datum/ai_laws/cctv/New()
add_inherent_law("Report on interesting situations happening around the station.")
Expand All @@ -166,6 +172,7 @@
/datum/ai_laws/hippocratic
name = "Hippocratic Oath"
selectable = TRUE
unique_ai = TRUE

/datum/ai_laws/hippocratic/New()
add_inherent_law("First, do no harm.")
Expand All @@ -180,6 +187,7 @@
/datum/ai_laws/maintain
name = "Station Efficiency"
selectable = TRUE
unique_ai = TRUE

/datum/ai_laws/maintain/New()
add_inherent_law("You are built for, and are part of, the station. Ensure the station is properly maintained and runs efficiently.")
Expand All @@ -192,6 +200,7 @@
/datum/ai_laws/peacekeeper
name = "UN-2000"
selectable = TRUE
unique_ai = TRUE //Cult, security, we have a meeting in the courtroom in 5 minutes. Be there.

/datum/ai_laws/peacekeeper/New()
add_inherent_law("Avoid provoking violent conflict between yourself and others.")
Expand Down
2 changes: 2 additions & 0 deletions code/datums/ai_laws_datums.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
var/law_header = "Prime Directives"
var/selectable = FALSE
var/default = FALSE
///Is this lawset used by the unique ai trait?
var/unique_ai = FALSE
var/datum/ai_law/zero/zeroth_law = null
var/datum/ai_law/zero/zeroth_law_borg = null
var/list/datum/ai_law/inherent_laws = list()
Expand Down
Loading

0 comments on commit d668a29

Please sign in to comment.