mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
[MODULAR] Poem of Communal Souls NIFSoft (#19884)
* the start * TGUI * passing by * more * Update station_pass.dm * persistence * Update NifStationPass.js * Update station_pass.dm * Update station_pass.dm * Update modular_skyrat/modules/modular_implants/code/nifsofts/station_pass.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update modular_skyrat/modules/modular_implants/code/nifsofts/station_pass.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * renaming * Update soul_poem.dm * Update soul_poem.dm * Update soul_poem.dm * cleans some more stuff up * Update soul_poem.dm * Update soul_poem.dm * pain --------- Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
@@ -44,6 +44,12 @@
|
||||
var/datum/component/nif_examine/examine_component = GetComponent(/datum/component/nif_examine)
|
||||
|
||||
persistence.nif_examine_text = examine_component?.nif_examine_text
|
||||
for(var/datum/nifsoft/nifsoft as anything in installed_nif.loaded_nifsofts)
|
||||
if(!nifsoft.persistence)
|
||||
continue
|
||||
|
||||
nifsoft.save_persistence_data(persistence)
|
||||
|
||||
|
||||
/// Loads the NIF data for an individual user.
|
||||
/mob/living/carbon/human/proc/load_nif_data(datum/modular_persistence/persistence)
|
||||
@@ -64,4 +70,22 @@
|
||||
if(examine_component)
|
||||
examine_component.nif_examine_text = persistence.nif_examine_text
|
||||
|
||||
/// Loads the modular persistence data for a NIFSoft
|
||||
/datum/nifsoft/proc/load_persistence_data()
|
||||
if(!linked_mob || !persistence)
|
||||
return FALSE
|
||||
var/obj/item/organ/internal/brain/linked_brain = linked_mob.getorganslot(ORGAN_SLOT_BRAIN)
|
||||
if(!linked_brain || !linked_brain.modular_persistence)
|
||||
return FALSE
|
||||
|
||||
return linked_brain.modular_persistence
|
||||
|
||||
|
||||
/// Saves the modular persistence data for a NIFSoft
|
||||
/datum/nifsoft/proc/save_persistence_data(datum/modular_persistence/persistence)
|
||||
if(!persistence)
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
#undef LOSS_WITH_NIF_UNINSTALLED
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
///What programs are currently loaded onto the NIF?
|
||||
var/list/loaded_nifsofts = list()
|
||||
///What programs come already installed on the NIF?
|
||||
var/list/preinstalled_nifsofts = list()
|
||||
var/list/preinstalled_nifsofts = list(/datum/nifsoft/soul_poem)
|
||||
///This shows up in the NIF settings screen as a way to ICly display lore.
|
||||
var/manufacturer_notes = "There is no data currently avalible for this product."
|
||||
|
||||
@@ -106,16 +106,9 @@
|
||||
. = ..()
|
||||
|
||||
durability = max_durability
|
||||
loaded_nifsofts = preinstalled_nifsofts
|
||||
|
||||
for(var/datum/nifsoft/preinstalled_nifsoft as anything in preinstalled_nifsofts)
|
||||
install_nifsoft(preinstalled_nifsoft)
|
||||
|
||||
power_level = max_power_level
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/nif/Destroy()
|
||||
|
||||
|
||||
if(linked_mob)
|
||||
UnregisterSignal(linked_mob, COMSIG_LIVING_DEATH, PROC_REF(damage_on_death))
|
||||
|
||||
@@ -152,6 +145,10 @@
|
||||
linked_mob.AddComponent(/datum/component/nif_examine)
|
||||
RegisterSignal(linked_mob, COMSIG_LIVING_DEATH, PROC_REF(damage_on_death))
|
||||
|
||||
if(preinstalled_nifsofts)
|
||||
send_message("Loading preinstalled NIFSofts, please wait...")
|
||||
addtimer(CALLBACK(src, PROC_REF(install_preinstalled_nifsofts)), 3 SECONDS)
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/nif/Remove(mob/living/carbon/organ_owner, special = FALSE)
|
||||
. = ..()
|
||||
|
||||
@@ -165,6 +162,16 @@
|
||||
if(linked_mob)
|
||||
UnregisterSignal(linked_mob, COMSIG_LIVING_DEATH, PROC_REF(damage_on_death))
|
||||
|
||||
///Installs preinstalled NIFSofts
|
||||
/obj/item/organ/internal/cyberimp/brain/nif/proc/install_preinstalled_nifsofts()
|
||||
if(!preinstalled_nifsofts)
|
||||
return FALSE
|
||||
|
||||
for(var/datum/nifsoft/preinstalled_nifsoft as anything in preinstalled_nifsofts)
|
||||
new preinstalled_nifsoft(src)
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/nif/process(delta_time)
|
||||
. = ..()
|
||||
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
///What NIF models can this software be installed on?
|
||||
var/list/compatible_nifs = list(/obj/item/organ/internal/cyberimp/brain/nif)
|
||||
|
||||
///Does the NIFSoft have anything that is saved cross-round?
|
||||
var/persistence = FALSE
|
||||
|
||||
/datum/nifsoft/New(obj/item/organ/internal/cyberimp/brain/nif/recepient_nif)
|
||||
. = ..()
|
||||
|
||||
@@ -48,6 +51,7 @@
|
||||
if(!recepient_nif.install_nifsoft(src))
|
||||
qdel(src)
|
||||
|
||||
load_persistence_data()
|
||||
|
||||
/datum/nifsoft/Destroy()
|
||||
if(active)
|
||||
@@ -121,6 +125,9 @@
|
||||
program_name = scrambled_name
|
||||
addtimer(CALLBACK(src, .proc/restore_name), 60 SECONDS)
|
||||
|
||||
/datum/nifsoft/ui_state(mob/user)
|
||||
return GLOB.conscious_state
|
||||
|
||||
/// A disk that can upload NIFSofts to a recpient with a NIFSoft installed.
|
||||
/obj/item/disk/nifsoft_uploader
|
||||
name = "Generic NIFSoft datadisk"
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/obj/item/disk/nifsoft_uploader/soul_poem
|
||||
name = "Automatic Appraisal"
|
||||
loaded_nifsoft = /datum/nifsoft/soul_poem
|
||||
|
||||
//Modular Persistence variables for the soul_poem NIFSoft
|
||||
/datum/modular_persistence
|
||||
///What name is saved to the station pass NIFSoft?
|
||||
var/soul_poem_nifsoft_name
|
||||
///What message is saved to the station pass NIFSoft?
|
||||
var/soul_poem_nifsoft_message
|
||||
|
||||
/datum/nifsoft/soul_poem
|
||||
name = "Poem of Communal Souls"
|
||||
program_desc = "The Poem of Communal Souls was the first commission the Altspace Coven ever took; a rare occasion for their involvement in NIFSoft development. This program was originally commissioned by a then-underground group of ravers as a sort of 'social contagion' for the purpose of spreading peace, love, unity, and respect. The software operates by allowing different users running it to ambiently share 'Verses' with each other, small portions of their unique nanomachine fields that carry user-set messages; sometimes actual poetry, short biographies, or simple hope to meet and bond with other NIF users. Each trade of nanomachine packets represents a physical memory of the user who traded it, some long-time 'Poets' surrounded with a dazzling rainbow of different past messages."
|
||||
persistence = TRUE
|
||||
purchase_price = 0 //It came free with your NIF.
|
||||
|
||||
///Is the NIFSoft transmitting data?
|
||||
var/transmitting_data = TRUE
|
||||
///Is the NIFSoft receiving data?
|
||||
var/receiving_data = TRUE
|
||||
///What username is being sent out?
|
||||
var/transmitted_name = ""
|
||||
///What message is being sent to other users?
|
||||
var/transmitted_message = ""
|
||||
///What ckey is being used by the owner? This is mostly here so that messages can't get spammed
|
||||
var/transmitted_identifier = ""
|
||||
|
||||
///What messages has the user received?
|
||||
var/list/message_list = list()
|
||||
///The datum that is being used to receive messages
|
||||
var/datum/proximity_monitor/advanced/soul_poem/proximity_datum
|
||||
|
||||
/datum/nifsoft/soul_poem/New()
|
||||
. = ..()
|
||||
|
||||
if(!transmitted_name)
|
||||
transmitted_name = linked_mob.name
|
||||
|
||||
if(!transmitted_message)
|
||||
transmitted_message = "Hello, I am [transmitted_name], it's nice to meet you!"
|
||||
|
||||
transmitted_identifier = linked_mob.ckey
|
||||
|
||||
add_message("soul_poem_nifsoft", name, "Hello World")
|
||||
proximity_datum = new(linked_mob, 1)
|
||||
proximity_datum.parent_nifsoft = WEAKREF(src)
|
||||
|
||||
/datum/nifsoft/soul_poem/Destroy()
|
||||
qdel(proximity_datum)
|
||||
proximity_datum = null
|
||||
|
||||
return ..()
|
||||
|
||||
/**
|
||||
* Adds a message to the message_list of the parent NIFSoft based off the sender_identifier, received_name, and received_message.
|
||||
*
|
||||
* * sender_identifier - This variable is used to determine the identity of the sender. This is mostly just here so that the same person can't send multiple messages.
|
||||
* * received_name - What name is attached to the associated message?
|
||||
* * received_message - The contents of the added message.
|
||||
*/
|
||||
|
||||
/datum/nifsoft/soul_poem/proc/add_message(sender_identifier, received_name, received_message)
|
||||
if(!received_message || !receiving_data)
|
||||
return FALSE
|
||||
|
||||
var/message_name = "Unkown User"
|
||||
if(received_name)
|
||||
message_name = received_name
|
||||
|
||||
for(var/message in message_list)
|
||||
if(message["identifier"] == sender_identifier)
|
||||
message["sender_name"] = message_name
|
||||
message["message"] = received_message
|
||||
message["timestamp"] = station_time_timestamp()
|
||||
return TRUE
|
||||
|
||||
message_list.Insert(1, list(list(identifier = sender_identifier, sender_name = received_name, message = received_message, timestamp = station_time_timestamp())))
|
||||
return TRUE
|
||||
|
||||
/// Removes the message_to_remove from the message_list, If the message cannot be found the proc will return FALSE, otherwise it will delete the message_to_remove and return TRUE.
|
||||
/datum/nifsoft/soul_poem/proc/remove_message(list/message_to_remove)
|
||||
if(!message_to_remove)
|
||||
return FALSE
|
||||
|
||||
var/list/removed_message = message_to_remove[1]
|
||||
for(var/list/message in message_list)
|
||||
if(message["identifier"] == removed_message["identifier"])
|
||||
message_list -= list(message)
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
|
||||
/datum/nifsoft/soul_poem/activate()
|
||||
. = ..()
|
||||
ui_interact(linked_mob)
|
||||
|
||||
|
||||
/datum/nifsoft/soul_poem/load_persistence_data()
|
||||
. = ..()
|
||||
var/datum/modular_persistence/persistence = .
|
||||
if(!persistence)
|
||||
return FALSE
|
||||
|
||||
transmitted_name = persistence.soul_poem_nifsoft_name
|
||||
transmitted_message = persistence.soul_poem_nifsoft_message
|
||||
return TRUE
|
||||
|
||||
/datum/nifsoft/soul_poem/save_persistence_data(datum/modular_persistence/persistence)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return FALSE
|
||||
|
||||
persistence.soul_poem_nifsoft_message = transmitted_message
|
||||
persistence.soul_poem_nifsoft_name = transmitted_name
|
||||
return TRUE
|
||||
|
||||
/// Attempts to send a message to the target_nifsoft, if it exists. Returns FALSE if the message fails to send.
|
||||
/datum/nifsoft/soul_poem/proc/send_message(datum/nifsoft/soul_poem/target_nifsoft)
|
||||
if(!transmitting_data || !target_nifsoft || !transmitted_message)
|
||||
return FALSE
|
||||
|
||||
if(!target_nifsoft.add_message(transmitted_identifier, transmitted_name, transmitted_message))
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
/// The proximty_monitor datum used by the soul_poem NIFSoft
|
||||
/datum/proximity_monitor/advanced/soul_poem
|
||||
/// What NIFSoft is this currently attached to?
|
||||
var/datum/weakref/parent_nifsoft
|
||||
|
||||
/datum/proximity_monitor/advanced/soul_poem/on_entered(turf/source, atom/movable/entered)
|
||||
. = ..()
|
||||
if(host == entered)
|
||||
return FALSE
|
||||
|
||||
var/datum/nifsoft/soul_poem/receiving_nifsoft = parent_nifsoft.resolve()
|
||||
if(!receiving_nifsoft || (!receiving_nifsoft.transmitting_data && !receiving_nifsoft.receiving_data))
|
||||
return FALSE
|
||||
|
||||
var/mob/living/carbon/human/entered_human = entered
|
||||
if(!ishuman(entered_human))
|
||||
return FALSE
|
||||
|
||||
var/datum/nifsoft/soul_poem/sending_nifsoft = entered_human.find_nifsoft(/datum/nifsoft/soul_poem)
|
||||
if(!sending_nifsoft)
|
||||
return FALSE
|
||||
|
||||
sending_nifsoft.send_message(receiving_nifsoft)
|
||||
receiving_nifsoft.send_message(sending_nifsoft)
|
||||
|
||||
return TRUE
|
||||
|
||||
//TGUI
|
||||
/datum/nifsoft/soul_poem/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(linked_mob, src, ui)
|
||||
|
||||
if(!ui)
|
||||
ui = new(linked_mob, src, "NifSoulPoem", name)
|
||||
ui.open()
|
||||
|
||||
/datum/nifsoft/soul_poem/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["messages"] = message_list
|
||||
|
||||
data["receiving_data"] = receiving_data
|
||||
data["transmitting_data"] = transmitting_data
|
||||
|
||||
return data
|
||||
|
||||
/datum/nifsoft/soul_poem/ui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["name_to_send"] = transmitted_name
|
||||
data["text_to_send"] = transmitted_message
|
||||
|
||||
return data
|
||||
|
||||
/datum/nifsoft/soul_poem/ui_act(action, list/params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("change_message")
|
||||
if(!params["new_message"])
|
||||
return FALSE
|
||||
|
||||
transmitted_message = params["new_message"]
|
||||
return TRUE
|
||||
|
||||
if("change_name")
|
||||
if(!params["new_name"])
|
||||
return FALSE
|
||||
|
||||
transmitted_name = params["new_name"]
|
||||
return TRUE
|
||||
|
||||
if("remove_message")
|
||||
if(!params["message_to_remove"])
|
||||
return FALSE
|
||||
|
||||
if(!remove_message(list(params["message_to_remove"])))
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
if("toggle_transmitting")
|
||||
transmitting_data = !transmitting_data
|
||||
return TRUE
|
||||
|
||||
if("toggle_receiving")
|
||||
receiving_data = !receiving_data
|
||||
return TRUE
|
||||
@@ -6291,6 +6291,7 @@
|
||||
#include "modular_skyrat\modules\modular_implants\code\nifsofts\money_sense.dm"
|
||||
#include "modular_skyrat\modules\modular_implants\code\nifsofts\prop_summoner.dm"
|
||||
#include "modular_skyrat\modules\modular_implants\code\nifsofts\shapeshifter.dm"
|
||||
#include "modular_skyrat\modules\modular_implants\code\nifsofts\soul_poem.dm"
|
||||
#include "modular_skyrat\modules\modular_items\code\bags.dm"
|
||||
#include "modular_skyrat\modules\modular_items\code\cash.dm"
|
||||
#include "modular_skyrat\modules\modular_items\code\ciggies.dm"
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import { useBackend } from '../backend';
|
||||
import { Window } from '../layouts';
|
||||
import { Section, Divider, Flex, Box, BlockQuote, Input, LabeledList, Button } from '../components';
|
||||
|
||||
export const NifSoulPoem = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
name_to_send,
|
||||
text_to_send,
|
||||
messages = [],
|
||||
receiving_data,
|
||||
transmitting_data,
|
||||
} = data;
|
||||
return (
|
||||
<Window width={500} height={700}>
|
||||
<Window.Content scrollable>
|
||||
<Section title="Messages">
|
||||
{messages.map((message) => (
|
||||
<Flex.Item key={message.key}>
|
||||
<Box textAlign="center" fontSize="14px">
|
||||
<b>{message.sender_name} </b>
|
||||
<Button
|
||||
icon="trash"
|
||||
tooltip={'Delete this message'}
|
||||
onClick={() =>
|
||||
act('remove_message', { message_to_remove: message })
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
<Divider />
|
||||
<Box>{message.message}</Box>
|
||||
<br />
|
||||
<BlockQuote>Time Recieved: {message.timestamp}</BlockQuote>
|
||||
</Flex.Item>
|
||||
))}
|
||||
</Section>
|
||||
<Section title="Settings">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label={'Display Name'}>
|
||||
<Input
|
||||
value={name_to_send}
|
||||
onInput={(e, value) => act('change_name', { new_name: value })}
|
||||
width="100%"
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label={'Message'}>
|
||||
<Input
|
||||
value={text_to_send}
|
||||
onInput={(e, value) =>
|
||||
act('change_message', { new_message: value })
|
||||
}
|
||||
width="100%"
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Toggle transmitting">
|
||||
<Button
|
||||
fluid
|
||||
onClick={() => act('toggle_transmitting', {})}
|
||||
color={transmitting_data ? 'green' : 'red'}>
|
||||
{transmitting_data ? 'True' : 'False'}
|
||||
</Button>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Toggle receiving">
|
||||
<Button
|
||||
fluid
|
||||
onClick={() => act('toggle_receiving', {})}
|
||||
color={receiving_data ? 'green' : 'red'}>
|
||||
{receiving_data ? 'True' : 'False'}
|
||||
</Button>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user