-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d077489
commit 2bf87d4
Showing
4 changed files
with
158 additions
and
31 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
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,15 @@ | ||
GLOBAL_DATUM_INIT(holoposter_state, /datum/ui_state/holoposter_state, new) | ||
|
||
/datum/ui_state/holoposter_state/can_use_topic(obj/machinery/holoposter/src_object, mob/user) | ||
ASSERT(istype(src_object)) | ||
|
||
if(src_object.stat & NOPOWER) | ||
return UI_CLOSE | ||
|
||
if(isobserver(user) || issilicon(user)) | ||
return user.default_can_use_topic(src_object) | ||
|
||
if(!istype(user.get_active_hand(), /obj/item/tool/multitool)) | ||
return UI_CLOSE | ||
|
||
return user.default_can_use_topic(src_object) |
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,69 @@ | ||
import { capitalize } from '../../common/string'; | ||
import { useBackend } from '../backend'; | ||
import { Box, Button, Section, Stack } from '../components'; | ||
import { GameIcon } from '../components/GameIcon'; | ||
import { Window } from '../layouts'; | ||
|
||
interface HoloposterProps { | ||
posterTypes: Record<string, string>; | ||
isRandom: boolean; | ||
selected: string; | ||
icon: string; | ||
} | ||
|
||
const HoloposterContent = (props: any, context: any) => { | ||
const { act, data } = useBackend<HoloposterProps>(context); | ||
const { posterTypes, isRandom, selected, icon } = data; | ||
|
||
return ( | ||
<Stack fill justify="space-between"> | ||
<Stack.Item | ||
grow | ||
style={{ | ||
'display': 'flex', | ||
'align-items': 'center', | ||
'justify-content': 'center', | ||
}}> | ||
<GameIcon | ||
html={icon} | ||
style={{ | ||
'height': 'auto', | ||
'width': '100%', | ||
}} | ||
/> | ||
</Stack.Item> | ||
<Stack.Item grow={2}> | ||
<Section | ||
fill | ||
title="Holograms" | ||
buttons={ | ||
<Button | ||
icon="random" | ||
selected={isRandom} | ||
tooltip={'Toggle poster rotation.'} | ||
onClick={() => act('random')} | ||
/> | ||
}> | ||
{Object.keys(posterTypes).map((value) => ( | ||
<Button | ||
key={value} | ||
content={capitalize(value)} | ||
selected={selected === value} | ||
onClick={() => act('change', { value: value })} | ||
/> | ||
))} | ||
</Section> | ||
</Stack.Item> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export const Holoposter = (props: any, context: any) => { | ||
return ( | ||
<Window width={320} height={180}> | ||
<Window.Content> | ||
<HoloposterContent /> | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; |