mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
tgui no yell
rebase to master
This commit is contained in:
@@ -24,8 +24,6 @@
|
|||||||
/datum/eventkit/mob_spawner/tgui_static_data(mob/user)
|
/datum/eventkit/mob_spawner/tgui_static_data(mob/user)
|
||||||
var/list/data = list()
|
var/list/data = list()
|
||||||
|
|
||||||
data["mob_paths"] = typesof(/mob);
|
|
||||||
|
|
||||||
data["initial_x"] = usr.x;
|
data["initial_x"] = usr.x;
|
||||||
data["initial_y"] = usr.y;
|
data["initial_y"] = usr.y;
|
||||||
data["initial_z"] = usr.z;
|
data["initial_z"] = usr.z;
|
||||||
@@ -43,12 +41,13 @@
|
|||||||
|
|
||||||
data["path"] = path;
|
data["path"] = path;
|
||||||
|
|
||||||
var/mob/M = new path();
|
if(path)
|
||||||
if(M)
|
var/mob/M = new path();
|
||||||
data["default_path_name"] = M.name;
|
if(M)
|
||||||
data["default_desc"] = M.desc;
|
data["default_path_name"] = M.name;
|
||||||
data["default_flavor_text"] = M.flavor_text;
|
data["default_desc"] = M.desc;
|
||||||
qdel(M);
|
data["default_flavor_text"] = M.flavor_text;
|
||||||
|
qdel(M);
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@@ -60,7 +59,11 @@
|
|||||||
return
|
return
|
||||||
switch(action)
|
switch(action)
|
||||||
if("select_path")
|
if("select_path")
|
||||||
path = params["path"]
|
var/list/choices = typesof(/mob)
|
||||||
|
var/newPath = tgui_input_list(usr, "Please select the new path of the mob you want to spawn.", items = choices)
|
||||||
|
|
||||||
|
path = newPath
|
||||||
|
|
||||||
return TRUE
|
return TRUE
|
||||||
if("loc_lock")
|
if("loc_lock")
|
||||||
loc_lock = !loc_lock
|
loc_lock = !loc_lock
|
||||||
@@ -77,6 +80,10 @@
|
|||||||
var/y = params["y"]
|
var/y = params["y"]
|
||||||
var/z = params["z"]
|
var/z = params["z"]
|
||||||
|
|
||||||
|
if(!name)
|
||||||
|
to_chat(usr, "<span class='warning'>Name cannot be empty.</span>")
|
||||||
|
return FALSE
|
||||||
|
|
||||||
var/turf/T = locate(x, y, z)
|
var/turf/T = locate(x, y, z)
|
||||||
if(!T)
|
if(!T)
|
||||||
to_chat(usr, "<span class='warning'>Those coordinates are outside the boundaries of the map.</span>")
|
to_chat(usr, "<span class='warning'>Those coordinates are outside the boundaries of the map.</span>")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { BooleanLike } from '../../common/react';
|
import { BooleanLike } from '../../common/react';
|
||||||
import { useBackend, useLocalState } from '../backend';
|
import { useBackend, useLocalState } from '../backend';
|
||||||
import { Button, Dropdown, Flex, Input, Knob, LabeledList, NumberInput, Section, Tabs, TextArea } from '../components';
|
import { Button, Flex, Input, Knob, LabeledList, NumberInput, Section, Tabs, TextArea } from '../components';
|
||||||
import { Window } from '../layouts';
|
import { Window } from '../layouts';
|
||||||
|
|
||||||
type Data = {
|
type Data = {
|
||||||
@@ -12,8 +12,6 @@ type Data = {
|
|||||||
|
|
||||||
default_speak_emotes: string[];
|
default_speak_emotes: string[];
|
||||||
|
|
||||||
mob_paths: string[];
|
|
||||||
|
|
||||||
loc_lock: BooleanLike;
|
loc_lock: BooleanLike;
|
||||||
loc_x: number;
|
loc_x: number;
|
||||||
loc_y: number;
|
loc_y: number;
|
||||||
@@ -55,11 +53,23 @@ const GeneralMobSettings = (props, context) => {
|
|||||||
const { act, data } = useBackend<Data>(context);
|
const { act, data } = useBackend<Data>(context);
|
||||||
|
|
||||||
const [amount, setAmount] = useLocalState(context, 'amount', 1);
|
const [amount, setAmount] = useLocalState(context, 'amount', 1);
|
||||||
const [name, setName] = useLocalState(context, 'name', data.default_path_name);
|
const [name, setName] = useLocalState(
|
||||||
|
context,
|
||||||
|
'name',
|
||||||
|
data.default_path_name
|
||||||
|
);
|
||||||
const [desc, setDesc] = useLocalState(context, 'desc', data.default_desc);
|
const [desc, setDesc] = useLocalState(context, 'desc', data.default_desc);
|
||||||
const [flavorText, setFlavorText] = useLocalState(context, 'flavorText', data.default_flavor_text);
|
const [flavorText, setFlavorText] = useLocalState(
|
||||||
|
context,
|
||||||
|
'flavorText',
|
||||||
|
data.default_flavor_text
|
||||||
|
);
|
||||||
|
|
||||||
const [sizeMultiplier, setSizeMultiplier] = useLocalState(context, 'sizeMultiplier', 100);
|
const [sizeMultiplier, setSizeMultiplier] = useLocalState(
|
||||||
|
context,
|
||||||
|
'sizeMultiplier',
|
||||||
|
100
|
||||||
|
);
|
||||||
|
|
||||||
const [x, setX] = useLocalState(context, 'x', data.initial_x);
|
const [x, setX] = useLocalState(context, 'x', data.initial_x);
|
||||||
const [y, setY] = useLocalState(context, 'y', data.initial_y);
|
const [y, setY] = useLocalState(context, 'y', data.initial_y);
|
||||||
@@ -72,18 +82,26 @@ const GeneralMobSettings = (props, context) => {
|
|||||||
<Section title="General">
|
<Section title="General">
|
||||||
<LabeledList>
|
<LabeledList>
|
||||||
<LabeledList.Item label="Mob Name">
|
<LabeledList.Item label="Mob Name">
|
||||||
<Input fluid value={name || data.default_path_name} onChange={(e, val) => setName(val)} />
|
<Input
|
||||||
|
fluid
|
||||||
|
value={name || data.default_path_name}
|
||||||
|
onChange={(e, val) => setName(val)}
|
||||||
|
/>
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label="Mob Path">
|
<LabeledList.Item label="Mob Path">
|
||||||
<Dropdown
|
<Button
|
||||||
fluid
|
fluid
|
||||||
options={data.mob_paths}
|
content={data.path || 'Select Path'}
|
||||||
displayText={data.path || 'No path selected yet.'}
|
onClick={(val) => act('select_path')}
|
||||||
onSelected={(val) => act('select_path', { path: val })}
|
|
||||||
/>
|
/>
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label="Spawn Amount">
|
<LabeledList.Item label="Spawn Amount">
|
||||||
<NumberInput value={amount} minValue={0} maxValue={256} onChange={(e, val) => setAmount(val)} />
|
<NumberInput
|
||||||
|
value={amount}
|
||||||
|
minValue={0}
|
||||||
|
maxValue={256}
|
||||||
|
onChange={(e, val) => setAmount(val)}
|
||||||
|
/>
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label={'Size (' + sizeMultiplier + '%)'}>
|
<LabeledList.Item label={'Size (' + sizeMultiplier + '%)'}>
|
||||||
<Knob
|
<Knob
|
||||||
@@ -117,10 +135,20 @@ const GeneralMobSettings = (props, context) => {
|
|||||||
maxValue={256}
|
maxValue={256}
|
||||||
onChange={(e, val) => setZ(val)}
|
onChange={(e, val) => setZ(val)}
|
||||||
/>
|
/>
|
||||||
<Button.Checkbox content="Lock coords to self" checked={data.loc_lock} onClick={() => act('loc_lock')} />
|
<Button.Checkbox
|
||||||
|
content="Lock coords to self"
|
||||||
|
checked={data.loc_lock}
|
||||||
|
onClick={() => act('loc_lock')}
|
||||||
|
/>
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
<LabeledList.Item label="Spawn Radius (WIP)">
|
<LabeledList.Item label="Spawn Radius (WIP)">
|
||||||
<NumberInput value={radius} disabled minValue={0} maxValue={256} onChange={(e, val) => setRadius(val)} />
|
<NumberInput
|
||||||
|
value={radius}
|
||||||
|
disabled
|
||||||
|
minValue={0}
|
||||||
|
maxValue={256}
|
||||||
|
onChange={(e, val) => setRadius(val)}
|
||||||
|
/>
|
||||||
</LabeledList.Item>
|
</LabeledList.Item>
|
||||||
</LabeledList>
|
</LabeledList>
|
||||||
</Section>
|
</Section>
|
||||||
@@ -129,7 +157,11 @@ const GeneralMobSettings = (props, context) => {
|
|||||||
<Flex.Item width="50%">
|
<Flex.Item width="50%">
|
||||||
Description:
|
Description:
|
||||||
<br />
|
<br />
|
||||||
<TextArea height={'18rem'} onChange={(e, val) => setDesc(val)} value={desc || data.default_desc} />
|
<TextArea
|
||||||
|
height={'18rem'}
|
||||||
|
onChange={(e, val) => setDesc(val)}
|
||||||
|
value={desc || data.default_desc}
|
||||||
|
/>
|
||||||
</Flex.Item>
|
</Flex.Item>
|
||||||
<Flex.Item width="50%">
|
<Flex.Item width="50%">
|
||||||
Flavor Text:
|
Flavor Text:
|
||||||
@@ -147,9 +179,9 @@ const GeneralMobSettings = (props, context) => {
|
|||||||
onCLick={() =>
|
onCLick={() =>
|
||||||
act('start_spawn', {
|
act('start_spawn', {
|
||||||
amount: amount,
|
amount: amount,
|
||||||
name: name,
|
name: name || data.default_path_name,
|
||||||
desc: desc,
|
desc: desc || data.default_desc,
|
||||||
flavor_text: flavorText,
|
flavor_text: flavorText || data.default_flavor_text,
|
||||||
size_multiplier: sizeMultiplier * 0.01,
|
size_multiplier: sizeMultiplier * 0.01,
|
||||||
x: data.loc_lock ? data.loc_x : x,
|
x: data.loc_lock ? data.loc_x : x,
|
||||||
y: data.loc_lock ? data.loc_y : y,
|
y: data.loc_lock ? data.loc_y : y,
|
||||||
|
|||||||
Reference in New Issue
Block a user