Skip to content

Commit

Permalink
Лицензии
Browse files Browse the repository at this point in the history
  • Loading branch information
Microvolnovka19 committed Dec 22, 2024
1 parent 7e82900 commit 55738eb
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tff_modular/modules/psyonics/code/_quirk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ GLOBAL_LIST_INIT(psyonic_schools, list(
var/school
// Вторичная школа псионики
var/secondary_school
/// Два вара скопированные из item_quirk для правильной выдачи лицензии
var/list/where_items_spawned
var/open_backpack = FALSE

/datum/quirk/psyonic/add(client/client_source)
school = client_source?.prefs?.read_preference(/datum/preference/choiced/psyonic_school)
Expand Down Expand Up @@ -111,6 +114,24 @@ GLOBAL_LIST_INIT(psyonic_schools, list(
to_chat(quirk_holder, examine_block(span_infoplain(jointext(fluff_text, "\n• "))))
psyonic_level -= 1 // Обязаловка, иначе выдаст спеллы которые нельзя кастануть

var/obj/item/card/psyonic_license/new_license = new(whom_to_give)

give_item_to_holder(new_license, list(LOCATION_BACKPACK = ITEM_SLOT_BACKPACK, LOCATION_HANDS = ITEM_SLOT_HANDS), flavour_text = "Make sure not to lose it. You can not remake this on the station.")

/datum/quirk/psyonic/proc/give_item_to_holder(obj/item/quirk_item, list/valid_slots, flavour_text = null, default_location = "at your feet", notify_player = TRUE)
if(ispath(quirk_item))
quirk_item = new quirk_item(get_turf(quirk_holder))

var/mob/living/carbon/human/human_holder = quirk_holder

var/where = human_holder.equip_in_one_of_slots(quirk_item, valid_slots, qdel_on_fail = FALSE, indirect_action = TRUE) || default_location

if(where == LOCATION_BACKPACK)
open_backpack = TRUE

if(notify_player)
LAZYADD(where_items_spawned, span_boldnotice("You have \a [quirk_item] [where]. [flavour_text]"))

/datum/quirk/psyonic/remove()
UnregisterSignal(quirk_holder, COMSIG_MOB_GET_STATUS_TAB_ITEMS)

Expand Down
73 changes: 73 additions & 0 deletions tff_modular/modules/psyonics/code/documents.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/obj/item/card/psyonic_license
name = "psyonic license"
desc = "An official license given to psyonic users by the NanoTrasen Psyonics and Eugenics Division itself."
icon = 'tff_modular/modules/psyonics/icons/card.dmi'
icon_state = "card_psy"
inhand_icon_state = "card-id"
lefthand_file = 'icons/mob/inhands/equipment/idcards_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi'
w_class = WEIGHT_CLASS_TINY
pickup_sound = 'sound/items/handling/id_card/id_card_pickup1.ogg'
drop_sound = 'sound/items/handling/id_card/id_card_drop1.ogg'
sound_vary = TRUE
resistance_flags = FIRE_PROOF
var/datum/psyonic_licence_datum/owner_info

/obj/item/card/psyonic_license/New(mob/living/carbon/human/owner)
. = ..()
owner_info = new(owner)

/obj/item/card/psyonic_license/ui_interact(mob/user, datum/tgui/ui)
if(!owner_info)
balloon_alert(user, "The card isn't bound to anyone!")
return

ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "PsyonicLicense")
ui.set_autoupdate(FALSE)
ui.open()

/obj/item/card/psyonic_license/ui_static_data(mob/user)
var/list/data = list()

data["primary_school"] = owner_info.primary_school
data["secondary_school"] = owner_info.secondary_school
data["psyonic_level"] = owner_info.psyonic_level
data["owner_name"] = owner_info.owner_name
data["owner_age"] = owner_info.owner_age
data["owner_preview"] = owner_info.owner_preview
data["owner_species"] = owner_info.owner_species

return data

/datum/psyonic_licence_datum
var/datum/weakref/original_owner
var/owner_name
var/owner_age
var/psyonic_level
var/primary_school
var/secondary_school
var/owner_species
var/icon/owner_preview

/datum/psyonic_licence_datum/New(mob/living/carbon/human/human_owner)
. = ..()
original_owner = WEAKREF(human_owner)
if(original_owner && original_owner.resolve())
var/mob/living/carbon/human/owner = original_owner.resolve()
if(!owner.ispsyonic())
return
var/datum/quirk/psyonic/quirk_holder = owner.get_quirk(/datum/quirk/psyonic)
psyonic_level = quirk_holder.psyonic_level_string
primary_school = quirk_holder.school
secondary_school = quirk_holder.secondary_school
owner_name = owner.real_name
owner_age = owner.age

if (!owner.dna.species.lore_protected && owner.dna.features["custom_species"])
owner_species = "[owner.dna.features["custom_species"]]"
else
owner_species = "[owner.dna.species.name]"

owner_preview = icon2base64(getFlatIcon(owner, SOUTH, no_anim = TRUE))
Binary file added tff_modular/modules/psyonics/icons/card.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -8904,6 +8904,7 @@
#include "tff_modular\modules\psyonics\code\_quirk.dm"
#include "tff_modular\modules\psyonics\code\coersion.dm"
#include "tff_modular\modules\psyonics\code\cyberimp.dm"
#include "tff_modular\modules\psyonics\code\documents.dm"
#include "tff_modular\modules\psyonics\code\energistics.dm"
#include "tff_modular\modules\psyonics\code\psychokinesis.dm"
#include "tff_modular\modules\psyonics\code\redaction.dm"
Expand Down
120 changes: 120 additions & 0 deletions tgui/packages/tgui/interfaces/PsyonicLicense.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { useBackend } from '../backend';
import { Icon, Image, LabeledList, Section, Stack } from '../components';
import { Window } from '../layouts';

type Data = {
character_preview: string;
primary_school: string;
secondary_school: string;
psyonic_level: string;
owner_name: string;
owner_age: number;
owner_species: string;
owner_preview: string;
};

export const PsyonicLicense = (props) => {
const { act, data } = useBackend<Data>();
const {
primary_school,
secondary_school,
psyonic_level,
owner_name,
owner_age,
owner_species,
owner_preview,
} = data;
return (
<Window title="Psyonic License" width={625} height={450} theme="ntos">
<Window.Content>
<Stack minWidth="625px">
<Stack.Item width="50px">
<Icon height="100%" fontSize="50px" name="flushed" color="cyan" />
</Stack.Item>
<Stack.Item width="500px">
<Section
textAlign="center"
title="ЛИЦЕНЗИЯ ПОЛЬЗОВАТЕЛЯ ПСИОНИКИ"
italic
>
{'Мы всегда наблюдаем'}
</Section>
</Stack.Item>
<Stack.Item width="50px">
<Icon height="100%" fontSize="50px" name="flushed" color="cyan" />
</Stack.Item>
</Stack>
<Stack minWidth="625px" verticalAlign="middle">
<Stack.Item
width="34%"
minWidth="207px"
textAlign="center"
align="center"
>
<Section textAlign="center" align="center" height="200px">
{/* <Icon name="brain" fontSize="200px" color="cyan" height="100%" /> */}
<Image
fillPositionedParent
width="100%"
height="200px"
opacity={1}
src={`data:image/jpeg;base64,${data.owner_preview}`}
/>
</Section>
</Stack.Item>
<Stack.Item textAlign="center" height="100%">
<Section title="Информация о владельце" height="200px">
<LabeledList>
<LabeledList.Item label="ФИО">
{data.owner_name}
</LabeledList.Item>
<LabeledList.Item label="Возраст">
{data.owner_age}
</LabeledList.Item>
<LabeledList.Item label="Раса">
{data.owner_species}
</LabeledList.Item>
<LabeledList.Item label="Первичная школа">
{data.primary_school}
</LabeledList.Item>
<LabeledList.Item label="Вторичная школа">
{data.secondary_school}
</LabeledList.Item>
<LabeledList.Item label="Псионический потенциал">
{data.psyonic_level}
</LabeledList.Item>
</LabeledList>
</Section>
</Stack.Item>
</Stack>
<Stack minWidth="625px">
<Stack.Item width="100%">
<Section textAlign="center">
{
'Данная лицензия удостоверяет то, что пользователь является псиоником.'
}
{
' Лицензия пользователя псионики позволяет пользователю применять способности в целях самозащиты, оказания лечебной помощи и в прочих, установленных законом случаев.'
}
{
' Пользователь псионики обязан иметь лицензию при себе всё время, иначе его действия могут быть классифицированы СБ НТ как нелегальные и повлечь за собой юридические последствия.'
}
</Section>
</Stack.Item>
</Stack>
<Stack>
<Stack.Item>
<Section
textColor="red"
fontWeight="900"
minWidth="625px"
textAlign="center"
>
{'ПОДДЕЛКА ЛИЦЕНЗИИ КАРАЕТСЯ ЗАКОНОМ'}
</Section>
</Stack.Item>
</Stack>
</Window.Content>
</Window>
);
};

0 comments on commit 55738eb

Please sign in to comment.