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

Писоника (WIP) #2780

Open
wants to merge 28 commits into
base: dev-sierra
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ffb49e0
Писоника
Rochehendson Nov 1, 2024
df864ee
pisonika2
Rochehendson Nov 5, 2024
e4999e1
Писоника 3
Rochehendson Nov 6, 2024
9a40388
Писоника 4?
Rochehendson Nov 10, 2024
8295cc4
Merge branch 'dev-sierra' into dev-sierra
Rochehendson Nov 14, 2024
a488d82
Merge branch 'dev-sierra' into dev-sierra
Lexanx Nov 22, 2024
2305891
vrode fix рантаймов
Lexanx Nov 22, 2024
52a7f1e
Смена названия
Rochehendson Nov 25, 2024
ceffacb
Привязка к вайтлисту
Rochehendson Dec 1, 2024
fd2db65
Update psipower_orbs.dm
Rochehendson Dec 1, 2024
9f34af0
Merge branch 'SierraBay:dev-sierra' into dev-sierra
Rochehendson Dec 1, 2024
59edf6f
Update energistics.dm
Rochehendson Dec 1, 2024
2556a88
Merge branch 'dev-sierra' of https://github.com/Rochehendson/SierraBa…
Rochehendson Dec 1, 2024
6f6aa4d
.len на LISTRESIZE
Rochehendson Dec 5, 2024
5fc1cb2
Merge branch 'SierraBay:dev-sierra' into dev-sierra
Rochehendson Dec 6, 2024
2c403a4
Псоник
Rochehendson Dec 10, 2024
274cfc6
Merge branch 'SierraBay:dev-sierra' into dev-sierra
Rochehendson Jan 5, 2025
18f067a
Пометил немодульные изменения
Rochehendson Jan 12, 2025
47c5911
Update using.dm
Rochehendson Jan 12, 2025
ef908c8
Update job.dm
Rochehendson Jan 12, 2025
712c945
Небольшой фикс
Rochehendson Jan 12, 2025
9f4b2b8
Merge branch 'dev-sierra' of https://github.com/Rochehendson/SierraBa…
Rochehendson Jan 12, 2025
cb35cc4
Update psionics.dm
Rochehendson Jan 13, 2025
d38e64f
Псипомпа
Rochehendson Jan 20, 2025
4e148e0
Merge branch 'dev-sierra' into dev-sierra
Rochehendson Jan 20, 2025
1d5f868
Псипомпу в СБ
Rochehendson Jan 20, 2025
710040b
Rename psionics.dme to psionics_includes.dm
Rochehendson Jan 26, 2025
f3809a3
Merge branch 'dev-sierra' into dev-sierra
Rochehendson Jan 26, 2025
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
2 changes: 2 additions & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,8 @@
#include "code\modules\client\preference_setup\loadout\lists\xenowear.dm"
#include "code\modules\client\preference_setup\occupation\occupation.dm"
#include "code\modules\client\preference_setup\occupation\skill_selection.dm"
#include "code\modules\client\preference_setup\psionics\01_basic.dm"
#include "code\modules\client\preference_setup\psionics\02_abilities.dm"
#include "code\modules\clothing\_clothing.dm"
#include "code\modules\clothing\_clothing_flags.dm"
#include "code\modules\clothing\buttons.dm"
Expand Down
1 change: 1 addition & 0 deletions code/__defines/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
#define SPECIES_STOK "Stok"

#define SPECIES_FBP "Full Body Prosthesis" //SIERRA-ADD XENO WHITELIST
#define SPECIES_PSI "Psionics" //SIERRA-ADD PSI WHITELIST

#define UNRESTRICTED_SPECIES list(SPECIES_HUMAN, SPECIES_DIONA, SPECIES_IPC, SPECIES_UNATHI, SPECIES_YEOSA, SPECIES_SKRELL, SPECIES_TRITONIAN, SPECIES_SPACER, SPECIES_VATGROWN, SPECIES_GRAVWORLDER, SPECIES_MULE)
#define RESTRICTED_SPECIES list(SPECIES_VOX, SPECIES_ALIEN, SPECIES_GOLEM)
Expand Down
21 changes: 16 additions & 5 deletions code/__defines/psi.dm
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
// [SIERRA-ADD] - PSIONICS
#define PSI_IMPLANT_AUTOMATIC "Security Level Derived"
#define PSI_IMPLANT_SHOCK "Issue Neural Shock"
#define PSI_IMPLANT_WARN "Issue Reprimand"
#define PSI_IMPLANT_LOG "Log Incident"
#define PSI_IMPLANT_DISABLED "Disabled"

/*
#define PSI_COERCION "coercion"
#define PSI_PSYCHOKINESIS "psychokinesis"
#define PSI_REDACTION "redaction"
#define PSI_ENERGISTICS "energistics"
*/

#define PSI_COERCION "coercion"
#define PSI_CONSCIOUSNESS "consciousness"
#define PSI_PSYCHOKINESIS "psychokinesis"
#define PSI_MANIFESTATION "manifestation"
#define PSI_METAKINESIS "metakinesis"
#define PSI_ENERGISTICS "energistics"
#define PSI_REDACTION "redaction"

#define PSI_RANK_BLUNT 0
#define PSI_RANK_LATENT 1
#define PSI_RANK_OPERANT 2
#define PSI_RANK_MASTER 3
#define PSI_RANK_GRANDMASTER 4
#define PSI_RANK_PARAMOUNT 5
#define PSI_RANK_APPRENTICE 2
#define PSI_RANK_OPERANT 3
#define PSI_RANK_MASTER 4
#define PSI_RANK_GRANDMASTER 5
// [/SIERRA-ADD] - PSIONICS
4 changes: 4 additions & 0 deletions code/controllers/subsystems/processing/psi.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// [SIERRA-REMOVE] - PSIONICS - (Перемещено в /mods/psionics)
/*
GLOBAL_LIST_INIT(psychic_ranks_to_strings, list("Latent", "Operant", "Masterclass", "Grandmasterclass", "Paramount"))

PROCESSING_SUBSYSTEM_DEF(psi)
Expand Down Expand Up @@ -32,3 +34,5 @@ PROCESSING_SUBSYSTEM_DEF(psi)
var/singleton/psionic_faculty/faculty = get_faculty(power.faculty)
if(faculty)
faculty.powers |= power
*/
// [/SIERRA-REMOVE] - PSIONICS
53 changes: 52 additions & 1 deletion code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@

var/faction = MOB_FACTION_CREW

var/global/psi_allowed_species = list(/datum/species/human,/datum/species/human/vatgrown,/datum/species/human/tritonian,/datum/species/human/gravworlder,/datum/species/human/spacer) // [SIERRA-ADD] - PSIONICS


/datum/job/New()

if(prob(100-availablity_chance)) //Close positions, blah blah.
Expand All @@ -72,6 +75,52 @@
/datum/job/dd_SortValue()
return title

// [SIERRA-ADD] - PSIONICS
/datum/job/proc/give_psi(mob/living/carbon/human/H)

if(!(all_species[H.client.prefs.species].type in psi_allowed_species))
return

if(psi_latency_chance && prob(psi_latency_chance))
H.set_psi_rank(pick(PSI_COERCION, PSI_REDACTION, PSI_ENERGISTICS, PSI_PSYCHOKINESIS, PSI_CONSCIOUSNESS, PSI_MANIFESTATION, PSI_METAKINESIS), 1, defer_update = TRUE)

if(!whitelist_lookup(SPECIES_PSI, H.client.ckey))
return

var/list/psi_abilities_by_name = H.client.prefs.psi_abilities

if(!H.client.prefs.psi_threat_level)
return

LAZYINITLIST(psi_faculties)
for(var/faculty_name in list("Coercion", "Consciousness", "Energistics", "Manifestation", "Metakinesis", "Psychokinesis", "Redaction"))
var/singleton/psionic_faculty/faculty = SSpsi.faculties_by_name[faculty_name]
var/faculty_id = faculty.id
psi_faculties |= list("[faculty_id]" = psi_abilities_by_name[faculty_name] - 1)

for(var/psi in psi_faculties)
if(psi_faculties[psi] > 0)
H.set_psi_rank(psi, psi_faculties[psi], take_larger = TRUE, defer_update = TRUE)

H.psi.update()

give_psionic_implant_on_join ||= (H.client.prefs.psi_threat_level > 0)

if(!give_psionic_implant_on_join)
return

var/obj/item/implant/psi_control/imp = new
imp.implanted(H)
imp.forceMove(H)
imp.imp_in = H
imp.implanted = TRUE
var/obj/item/organ/external/affected = H.get_organ(BP_HEAD)
if(affected)
affected.implants += imp
imp.part = affected
to_chat(H, SPAN_DANGER("As a registered psionic, you are fitted with a psi-dampening control implant. Using psi-power while the implant is active will result in neural shocks and your violation being reported."))
// [/SIERRA-ADD] - PSIONICS

/datum/job/proc/equip(mob/living/carbon/human/H, alt_title, datum/mil_branch/branch, datum/mil_rank/grade)

if (required_language)
Expand All @@ -82,6 +131,8 @@
H.add_language(LANGUAGE_SPACER)
H.set_default_language(all_languages[LANGUAGE_SPACER])

give_psi(H) // [SIERRA-ADD] - PSIONICS
/*
if(psi_latency_chance && prob(psi_latency_chance))
H.set_psi_rank(pick(PSI_COERCION, PSI_REDACTION, PSI_ENERGISTICS, PSI_PSYCHOKINESIS), 1, defer_update = TRUE)
if(islist(psi_faculties))
Expand All @@ -100,7 +151,7 @@
affected.implants += imp
imp.part = affected
to_chat(H, SPAN_DANGER("As a registered psionic, you are fitted with a psi-dampening control implant. Using psi-power while the implant is active will result in neural shocks and your violation being reported."))

*/
var/singleton/hierarchy/outfit/outfit = get_outfit(H, alt_title, branch, grade)
if(outfit) . = outfit.equip(H, title, alt_title)
if(faction)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ var/global/floorIsLava = 0
body += "<a href='?src=\ref[psyker.psi];remove_psionics=1'>Remove psionics.</a><br/><br/>"
body += "<a href='?src=\ref[psyker.psi];trigger_psi_latencies=1'>Trigger latencies.</a><br/>"
body += "<table width = '100%'>"
for(var/faculty in list(PSI_COERCION, PSI_PSYCHOKINESIS, PSI_REDACTION, PSI_ENERGISTICS))
for(var/faculty in list(PSI_COERCION, PSI_CONSCIOUSNESS, PSI_PSYCHOKINESIS, PSI_MANIFESTATION, PSI_ENERGISTICS, PSI_REDACTION, PSI_METAKINESIS))
var/singleton/psionic_faculty/faculty_singleton = SSpsi.get_faculty(faculty)
var/faculty_rank = psyker.psi ? psyker.psi.get_rank(faculty) : 0
body += "<tr><td><b>[faculty_singleton.name]</b></td>"
Expand Down
5 changes: 5 additions & 0 deletions code/modules/client/preference_setup/preference_setup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ var/global/const/CHARACTER_PREFERENCE_INPUT_TITLE = "Character Preference"
sort_order = 8
category_item_type = /datum/category_item/player_setup_item/law_pref

/datum/category_group/player_setup_category/psionics_preferences
name = "Psionics"
sort_order = 9
category_item_type = /datum/category_item/player_setup_item/psionics


/****************************
* Category Collection Setup *
Expand Down
45 changes: 45 additions & 0 deletions code/modules/client/preference_setup/psionics/01_basic.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// [SIERRA-ADD] - PSIONICS
/datum/preferences
var/psi_threat_level = 0
var/psi_openness = TRUE

/datum/category_item/player_setup_item/psionics/basic
name = "Basic"
sort_order = 1

/datum/category_item/player_setup_item/psionics/basic/load_character(datum/pref_record_reader/R)
pref.psi_threat_level = R.read("psi_threat_level")
pref.psi_openness = R.read("psi_openness")

/datum/category_item/player_setup_item/psionics/basic/save_character(datum/pref_record_writer/W)
W.write("psi_threat_level", pref.psi_threat_level)
W.write("psi_openness", pref.psi_openness)

/datum/category_item/player_setup_item/psionics/basic/sanitize_character()
pref.psi_threat_level = clamp(pref.psi_threat_level, 0, 4)

/datum/category_item/player_setup_item/psionics/basic/content(mob/user)
. = list()
if(!whitelist_lookup(SPECIES_PSI, user.ckey))
. += "<b>You are not permitted to be Psionic</b><br>"
else
. += "Power: <a href='?src=\ref[src];select_psi_threat_level=1'><b>[pref.psi_threat_level]</b></a><br>"

if(pref.psi_threat_level)
. += "Implant: <a href='?src=\ref[src];toggle_psi_openness=1'><b>[pref.psi_openness ? "Yes" : "No"]</b></a><br>"

. = jointext(.,null)

/datum/category_item/player_setup_item/psionics/OnTopic(href, list/href_list, mob/user)
if(href_list["select_psi_threat_level"])
pref.psi_threat_level = text2num(input("Select threat level", CHARACTER_PREFERENCE_INPUT_TITLE, pref.psi_threat_level) in list("0", "1", "2", "3", "4"))
pref.psi_threat_level = clamp(pref.psi_threat_level, 0, 4)
pref.sanitize_psi_abilities()
return TOPIC_REFRESH

else if(href_list["toggle_psi_openness"])
pref.psi_openness = !pref.psi_openness
return TOPIC_REFRESH

return ..()
// [SIERRA-ADD] - PSIONICS
149 changes: 149 additions & 0 deletions code/modules/client/preference_setup/psionics/02_abilities.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
// [SIERRA-ADD] - PSIONICS
GLOBAL_LIST_INIT(psi_level2cost, list(
"Blunt" = 0,
"Latent" = 2,
"Apprentice" = 6,
"Operant" = 16
))

GLOBAL_LIST_INIT(psi_faculty2color, list(
"Coercion" = COLOR_RED,
"Consciousness" = COLOR_SURGERY_BLUE,
"Energistics" = COLOR_MEDICAL_UNKNOWN_IMPLANT,
"Manifestation" = COLOR_LIGHT_CYAN,
"Metakinesis" = COLOR_SEDONA,
"Psychokinesis" = COLOR_YELLOW,
"Redaction" = MANIFEST_COLOR_SERVICE
))

GLOBAL_LIST_INIT(psi_threat_level2free_points, list(6, 8, 12, 16))

/datum/preferences
var/list/psi_abilities

/datum/preferences/proc/sanitize_psi_abilities()
if(!psi_threat_level)
return

while(TRUE)
for(var/faculty in psi_abilities)
if(calculate_free_points() >= 0)
return

if(psi_abilities[faculty] > 1)
--psi_abilities[faculty]


/datum/preferences/proc/calculate_free_points()
. = GLOB.psi_threat_level2free_points[psi_threat_level]

for(var/faculty in psi_abilities)
for(var/level in 1 to LAZYLEN(GLOB.psi_level2cost))
var/level_name = GLOB.psi_level2cost[level]
var/level_cost = GLOB.psi_level2cost[level_name]

if(psi_abilities[faculty] == level)
. -= level_cost

/datum/category_item/player_setup_item/psionics/abilities
name = "Abilities"
sort_order = 3

var/static/list/psi_faculties_names

/datum/category_item/player_setup_item/psionics/abilities/load_character(datum/pref_record_reader/R)
pref.psi_abilities = R.read("psi_abilities")

/datum/category_item/player_setup_item/psionics/abilities/save_character(datum/pref_record_writer/W)
W.write("psi_abilities", pref.psi_abilities)

/datum/category_item/player_setup_item/psionics/abilities/sanitize_character()
if(LAZYLEN(pref.psi_abilities))
return ..()

if(!psi_faculties_names)
psi_faculties_names = list()

var/list/faculties = GET_SINGLETON_SUBTYPE_MAP(/singleton/psionic_faculty)
for(var/ftype in faculties)
var/singleton/psionic_faculty/faculty = faculties[ftype]
psi_faculties_names += faculty.name

pref.psi_abilities = list()
for(var/faculty in psi_faculties_names)
pref.psi_abilities[faculty] = 1

return ..()


/datum/category_item/player_setup_item/psionics/abilities/proc/can_select_level(faculty, level)
if(level <= 1)
return TRUE // safe measure

return (pref.calculate_free_points() + GLOB.psi_level2cost[GLOB.psi_level2cost[pref.psi_abilities[faculty]]]) >= GLOB.psi_level2cost[GLOB.psi_level2cost[level]]

/datum/category_item/player_setup_item/psionics/abilities/content(mob/user)
. = list()
if(!whitelist_lookup(SPECIES_PSI, user.ckey))
. += "<b> </b><br>"
else

if(!pref.psi_threat_level || !whitelist_lookup(SPECIES_PSI, user.ckey))
return ..()

if(!pref.psi_abilities)
sanitize_character()

. += "<style>"
. += ".Current{background: #2f943c}"
. += ".Unavailable{background: #404040}"
. += ".Selectable, a.Selectable{float:none; border:none; margin:none !important; padding:none !important}"
. += ".center { margin: auto; }"
. += ".candystripe { background-color: rgba(148, 148, 148, 0.25);}"
. += ".candystripe:nth-child(odd) {background-color: rgba(0, 0, 0, 0.16);}"

. += "</style>"

. += "<tt><center>"

. += FONT_LARGE("<b>Points remaining: [pref.calculate_free_points()]</b>")

. += "<table style='width: 100%' style='font-size: 15px; text-align: center' class='table'>"

for(var/faculty in list("Coercion", "Consciousness", "Energistics", "Manifestation", "Metakinesis", "Psychokinesis", "Redaction"))
. += "<tr class='candystripe'>"
. += "<th><div class='average' style='color: [GLOB.psi_faculty2color[faculty]]'>[faculty]:</div></th>"

for(var/level_index in 1 to LAZYLEN(GLOB.psi_level2cost))
var/level_name = GLOB.psi_level2cost[level_index]

if(pref.psi_abilities[faculty] == level_index)
. += "<td class='Current'><div class='center'>[level_name]</div></td>"
else if(can_select_level(faculty, level_index))
. += "<td class style='background: #40628a;'><div class='center'><a class='Selectable' href='?src=\ref[src];select=[level_index];faculty=[faculty]'>[level_name]</a></div></td>"
else
. += "<td class='Unavailable'><div class='center'>[level_name]</div></td>"

. += "</tr>"

. += "</table>"

. += "</center></tt>"

. = jointext(., null)

/datum/category_item/player_setup_item/psionics/abilities/OnTopic(href, list/href_list, mob/user)
if(..())
return TOPIC_HANDLED

if(href_list["select"])
var/level = text2num(href_list["select"])
var/faculty = href_list["faculty"]

if(!can_select_level(faculty, level))
return TOPIC_HANDLED

pref.psi_abilities[faculty] = level

return TOPIC_REFRESH
// [SIERRA-ADD] - PSIONICS
4 changes: 4 additions & 0 deletions code/modules/psionics/complexus/complexus.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// [SIERRA-REMOVE] - PSIONICS - (Перемещено в /mods/psionics)
/*
/datum/psi_complexus

var/announced = FALSE // Whether or not we have been announced to our holder yet.
Expand Down Expand Up @@ -92,3 +94,5 @@
qdel(thing)
manifested_items.Cut()
. = ..()
*/
// [/SIERRA-REMOVE] - PSIONICS - (Перемещено в /mods/psionics)
4 changes: 4 additions & 0 deletions code/modules/psionics/complexus/complexus_helpers.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// [SIERRA-REMOVE] - PSIONICS - (Перемещено в /mods/psionics)
/*
/datum/psi_complexus/proc/cancel()
sound_to(owner, sound('sound/effects/psi/power_fail.ogg'))
if(LAZYLEN(manifested_items))
Expand Down Expand Up @@ -102,3 +104,5 @@
stamina = min(stamina, max_stamina)
cancel()
update()
*/
// [/SIERRA-REMOVE] - PSIONICS - (Перемещено в /mods/psionics)
4 changes: 4 additions & 0 deletions code/modules/psionics/complexus/complexus_latency.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// [SIERRA-REMOVE] - PSIONICS - (Перемещено в /mods/psionics)
/*
/datum/psi_complexus/proc/check_latency_trigger(trigger_strength = 0, source, redactive = FALSE)

if(!LAZYLEN(latencies) || world.time < next_latency_trigger)
Expand All @@ -16,3 +18,5 @@
if(!redactive) owner.adjustBrainLoss(rand(trigger_strength * 2, trigger_strength * 4))
log_and_message_admins("gained the [faculty_singleton.name] psionic faculty by: [source].", owner)
return TRUE
*/
// [/SIERRA-REMOVE] - PSIONICS - (Перемещено в /mods/psionics)
Loading
Loading