Barotrauma

Barotrauma

Not enough ratings
[AH] ID Card Printer
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
532.258 KB
27 Nov, 2021 @ 3:24am
24 Apr, 2022 @ 6:04am
5 Change Notes ( view )

Subscribe to download
[AH] ID Card Printer

Description
This mod overrides the vanilla ID card. Incompatibilities may arise with other mods that override the very same item.
This mod needs Lua for Barotrauma installed as a server mod.


A BUG INTRODUCED IN THE NEWEST BAROTRAUMA VERSION HAS COMPLETELY BROKEN THE write_character PIN.



Have you ever lost your ID card and wished to have it back without creating a new character? Have you ever wanted to promote a loyal crewmate to an officer and grant them access to sensitive areas of the submarine? Or maybe even, have you ever wanted to demote an officer instead?

If your answer is yes to any of these questions, then this mod is for you.

Now you can fabricate a new item called an ID Card Printer. Once you have the printer installed and powered you can place any ID card inside to modify it. In order to do so you have the following pins:

Pin read_tags, when a one (1) signal is received then all overwritable tags of the ID card are sent as a signal through read_tags_out (or a none signal is sent instead if the card has no such tags).

Pin write_tags, when a signal is received it writes its value as tags into the ID card. In order to prevent exploits with special item tags, it only accepts tags that start with id (for example: id_captain). Any overwrittable tags that are not in the signal are lost, thus you can send a nonsense signal (for example: id_no_tags_for_you) in order to remove all other tags and demote an ID card. In order to write more than a single tag at a time you can concatenate them with commas (for example: id_medic,id_security,id_engineer).

Take into account that valid access tags are different depending on the submarine, although all vanilla submarines use the following: id_captain, id_security, id_medic, id_engineer, id_mechanic. You can also use the read_tags pin with another ID card as a template.

Pin write_character, when a signal is received it searches its value among the names of the crew and prints a suitable ID card clone (for example: if you have Artie Dolittle as a crewmate, if you send an "Artie Dolittle" signal without the quotes then an "Artie Dolittle the assistant" card will be written, albeit with no access tags). You can use this in order to write new ID cards for the crew that lost them. Or for identity theft as a crafty traitor.

You can also now fabricate blank ID cards, which are perfectly suitable for these operations.

For an in game example of a circuit using the printer, this mod also includes an item assembly.

Known issues:
  • A BUG INTRODUCED IN THE NEWEST BAROTRAUMA VERSION HAS COMPLETELY BROKEN THE write_character PIN.
  • Since Lua does not work without a server, this mod does not work in the sub editor or in single player.
  • There might be some exploits in PVP by writing enemy ID cards.

CREDITS:
  • ID Card Printer sprite by LzNN.
13 Comments
Haufzibelstoltz 18 Aug, 2022 @ 7:12pm 
Write_character pin, without crew spawn tags.

lua:

local function replaceIdCardAndWriteCharacter(targetInventory, oldItem, newPrefab, character)
Entity.Spawner.AddItemToRemoveQueue(oldItem)
ah_utils.time.delayFunction(0.1, function()
Entity.Spawner.AddItemToSpawnQueue(newPrefab, targetInventory, nil, nil, function(spawned)
spawned.GetComponentString("IdCard").Initialize(nil, character);
end)
end)
end
local function ah_idcard_printer_write_character(item, contained, signal, connection)
local target = contained[1]
local inventory = target.ParentInventory
local prefab = target.Prefab
local character = ah_utils.table.firstOrNil(Character.CharacterList, function(it)
return it.IsHuman and it.Info.Name == signal.value
end)
if(character ~= nil) then
replaceIdCardAndWriteCharacter(inventory, target, prefab, character)

end
end
Haufzibelstoltz 18 Aug, 2022 @ 1:57pm 
Set InventoryIconColor
lua:
targetItem.SerializableProperties[Identifier("InventoryIconColor")].SetValue(targetItem,Color(255, 0, 0, 255))
Uzric Rash  [author] 4 Aug, 2022 @ 3:45am 
The write_character pin is still broken.
Although it's less of an issue in campaign mode now because idcards are sold in stations.
Still a bummer for traitor mode though.
The other pins work perfectly as far as I know.
Dr.Shimapan 3 Aug, 2022 @ 11:05pm 
any update on broken status?
Uzric Rash  [author] 26 Apr, 2022 @ 2:24am 
Unfortunately upon further investigation it looks like it's not possible: I can change the SpriteColor (that is, when the ID card is dropped on the floor) but the InventoryColor is hardcoded so it can only be changed in the sub editor.
Uzric Rash  [author] 26 Apr, 2022 @ 1:06am 
That's a very good idea. I believe it is possible. When I have more free time I will add that.
thecrazy13 25 Apr, 2022 @ 1:47pm 
Would there be any way to add a write color to this in order to change the cards sprite color?
whosyourdaddy 28 Nov, 2021 @ 8:09am 
Good, maybe one day, lua will realize life service server.
Evil Factory 27 Nov, 2021 @ 6:20am 
Nice!
jimmyl 27 Nov, 2021 @ 3:54am 
though i could just airlock myself and wait 10 minutes to respawn as security