Skip to content

Commit

Permalink
[TWEAK] Bio-Chip Pad Renaming Tracker Bio-Cips (ParadiseSS13#25617)
Browse files Browse the repository at this point in the history
* Allows the biochip pad to change the GPS tag on the tracker implant. No more standard 'TRACK0' on everything.

Updates the UI for the biochip pad.
Adds the biochip pad to the protolathe under the medical tab

* Prettier!!! :)

* Moves the "tag" property below the general blurbs.

* Update code/game/objects/items/weapons/bio_chips/bio_chip_pad.dm

Co-authored-by: Luc <[email protected]>
Signed-off-by: Spaghetti-bit <[email protected]>

* Merge Conflict Fix (1/2)

* MC (1.5/2)

* Merge Conflict Resolution (Hopefully)

---------

Signed-off-by: Spaghetti-bit <[email protected]>
Co-authored-by: Luc <[email protected]>
  • Loading branch information
Spaghetti-bit and lewcc committed Jun 25, 2024
1 parent 6b70c59 commit 457f9ff
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 54 deletions.
19 changes: 19 additions & 0 deletions code/game/objects/items/weapons/bio_chips/bio_chip_pad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@
"function" = implant_data.function,
"image" = "[icon2base64(icon(initial(case.imp.icon), initial(case.imp.icon_state), SOUTH, 1))]",
)
if(istype(case.imp, /obj/item/bio_chip/tracking))
var/obj/item/bio_chip/tracking/T = case.imp
data["gps"] = T
data["tag"] = T.gpstag
else
data["gps"] = null
data["tag"] = null
else
// Sanity check in the case that a pad is used for multiple types of implants.
data["gps"] = null
data["tag"] = null

return data

/obj/item/bio_chip_pad/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
Expand All @@ -99,3 +111,10 @@
switch(action)
if("eject_case")
eject_case(ui.user)
if("tag")
var/obj/item/bio_chip/tracking/T = case.imp
var/newtag = params["newtag"] || ""
newtag = uppertext(paranoid_sanitize(copytext_char(newtag, 1, 5)))
if(!length(newtag) || T.gpstag == newtag)
return
T.gpstag = newtag
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
implant_state = "implant-nanotrasen"
var/warn_cooldown = 0
var/obj/item/gps/internal_gps
var/gpstag = "TRACK0"
var/internal_gps_path = /obj/item/gps/internal/tracking_implant

/obj/item/bio_chip/tracking/Initialize(mapload)
Expand All @@ -23,14 +24,15 @@
if(!.)
return
internal_gps = new internal_gps_path(src)
if(gpstag)
internal_gps.gpstag = gpstag

/obj/item/bio_chip/tracking/removed(mob/target)
. = ..()
if(.)
QDEL_NULL(internal_gps)

/obj/item/gps/internal/tracking_implant
gpstag = "TRACK0"
local = FALSE

/obj/item/bio_chip_implanter/tracking
Expand Down
10 changes: 10 additions & 0 deletions code/modules/research/designs/medical_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,16 @@
////////////Regular Implants/////////////
/////////////////////////////////////////

/datum/design/bio_chip_pad
name = "Bio-chip Pad"
desc = "Used to modify bio-chips."
id = "biochip_pad"
req_tech = list("materials" = 3, "biotech" = 4, "programming" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 2000, MAT_GLASS = 1000)
build_path = /obj/item/bio_chip_pad
category = list("Medical")

/datum/design/bio_chip_implanter
name = "Bio-chip Implanter"
desc = "A sterile automatic bio-chip injector."
Expand Down
50 changes: 38 additions & 12 deletions tgui/packages/tgui/interfaces/BioChipPad.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
import { useBackend } from '../backend';
import { Button, Section, Box, LabeledList } from '../components';
import { useBackend, useLocalState } from '../backend';
import { Button, Section, Box, LabeledList, Input, Icon } from '../components';
import { Window } from '../layouts';

export const BioChipPad = (props, context) => {
const { act, data } = useBackend(context);
const { implant, contains_case } = data;
const { implant, contains_case, gps, tag } = data;
const [newTag, setNewTag] = useLocalState(context, 'newTag', tag);

return (
<Window width={410} height={400}>
<Window width={410} height={325}>
<Window.Content>
<Section title="Bio-chip Mini-Computer">
<Section
fill
title="Bio-chip Mini-Computer"
buttons={
<Box>
<Button
content="Eject Case"
icon="eject"
disabled={!contains_case}
onClick={() => act('eject_case')}
/>
</Box>
}
>
{implant && contains_case ? (
<>
<Box bold mb={2}>
Expand All @@ -32,20 +46,32 @@ export const BioChipPad = (props, context) => {
<LabeledList.Item label="Function">
{implant.function}
</LabeledList.Item>
{!!gps && (
<LabeledList.Item label="Tag">
<Input
width="5.5rem"
value={tag}
onEnter={() => act('tag', { newtag: newTag })}
onInput={(e, value) => setNewTag(value)}
/>
<Button
disabled={tag === newTag}
width="20px"
mb="0"
ml="0.25rem"
onClick={() => act('tag', { newtag: newTag })}
>
<Icon name="pen" />
</Button>
</LabeledList.Item>
)}
</LabeledList>
</>
) : contains_case ? (
<Box>This bio-chip case has no implant!</Box>
) : (
<Box>Please insert a bio-chip casing!</Box>
)}
<Button
mt={2}
content="Eject Case"
icon="eject"
disabled={!contains_case}
onClick={() => act('eject_case')}
/>
</Section>
</Window.Content>
</Window>
Expand Down
82 changes: 41 additions & 41 deletions tgui/public/tgui.bundle.js

Large diffs are not rendered by default.

0 comments on commit 457f9ff

Please sign in to comment.