forked from Aurorastation/Aurora.3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With that smile, with that "I love you"
You captivate everyone
- Loading branch information
Matt Atlas
committed
Jul 21, 2023
1 parent
428db33
commit 60090e1
Showing
17 changed files
with
224 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- | ||
-- Adds psionic prefs | ||
-- | ||
|
||
ALTER TABLE `ss13_characters` ADD COLUMN `psionics` VARCHAR(128) DEFAULT null AFTER `origin`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
code/modules/client/preference_setup/general/07_psionics.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/datum/category_item/player_setup_item/general/psionics | ||
name = "Psionics" | ||
sort_order = 7 | ||
|
||
|
||
/datum/category_item/player_setup_item/general/psionics/load_character(var/savefile/S) | ||
var/psionics_json | ||
S["psionics"] >> psionics_json | ||
var/list/psionics = json_decode(psionics_json) | ||
for(var/psi in psionics) | ||
var/singleton/psionic_power/P = GET_SINGLETON(text2path(psi)) | ||
if(!istype(P)) | ||
continue | ||
psionics |= P.type | ||
pref.psionics = psionics | ||
|
||
/datum/category_item/player_setup_item/general/psionics/save_character(var/savefile/S) | ||
var/list/psionics = pref.psionics | ||
for(var/psi in psionics) | ||
var/singleton/psionic_power/P = GET_SINGLETON(text2path(psi)) | ||
if(!istype(P)) | ||
continue | ||
psionics |= P.type | ||
S["psionics"] << json_encode(psionics) | ||
|
||
/datum/category_item/player_setup_item/general/psionics/gather_load_query() | ||
return list( | ||
"ss13_characters" = list( | ||
"vars" = list( | ||
"psionics" = "psionics", | ||
), | ||
"args" = list("id") | ||
) | ||
) | ||
|
||
/datum/category_item/player_setup_item/general/psionics/gather_load_parameters() | ||
return list("id" = pref.current_character) | ||
|
||
|
||
/datum/category_item/player_setup_item/general/psionics/gather_save_query() | ||
return list( | ||
"ss13_characters" = list( | ||
"psionics", | ||
"id" = 1 | ||
) | ||
) | ||
|
||
/datum/category_item/player_setup_item/general/psionics/gather_save_parameters() | ||
var/list/sanitized_psionics = list() | ||
for(var/S in pref.psionics) | ||
var/singleton/psionic_power/P = GET_SINGLETON(text2path(S)) | ||
if(!istype(P)) | ||
continue | ||
sanitized_psionics |= "[P.type]" | ||
return list( | ||
"psionics" = json_encode(sanitized_psionics), | ||
"char_id" = pref.current_character, | ||
"ckey" = PREF_CLIENT_CKEY | ||
) | ||
|
||
/datum/category_item/player_setup_item/general/psionics/sanitize_character(var/sql_load = 0) | ||
for(var/S in pref.psionics) | ||
var/singleton/psionic_power/P = GET_SINGLETON(text2path(S)) | ||
if(!istype(P)) | ||
pref.psionics -= S | ||
continue | ||
else | ||
if(!(P.ability_flags & PSI_FLAG_FOUNDATIONAL)) | ||
pref.psionics -= S | ||
continue | ||
|
||
/datum/category_item/player_setup_item/general/psionics/content(var/mob/user) | ||
var/datum/species/mob_species = all_species[pref.species] | ||
if(!(mob_species.spawn_flags & HAS_PSIONICS)) | ||
return | ||
var/list/bought_psionic_powers = list() | ||
for(var/S in pref.psionics) | ||
var/singleton/psionic_power/P = GET_SINGLETON(text2path(S)) | ||
if(istype(P)) | ||
bought_psionic_powers |= P | ||
|
||
var/list/dat = list( | ||
"<b>Psionics:</b><br>" | ||
) | ||
for(var/singleton/psionic_power/P in bought_psionic_powers) | ||
dat += "- <b>[P.name]</b> <a href='?src=\ref[src];remove_psi_power=[P.type]'>-</a><br>" | ||
dat += "<a href='?src=\ref[src];add_psi_power=1'>Add Psionic Power</a><br>" | ||
. = dat.Join() | ||
|
||
/datum/category_item/player_setup_item/general/psionics/OnTopic(var/href,var/list/href_list, var/mob/user) | ||
if(href_list["remove_psi_power"]) | ||
var/power_to_remove = href_list["remove_psi_power"] | ||
if(power_to_remove && (power_to_remove in pref.psionics)) | ||
pref.psionics -= power_to_remove | ||
return TOPIC_REFRESH | ||
|
||
else if(href_list["add_psi_power"]) | ||
var/datum/species/mob_species = all_species[pref.species] | ||
var/total_psi_points = mob_species.character_creation_psi_points | ||
var/list/available_psionics = list() | ||
var/list/psionic_map = list() | ||
var/list/bought_psionic_powers = list() | ||
|
||
for(var/S in pref.psionics) | ||
var/singleton/psionic_power/P = GET_SINGLETON(text2path(S)) | ||
if(istype(P)) | ||
bought_psionic_powers |= P | ||
total_psi_points = max(0, total_psi_points - P.point_cost) | ||
|
||
for(var/singleton/psionic_power/P in GET_SINGLETON_SUBTYPE_LIST(/singleton/psionic_power)) | ||
if((P.ability_flags & PSI_FLAG_CANON) && (P.point_cost <= total_psi_points) && !(P in bought_psionic_powers)) | ||
available_psionics |= "[P.name]" | ||
psionic_map[P.name] = P.type | ||
|
||
if(!length(available_psionics)) | ||
to_chat(user, SPAN_WARNING("You ran out of points!")) | ||
return | ||
|
||
var/new_power = input(user, "Choose a psionic power to add.", "Psionics") as null|anything in available_psionics | ||
if(new_power) | ||
var/singleton/psionic_power/P = GET_SINGLETON(psionic_map[new_power]) | ||
if(istype(P)) | ||
pref.psionics += "[P.type]" | ||
return TOPIC_REFRESH | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/singleton/psionic_power/lightning | ||
name = "Lightning" | ||
desc = "Fire a concentrated lightning bolt. Activate this spell in hand to switch to a second mode that hits living beings in a 4x3 area in front of you." | ||
icon_state = "tech_instabilitytapold" | ||
point_cost = 0 | ||
ability_flags = PSI_FLAG_APEX | ||
spell_path = /obj/item/spell/projectile/psi_lightning | ||
|
||
/obj/item/spell/projectile/psi_lightning | ||
name = "lightning" | ||
icon_state = "chain_lightning" | ||
cast_methods = CAST_RANGED|CAST_USE | ||
aspect = ASPECT_PSIONIC | ||
spell_projectile = /obj/item/projectile/beam/psi_lightning | ||
fire_sound = 'sound/magic/LightningShock.ogg' | ||
cooldown = 10 | ||
psi_cost = 15 | ||
var/mode = 0 | ||
|
||
/obj/item/spell/projectile/psi_lightning/on_use_cast(mob/user, bypass_psi_check) | ||
. = ..(user, TRUE) | ||
mode = !mode | ||
if(mode) | ||
to_chat(user, SPAN_NOTICE("You will now fire area-of-effect lightning in a 4x3 area in front of you.")) | ||
else | ||
to_chat(user, SPAN_NOTICE("You will now fire a normal lightning bolt.")) | ||
|
||
/obj/item/projectile/beam/psi_lightning | ||
name = "psionic lightning" | ||
damage = 30 | ||
armor_penetration = 30 | ||
damage_type = DAMAGE_BURN | ||
pass_flags = PASSTABLE | PASSGRILLE | PASSRAILING | ||
range = 40 | ||
accuracy = 100 | ||
|
||
muzzle_type = /obj/effect/projectile/muzzle/tesla | ||
tracer_type = /obj/effect/projectile/tracer/tesla | ||
impact_type = /obj/effect/projectile/impact/tesla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/singleton/psionic_power/psi_suppression | ||
name = "Psionic Suppression" | ||
desc = "Hold in one of your hands to make yourself invisible to Psi-Search." | ||
icon_state = "const_mend" | ||
point_cost = 1 | ||
ability_flags = PSI_FLAG_ANTAG | ||
spell_path = /obj/item/spell/psi_suppression | ||
|
||
/obj/item/spell/psi_suppression | ||
name = "psionic suppression" | ||
icon_state = "generic" | ||
cast_methods = CAST_INNATE | ||
aspect = ASPECT_PSIONIC | ||
psi_cost = 5 | ||
|
||
/obj/item/spell/psi_suppression/Destroy() | ||
to_chat(owner, SPAN_NOTICE("You are no longer hidden from Psi-Search.")) | ||
REMOVE_TRAIT(owner, TRAIT_PSIONIC_SUPPRESSION, TRAIT_SOURCE_PSIONICS) | ||
return ..() | ||
|
||
/obj/item/spell/psi_suppression/on_innate_cast(mob/user) | ||
. = ..() | ||
if(!.) | ||
return | ||
|
||
to_chat(user, SPAN_NOTICE("You are now hidden from Psi-Search.")) | ||
ADD_TRAIT(user, TRAIT_PSIONIC_SUPPRESSION, TRAIT_SOURCE_PSIONICS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.