bdfbafd54a
* first * printer, tools, prefab, assemblies, power.dm(looks like so) * integrated circuit * input memory epv2 exonet node * input,manipulation,output,poweract * fixes * reagents fix * time * minor fixes * all errors fixed * bugfixes * prefab, tickers, camera, led, assembling bugs, * All except exonet node UI and led's * cameras, led and some exonet * 11 * 111 * lesser fixes. * botanic shit * icon * nobludgeon for debugger * gui, typos * gui, typos * dopil * smaller diff, rm template and node * mergefix * list fix * weakrefs * fixes * Clamp, crowbar, minor shit * fukken refs * exonet node refactor, put defines into defines. * dme upload * defines,helpers,exonet node, botanic * TRUE/FALSE and minors * datumfix * moved init to ss * quickfix * cryo runtime fix * datums quickfix * admins * minor fixes * fixes * refs,tools * printer * fixes * fixes * check interactivity redo. * usercheck, fixes * weakrefs * T/F * WEAKREF * unfuckup * fixes and shit * Update assemblies.dm * crypto * fuck * SS, final fixes * looks like final fixes. * release,crypto, ranged scnner * defines * Resets some files * find/replace * Associative addresses * Update exonet_node.dm * push * there we go * fix * FINISH! * WEAKREFUCK * FixeS * Woops * Woops * woops * fix * fixes * loops * fix or break? * fix,dammit! * fix,dammit![2] * fix,dammit![3] * disconnect * fix * input * lag * pin * map * sdegsds * >>>lights * fixes le map * makes circuits actually speak * halffix * resets maps to tgstation master * typeless loops in init * Changes subsystem to not initialize new types and use initial instead. * fix * trying to get rid of obj list. * get rid of . * Better code makes better mind * fixed * pin fixes * fix * compiled tgui * circuits config * spelling
102 lines
3.9 KiB
Plaintext
102 lines
3.9 KiB
Plaintext
#define WIRE "wire"
|
|
#define WIRING "wiring"
|
|
#define UNWIRE "unwire"
|
|
#define UNWIRING "unwiring"
|
|
|
|
/obj/item/device/integrated_electronics/wirer
|
|
name = "circuit wirer"
|
|
desc = "It's a small wiring tool, with a wire roll, electric soldering iron, wire cutter, and more in one package. \
|
|
The wires used are generally useful for small electronics, such as circuitboards and breadboards, as opposed to larger wires \
|
|
used for power or data transmission."
|
|
icon = 'icons/obj/electronic_assemblies.dmi'
|
|
icon_state = "wirer-wire"
|
|
flags_1 = CONDUCT_1
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
var/datum/integrated_io/selected_io = null
|
|
var/mode = WIRE
|
|
|
|
/obj/item/device/integrated_electronics/wirer/update_icon()
|
|
icon_state = "wirer-[mode]"
|
|
|
|
/obj/item/device/integrated_electronics/wirer/proc/wire(var/datum/integrated_io/io, mob/user)
|
|
if(!io.holder.assembly)
|
|
to_chat(user, "<span class='warning'>\The [io.holder] needs to be secured inside an assembly first.</span>")
|
|
return
|
|
if(mode == WIRE)
|
|
selected_io = io
|
|
to_chat(user, "<span class='notice'>You attach a data wire to \the [selected_io.holder]'s [selected_io.name] data channel.</span>")
|
|
mode = WIRING
|
|
update_icon()
|
|
else if(mode == WIRING)
|
|
if(io == selected_io)
|
|
to_chat(user, "<span class='warning'>Wiring \the [selected_io.holder]'s [selected_io.name] into itself is rather pointless.</span>")
|
|
return
|
|
if(io.io_type != selected_io.io_type)
|
|
to_chat(user, "<span class='warning'>Those two types of channels are incompatable. The first is a [selected_io.io_type], \
|
|
while the second is a [io.io_type].</span>")
|
|
return
|
|
if(io.holder.assembly && io.holder.assembly != selected_io.holder.assembly)
|
|
to_chat(user, "<span class='warning'>Both \the [io.holder] and \the [selected_io.holder] need to be inside the same assembly.</span>")
|
|
return
|
|
selected_io.linked |= io
|
|
io.linked |= selected_io
|
|
|
|
to_chat(user, "<span class='notice'>You connect \the [selected_io.holder]'s [selected_io.name] to \the [io.holder]'s [io.name].</span>")
|
|
mode = WIRE
|
|
update_icon()
|
|
selected_io.holder.interact(user) // This is to update the UI.
|
|
selected_io = null
|
|
|
|
else if(mode == UNWIRE)
|
|
selected_io = io
|
|
if(!io.linked.len)
|
|
to_chat(user, "<span class='warning'>There is nothing connected to \the [selected_io] data channel.</span>")
|
|
selected_io = null
|
|
return
|
|
to_chat(user, "<span class='notice'>You prepare to detach a data wire from \the [selected_io.holder]'s [selected_io.name] data channel.</span>")
|
|
mode = UNWIRING
|
|
update_icon()
|
|
return
|
|
|
|
else if(mode == UNWIRING)
|
|
if(io == selected_io)
|
|
to_chat(user, "<span class='warning'>You can't wire a pin into each other, so unwiring \the [selected_io.holder] from \
|
|
the same pin is rather moot.</span>")
|
|
return
|
|
if(selected_io in io.linked)
|
|
io.linked.Remove(selected_io)
|
|
selected_io.linked.Remove(io)
|
|
to_chat(user, "<span class='notice'>You disconnect \the [selected_io.holder]'s [selected_io.name] from \
|
|
\the [io.holder]'s [io.name].</span>")
|
|
selected_io.holder.interact(user) // This is to update the UI.
|
|
selected_io = null
|
|
mode = UNWIRE
|
|
update_icon()
|
|
else
|
|
to_chat(user, "<span class='warning'>\The [selected_io.holder]'s [selected_io.name] and \the [io.holder]'s \
|
|
[io.name] are not connected.</span>")
|
|
return
|
|
|
|
/obj/item/device/integrated_electronics/wirer/attack_self(mob/user)
|
|
switch(mode)
|
|
if(WIRE)
|
|
mode = UNWIRE
|
|
if(WIRING)
|
|
if(selected_io)
|
|
to_chat(user, "<span class='notice'>You decide not to wire the data channel.</span>")
|
|
selected_io = null
|
|
mode = WIRE
|
|
if(UNWIRE)
|
|
mode = WIRE
|
|
if(UNWIRING)
|
|
if(selected_io)
|
|
to_chat(user, "<span class='notice'>You decide not to disconnect the data channel.</span>")
|
|
selected_io = null
|
|
mode = UNWIRE
|
|
update_icon()
|
|
to_chat(user, "<span class='notice'>You set \the [src] to [mode].</span>")
|
|
|
|
#undef WIRE
|
|
#undef WIRING
|
|
#undef UNWIRE
|
|
#undef UNWIRING |