Skip to content

BarDrone Law TGUI & button #4203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/modules/shuttle/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@
"<span class='warning'>These rules are at admin discretion and will be heavily enforced. If you have questions about these rules AHELP it.</span>\n"+\
"<span class='warning'><u></u></span>\n"+\
"<span class='notice'>Prefix your message with :b to speak in Drone Chat.</span>\n"
var/static/list/actions_to_add = list(
/datum/action/drone/bar/information,
)


/mob/living/basic/drone/snowflake/bardrone/Initialize(mapload)
. = ..()
Expand Down
35 changes: 35 additions & 0 deletions monkestation/code/modules/mob/living/basic/drone/bardrone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,38 @@
to_chat(user, span_danger("You need to play [playtime_left] more as [required_role] to spawn as a Bardrone!"))
return FALSE
return ..()

/datum/action/drone/bar/information //sets up action button datum for the button itself
name = "Bar Drone Information"
desc = "Shows information and laws for the Bar Drone."
button_icon = 'icons/obj/art/musician.dmi'
button_icon_state = "synth"

/datum/action/drone/bar/information/Trigger(trigger_flags) //what happens when the button is pressed
var/datum/drone/bar/information/tgui = new(usr)
tgui.ui_interact(usr)

/datum/drone/bar/information //datum required for the tgui component

/datum/drone/bar/information/ui_close()
qdel(src)

/datum/drone/bar/information/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "BarDrone")
ui.open()

/datum/drone/bar/information/ui_state(mob/user) //should always be accessible, only inherited by bardrone anyway
return GLOB.always_state

/mob/living/basic/drone/snowflake/bardrone/Initialize(mapload) //initialization of the action button onto the linked mob (only bardrones)
. = ..()
for (var/action_type in actions_to_add)
var/datum/action/new_action = new action_type(src)
new_action.Grant(src)

/mob/living/basic/drone/snowflake/bardrone/Login() //force open the tgui window with laws on login to the bardrone mob.
..()
var/datum/drone/bar/information/tgui = new(usr)
tgui.ui_interact(usr)
68 changes: 68 additions & 0 deletions tgui/packages/tgui/interfaces/BarDrone.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Section, Box, LabeledList } from '../components';
import { Window } from '../layouts';

export const BarDrone = () => {
return (
<Window title="Drone Information" width={600} height={320}>
<Section title="">
<Box color="red" fontSize="18px" margin="5px 0">
<b>
DO NOT INTERFERE WITH THE ROUND AS A DRONE OR YOU WILL BE DRONE
BANNED
</b>
</Box>
<Box fontSize="14px" margin="5px 0" color="#ffffff">
Drones are a ghost role that are allowed to fix the station and build
things. Interfering with the round as a drone is against the rules.
</Box>
<Box fontSize="14px" color="#ffffff" margin="5px 0">
Actions that constitute interference include, but are not limited to:
</Box>
<LabeledList>
<LabeledList.Item label="">
<Box fontSize="14px" color="#ffffff">
- Interacting with round-critical objects (IDs, weapons,
contraband, powersinks, bombs, etc.)
</Box>
</LabeledList.Item>
<LabeledList.Item label="">
<Box fontSize="14px" color="#ffffff">
- Interacting with living beings (communication, attacking,
healing, etc.)
</Box>
</LabeledList.Item>
<LabeledList.Item label="">
<Box fontSize="14px" color="#ffffff">
- Interacting with non-living beings (dragging bodies, looting
bodies, etc.)
</Box>
</LabeledList.Item>
</LabeledList>
<Box color="red" fontSize="14px" margin="10px 0">
These rules are at admin discretion and will be heavily enforced.
</Box>
<Box
color="red"
fontSize="14px"
margin="10px 0"
textDecoration="underline, bold"
>
<b>
If you do not have the regular drone laws, follow your laws to the
best of your ability.
</b>
</Box>
<Box fontSize="14px" color="#ffffff" margin="5px 0">
Prefix your message with <b>:b</b> to speak in Drone Chat.
</Box>
<Box fontSize="14px" color="#ffffff" margin="5px 0">
Drone Rules and more info can be found at our wiki{' '}
<a href="https://wiki.monkestation.com/en/jobs/non-human/drone">
HERE
</a>
.
</Box>
</Section>
</Window>
);
};
Loading