mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Allows PAI range restrictions to be toggled on/off (#22624)
* Allows PAI range restrictions to be toggled on/off New setting to enable or disable the 'leash' on the PAI. * Adds message when it's been deactivated as well. * Apply suggestions from code review Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> * Update pai.dm --------- Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#define PAI_SPAM_TIME (40 SECONDS)
|
||||
|
||||
/// Maximum distance you can set the holoform leash
|
||||
#define HOLOFORM_MAX_RANGE 9
|
||||
#define HOLOFORM_MAX_RANGE 25 // SKYRAT EDIT CHANGE - ORIGINAL: #define HOLOFORM_MAX_RANGE 9
|
||||
/// Minimum distance you can set the holoform leash
|
||||
#define HOLOFORM_MIN_RANGE 3
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/obj/item/pai_card/ui_data(mob/user)
|
||||
. = ..()
|
||||
if(!pai)
|
||||
return
|
||||
|
||||
.["pai"]["leash_enabled"] = pai.leashed
|
||||
|
||||
/obj/item/pai_card/ui_act(action, list/params, datum/tgui/ui)
|
||||
. = ..()
|
||||
if(.)
|
||||
return TRUE
|
||||
|
||||
if(pai && action == "toggle_leash")
|
||||
pai.toggle_leash()
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
@@ -0,0 +1,16 @@
|
||||
/mob/living/silicon/pai/
|
||||
/// Whether or not the PAI is subject to range limitations and able to roam freely, off by default
|
||||
var/leashed = FALSE
|
||||
|
||||
/// Enables or disables the leash, allowing or forbidding the PAI from leaving a specified range
|
||||
/mob/living/silicon/pai/proc/toggle_leash()
|
||||
leashed = !leashed
|
||||
to_chat(src, span_warning("Your virtual leash has been [leashed ? "activated" : "deactivated"]!"))
|
||||
if(leashed)
|
||||
check_distance() // yoink them back
|
||||
|
||||
/mob/living/silicon/pai/check_distance()
|
||||
if(!leashed)
|
||||
return
|
||||
|
||||
return ..()
|
||||
@@ -5732,6 +5732,8 @@
|
||||
#include "modular_skyrat\master_files\code\modules\mod\modules\_module.dm"
|
||||
#include "modular_skyrat\master_files\code\modules\mod\modules\modules_antag.dm"
|
||||
#include "modular_skyrat\master_files\code\modules\modular_computers\computers\item\laptop_presets.dm"
|
||||
#include "modular_skyrat\master_files\code\modules\pai\card.dm"
|
||||
#include "modular_skyrat\master_files\code\modules\pai\pai.dm"
|
||||
#include "modular_skyrat\master_files\code\modules\paperwork\stamps.dm"
|
||||
#include "modular_skyrat\master_files\code\modules\power\cable.dm"
|
||||
#include "modular_skyrat\master_files\code\modules\power\lighting\light_mapping_helpers.dm"
|
||||
|
||||
@@ -28,6 +28,7 @@ type Pai = {
|
||||
transmit: BooleanLike;
|
||||
receive: BooleanLike;
|
||||
range: number;
|
||||
leash_enabled: BooleanLike; // SKYRAT EDIT ADDITION
|
||||
};
|
||||
|
||||
export const PaiCard = (props, context) => {
|
||||
@@ -155,6 +156,7 @@ const PaiOptions = (props, context) => {
|
||||
transmit,
|
||||
receive,
|
||||
range,
|
||||
leash_enabled /* SKYRAT EDIT ADDITION */,
|
||||
},
|
||||
} = data;
|
||||
const suppliedLaws = laws[0] ? decodeHtmlEntities(laws[0]) : 'None';
|
||||
@@ -185,13 +187,25 @@ const PaiOptions = (props, context) => {
|
||||
Toggle
|
||||
</Button>
|
||||
</LabeledList.Item>
|
||||
{/* SKYRAT EDIT ADDITION START */}
|
||||
<LabeledList.Item label="Holoform Leashed">
|
||||
<Button
|
||||
icon={leash_enabled ? 'toggle-off' : 'toggle-on'}
|
||||
onClick={() => act('toggle_leash')}
|
||||
selected={leash_enabled}
|
||||
tooltip="Whether or not the holoform is able to roam freely outside of its range.">
|
||||
Toggle
|
||||
</Button>
|
||||
</LabeledList.Item>
|
||||
{/* SKYRAT EDIT ADDITION END */}
|
||||
<LabeledList.Item label="Holoform Range">
|
||||
<Stack>
|
||||
<Stack.Item>
|
||||
<Button
|
||||
icon="fa-circle-minus"
|
||||
onClick={() => act('decrease_range')}
|
||||
disabled={range === range_min}
|
||||
/* SKYRAT EDIT CHANGE ORIGINAL: disabled={range === range_max} */
|
||||
disabled={!leash_enabled || range === range_min}
|
||||
/>
|
||||
</Stack.Item>
|
||||
<Stack.Item mt={0.5}>{range}</Stack.Item>
|
||||
@@ -199,7 +213,8 @@ const PaiOptions = (props, context) => {
|
||||
<Button
|
||||
icon="fa-circle-plus"
|
||||
onClick={() => act('increase_range')}
|
||||
disabled={range === range_max}
|
||||
/* SKYRAT EDIT CHANGE ORIGINAL: disabled={range === range_max} */
|
||||
disabled={!leash_enabled || range === range_max}
|
||||
/>
|
||||
</Stack.Item>
|
||||
</Stack>
|
||||
|
||||
Reference in New Issue
Block a user