mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 19:22:56 +00:00
Does more work on circuits.
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
icon = 'icons/obj/electronic_assemblies.dmi'
|
icon = 'icons/obj/electronic_assemblies.dmi'
|
||||||
icon_state = "template"
|
icon_state = "template"
|
||||||
w_class = 1
|
w_class = 1
|
||||||
|
var/extended_desc = null
|
||||||
var/list/inputs = list()
|
var/list/inputs = list()
|
||||||
var/list/outputs = list()
|
var/list/outputs = list()
|
||||||
var/list/activators = list()
|
var/list/activators = list()
|
||||||
@@ -34,6 +35,8 @@
|
|||||||
if(A.linked.len)
|
if(A.linked.len)
|
||||||
user << "\The [A.name] is connected to [A.get_linked_to_desc()]."
|
user << "\The [A.name] is connected to [A.get_linked_to_desc()]."
|
||||||
|
|
||||||
|
interact(user)
|
||||||
|
|
||||||
/obj/item/integrated_circuit/New()
|
/obj/item/integrated_circuit/New()
|
||||||
..()
|
..()
|
||||||
var/i = 0
|
var/i = 0
|
||||||
@@ -65,7 +68,7 @@
|
|||||||
|
|
||||||
i = 1
|
i = 1
|
||||||
if(activator_names.len)
|
if(activator_names.len)
|
||||||
for(var/datum/integrated_io/activate/A in outputs)
|
for(var/datum/integrated_io/activate/A in activators)
|
||||||
A.name = "[activator_names[i]]"
|
A.name = "[activator_names[i]]"
|
||||||
i++
|
i++
|
||||||
|
|
||||||
@@ -78,6 +81,10 @@
|
|||||||
qdel(A)
|
qdel(A)
|
||||||
..()
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/emp_act(severity)
|
||||||
|
for(var/datum/integrated_io/io in inputs + outputs + activators)
|
||||||
|
io.scramble()
|
||||||
|
|
||||||
/obj/item/integrated_circuit/verb/rename_component()
|
/obj/item/integrated_circuit/verb/rename_component()
|
||||||
set name = "Rename Circuit"
|
set name = "Rename Circuit"
|
||||||
set category = "Object"
|
set category = "Object"
|
||||||
@@ -91,6 +98,153 @@
|
|||||||
M << "<span class='notice'>The circuit '[src.name]' is now labeled '[input]'.</span>"
|
M << "<span class='notice'>The circuit '[src.name]' is now labeled '[input]'.</span>"
|
||||||
name = input
|
name = input
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/proc/get_pin_ref(var/pin_type, var/pin_number)
|
||||||
|
switch(pin_type)
|
||||||
|
if("input")
|
||||||
|
if(pin_number > inputs.len)
|
||||||
|
return null
|
||||||
|
return inputs[pin_number]
|
||||||
|
if("output")
|
||||||
|
if(pin_number > outputs.len)
|
||||||
|
return null
|
||||||
|
return outputs[pin_number]
|
||||||
|
if("activator")
|
||||||
|
if(pin_number > activators.len)
|
||||||
|
return null
|
||||||
|
return activators[pin_number]
|
||||||
|
return null
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/interact(mob/user)
|
||||||
|
if(get_dist(src, user) > 1)
|
||||||
|
user.unset_machine(src)
|
||||||
|
return
|
||||||
|
var/HTML = "<html><head><title>[src.name]</title></head><body>"
|
||||||
|
HTML += "<div align='center'>"
|
||||||
|
HTML += "<table border='1' style='undefined;table-layout: fixed; width: 424px'>"
|
||||||
|
|
||||||
|
HTML += "<colgroup>"
|
||||||
|
HTML += "<col style='width: 121px'>"
|
||||||
|
HTML += "<col style='width: 181px'>"
|
||||||
|
HTML += "<col style='width: 122px'>"
|
||||||
|
HTML += "</colgroup>"
|
||||||
|
|
||||||
|
var/column_width = 3
|
||||||
|
var/row_height = max(inputs.len, outputs.len, 1)
|
||||||
|
var/i
|
||||||
|
var/j
|
||||||
|
for(i = 1, i < row_height+1, i++)
|
||||||
|
HTML += "<tr>"
|
||||||
|
for(j = 1, j < column_width+1, j++)
|
||||||
|
var/datum/integrated_io/io = null
|
||||||
|
var/words = null
|
||||||
|
var/height = 1
|
||||||
|
switch(j)
|
||||||
|
if(1)
|
||||||
|
io = get_pin_ref("input",i)
|
||||||
|
if(io)
|
||||||
|
if(io.linked.len)
|
||||||
|
words = "<a href=?src=\ref[src];action=wire;user=\ref[user]><b>[io.name] [io.display_data()]</b></a><br>"
|
||||||
|
for(var/datum/integrated_io/linked in io.linked)
|
||||||
|
words += "<a href=?src=\ref[src];action=unwire;user=\ref[user];pin=\ref[io]>\[[linked.name]\]</a> \
|
||||||
|
@ <a href=?src[src];action=examine;user=\ref[user]>[linked.holder]</a><br>"
|
||||||
|
else // "Click <a href=?src=\ref[src];action=start>here</a>!"
|
||||||
|
words = "<a href=?src=\ref[src];action=wire;user=\ref[user]>[io.name] [io.display_data()]</a><br>"
|
||||||
|
for(var/datum/integrated_io/linked in io.linked)
|
||||||
|
words += "<a href=?src=\ref[src];action=unwire;user=\ref[user];pin=\ref[io]>\[[linked.name]\]</a> \
|
||||||
|
@ <a href=?src[src];action=examine;user=\ref[user]>[linked.holder]</a><br>"
|
||||||
|
if(outputs.len > inputs.len)
|
||||||
|
height = Floor(outputs.len / inputs.len)
|
||||||
|
//world << "I wrote [words] at ([i],[j])."
|
||||||
|
if(2)
|
||||||
|
if(i == 1)
|
||||||
|
words = "[src.name]<br><br>[src.desc]"
|
||||||
|
height = row_height
|
||||||
|
//world << "I wrote the center piece because i was equal to 1, at ([i],[j])."
|
||||||
|
else
|
||||||
|
continue
|
||||||
|
if(3)
|
||||||
|
io = get_pin_ref("output",i)
|
||||||
|
if(io)
|
||||||
|
if(io.linked.len)
|
||||||
|
words = "<a href=?src=\ref[src];action=wire;user=\ref[user]><b>[io.name] [io.display_data()]</b></a><br>"
|
||||||
|
for(var/datum/integrated_io/linked in io.linked)
|
||||||
|
words += "<a href=?src=\ref[src];action=unwire;user=\ref[user];pin=\ref[io]>\[[linked.name]\]</a> \
|
||||||
|
@ <a href=?src[src];action=examine;user=\ref[user]>[linked.holder]</a><br>"
|
||||||
|
else
|
||||||
|
words = "<a href=?src=\ref[src];action=wire;user=\ref[user]>[io.name] [io.display_data()]</a><br>"
|
||||||
|
for(var/datum/integrated_io/linked in io.linked)
|
||||||
|
words += "<a href=?src=\ref[src];action=unwire;user=\ref[user];pin=\ref[io]>\[[linked.name]\]</a> \
|
||||||
|
@ <a href=?src[src];action=examine;user=\ref[user]>[linked.holder]</a><br>"
|
||||||
|
if(inputs.len > outputs.len)
|
||||||
|
height = Floor(inputs.len / outputs.len)
|
||||||
|
//world << "I wrote [words] at ([i],[j])."
|
||||||
|
HTML += "<td align='center' rowspan='[height]'>[words]</td>"
|
||||||
|
//HTML += "<td align='center'>[words]</td>"
|
||||||
|
//world << "Writing to ([i],[j])."
|
||||||
|
HTML += "</tr>"
|
||||||
|
|
||||||
|
if(activators.len)
|
||||||
|
for(i = 1, i < activators.len+1, i++)
|
||||||
|
var/datum/integrated_io/io = null
|
||||||
|
var/words = null
|
||||||
|
io = get_pin_ref("activator",i)
|
||||||
|
if(io)
|
||||||
|
if(io.linked.len)
|
||||||
|
words = "<a href=?src=\ref[src];action=wire;user=\ref[user]><font color='FF0000'><b>[io.name]</b></font></a><br>"
|
||||||
|
for(var/datum/integrated_io/linked in io.linked)
|
||||||
|
words += "<a href=?src=\ref[src];action=unwire;user=\ref[user];pin=\ref[io]>\[[linked.name]\]</a> \
|
||||||
|
@ <a href=?src[src];action=examine;user=\ref[user]>[linked.holder]</a><br>"
|
||||||
|
else // "Click <a href=?src=\ref[src];action=start>here</a>!"
|
||||||
|
words = "<a href=?src=\ref[src];action=wire;user=\ref[user]><font color='FF0000'>[io.name]</font></a><br>"
|
||||||
|
for(var/datum/integrated_io/linked in io.linked)
|
||||||
|
words += "<a href=?src=\ref[src];action=unwire;user=\ref[user];pin=\ref[io]>\[[linked.name]\]</a> \
|
||||||
|
@ <a href=?src[src];action=examine;user=\ref[user]>[linked.holder]</a><br>"
|
||||||
|
HTML += "<tr>"
|
||||||
|
HTML += "<td colspan='3' align='center'>[words]</td>"
|
||||||
|
HTML += "</tr>"
|
||||||
|
|
||||||
|
HTML += "</table>"
|
||||||
|
HTML += "</div>"
|
||||||
|
|
||||||
|
HTML += "<br><br><a href='?src=\ref[src]'>Refresh</a>"
|
||||||
|
HTML += "<br><font color='0000FF'>[extended_desc]</font>"
|
||||||
|
|
||||||
|
HTML += "</body></html>"
|
||||||
|
user << browse(HTML, "window=circuit-\ref[src];size=400x440;border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||||
|
|
||||||
|
user.set_machine(src)
|
||||||
|
onclose(user, "circuit-\ref[src]")
|
||||||
|
//user << sanitize(HTML, "window=debug;size=400x400;border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||||
|
//world << sanitize(HTML)
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/Topic(href, href_list[])
|
||||||
|
if(..())
|
||||||
|
return 1
|
||||||
|
var/user = locate(href_list["user"]) in mob_list
|
||||||
|
var/pin = locate(href_list["pin"]) in contents
|
||||||
|
switch(href_list["action"])
|
||||||
|
if("examine")
|
||||||
|
examine(user)
|
||||||
|
|
||||||
|
if("wire")
|
||||||
|
if(ishuman(user) && Adjacent(user))
|
||||||
|
var/mob/living/carbon/human/H = user
|
||||||
|
var/obj/item/device/integrated_electronics/wirer/wirer = null
|
||||||
|
if(istype(H.r_hand, /obj/item/device/integrated_electronics/wirer))
|
||||||
|
wirer = H.r_hand
|
||||||
|
else if(istype(H.l_hand, /obj/item/device/integrated_electronics/wirer))
|
||||||
|
wirer = H.l_hand
|
||||||
|
|
||||||
|
if(wirer && pin)
|
||||||
|
wirer.wire(pin, user)
|
||||||
|
else
|
||||||
|
user << "<span class='warning'>You can't do a whole lot without tools.</span>"
|
||||||
|
|
||||||
|
//updateDialog()
|
||||||
|
world << "[src] received Topic([href], [href_list]) call from [user]."
|
||||||
|
world << "href_list contained [english_list(href_list)]."
|
||||||
|
interact(user)
|
||||||
|
|
||||||
/datum/integrated_io
|
/datum/integrated_io
|
||||||
var/name = "input/output"
|
var/name = "input/output"
|
||||||
var/obj/item/integrated_circuit/holder = null
|
var/obj/item/integrated_circuit/holder = null
|
||||||
@@ -110,6 +264,70 @@
|
|||||||
holder = null
|
holder = null
|
||||||
..()
|
..()
|
||||||
|
|
||||||
|
/datum/integrated_io/Topic(href, href_list[])
|
||||||
|
if(..())
|
||||||
|
return 1
|
||||||
|
var/user = locate(href_list["user"]) in mob_list
|
||||||
|
switch(href_list["action"])
|
||||||
|
// if("view")
|
||||||
|
// var/HTML = "<html><head><title>[src.name]</title></head><body>"
|
||||||
|
// HTML += "Parent: [holder]"
|
||||||
|
// HTML += "Pin Type: [io_type]"
|
||||||
|
// HTML += "Linked Pins:<br>"
|
||||||
|
// for(var/datum/integrated_io/io in src.linked)
|
||||||
|
// HTML += "<a href=?src=\ref[io];action=view;user=\ref[user]>[io.name] [io.display_data()] @ [io.holder]</a><br>"
|
||||||
|
// HTML += "<a href=?src=\ref[src];action=interact;user=\ref[user]>\[Wire This\]</a>"
|
||||||
|
//
|
||||||
|
// HTML += "</body></html>"
|
||||||
|
// user << browse(HTML, "window=pin-\ref[src];size=400x400;border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||||
|
|
||||||
|
if("examine_holder")
|
||||||
|
holder.examine(user)
|
||||||
|
|
||||||
|
if("wire")
|
||||||
|
if(ishuman(user))
|
||||||
|
var/mob/living/carbon/human/H = user
|
||||||
|
var/obj/item/device/integrated_electronics/wirer/wirer = null
|
||||||
|
if(istype(H.r_hand, /obj/item/device/integrated_electronics/wirer))
|
||||||
|
wirer = H.r_hand
|
||||||
|
else if(istype(H.l_hand, /obj/item/device/integrated_electronics/wirer))
|
||||||
|
wirer = H.l_hand
|
||||||
|
|
||||||
|
if(wirer)
|
||||||
|
wirer.wire(src, user)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
user << "<span class='warning'>You can't do a whole lot without tools.</span>"
|
||||||
|
//updateDialog()
|
||||||
|
//world << "[src] inside [src.holder] was clicked by [user]."
|
||||||
|
|
||||||
|
/datum/integrated_io/proc/display_data()
|
||||||
|
if(!data)
|
||||||
|
return "(null)" // Empty data means nothing to show.
|
||||||
|
if(istext(data))
|
||||||
|
return "(\"[data]\")" // Wraps the 'string' in escaped quotes, so that people know it's a 'string'.
|
||||||
|
if(istype(data, /atom))
|
||||||
|
var/atom/A = data
|
||||||
|
return "([A.name] \[Ref\])" // For refs, we want just the name displayed.
|
||||||
|
return "([data])" // Nothing special needed for numbers or other stuff.
|
||||||
|
|
||||||
|
/datum/integrated_io/activate/display_data()
|
||||||
|
return "(\[pulse\])"
|
||||||
|
|
||||||
|
/datum/integrated_io/proc/scramble()
|
||||||
|
if(isnull(data))
|
||||||
|
return
|
||||||
|
if(isnum(data))
|
||||||
|
data = rand(-10000, 10000)
|
||||||
|
if(istext(data))
|
||||||
|
data = "ERROR"
|
||||||
|
push_data()
|
||||||
|
|
||||||
|
/datum/integrated_io/activate/scramble()
|
||||||
|
push_data()
|
||||||
|
|
||||||
/datum/integrated_io/proc/push_data()
|
/datum/integrated_io/proc/push_data()
|
||||||
if(linked.len)
|
if(linked.len)
|
||||||
for(var/datum/integrated_io/io in linked)
|
for(var/datum/integrated_io/io in linked)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
icon_state = "setup"
|
icon_state = "setup"
|
||||||
var/max_components = 10
|
var/max_components = 10
|
||||||
var/max_complexity = 30
|
var/max_complexity = 30
|
||||||
|
var/opened = 0
|
||||||
|
|
||||||
/obj/item/device/electronic_assembly/medium
|
/obj/item/device/electronic_assembly/medium
|
||||||
name = "electronic setup"
|
name = "electronic setup"
|
||||||
@@ -36,12 +37,20 @@
|
|||||||
|
|
||||||
/obj/item/device/electronic_assembly/examine(mob/user)
|
/obj/item/device/electronic_assembly/examine(mob/user)
|
||||||
..()
|
..()
|
||||||
|
if(!opened)
|
||||||
for(var/obj/item/integrated_circuit/output/screen/S in contents)
|
for(var/obj/item/integrated_circuit/output/screen/S in contents)
|
||||||
if(S.stuff_to_display)
|
if(S.stuff_to_display)
|
||||||
user << "There's a little screen which displays '[S.stuff_to_display]'."
|
user << "There's a little screen which displays '[S.stuff_to_display]'."
|
||||||
|
else
|
||||||
|
var/obj/item/integrated_circuit/IC = input(user, "Which circuit do you want to examine?", "Examination") as null|anything in contents
|
||||||
|
if(IC)
|
||||||
|
IC.examine(user)
|
||||||
|
|
||||||
/obj/item/device/electronic_assembly/attackby(var/obj/item/I, var/mob/user)
|
/obj/item/device/electronic_assembly/attackby(var/obj/item/I, var/mob/user)
|
||||||
if(istype(I, /obj/item/integrated_circuit))
|
if(istype(I, /obj/item/integrated_circuit))
|
||||||
|
if(!opened)
|
||||||
|
user << "<span class='warning'>\The [src] isn't opened, so you can't put anything inside. Try using a crowbar.</span>"
|
||||||
|
return 0
|
||||||
var/obj/item/integrated_circuit/IC = I
|
var/obj/item/integrated_circuit/IC = I
|
||||||
var/total_parts = 0
|
var/total_parts = 0
|
||||||
var/total_complexity = 0
|
var/total_complexity = 0
|
||||||
@@ -50,17 +59,20 @@
|
|||||||
total_complexity = total_complexity + part.complexity
|
total_complexity = total_complexity + part.complexity
|
||||||
|
|
||||||
if( (total_parts + 1) >= max_components)
|
if( (total_parts + 1) >= max_components)
|
||||||
user << "<span class='warning'>You can't seem to add this [IC.name], since this setup's too complicated for the case.</span>"
|
user << "<span class='warning'>You can't seem to add this [IC.name], since there's no more room.</span>"
|
||||||
return 0
|
return 0
|
||||||
if( (total_complexity + IC.complexity) >= max_complexity)
|
if( (total_complexity + IC.complexity) >= max_complexity)
|
||||||
user << "<span class='warning'>You can't seem to add this [IC.name], since there's no more room.</span>"
|
user << "<span class='warning'>You can't seem to add this [IC.name], since this setup's too complicated for the case.</span>"
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
user << "<span class='notice'>You slide \the [IC] inside \the [src].</span>"
|
user << "<span class='notice'>You slide \the [IC] inside \the [src].</span>"
|
||||||
user.drop_item()
|
user.drop_item()
|
||||||
IC.forceMove(src)
|
IC.forceMove(src)
|
||||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||||
if(istype(I, /obj/item/weapon/crowbar))
|
if(istype(I, /obj/item/weapon/screwdriver))
|
||||||
|
if(!opened)
|
||||||
|
user << "<span class='warning'>\The [src] isn't opened, so you can't remove anything inside. Try using a crowbar.</span>"
|
||||||
|
return 0
|
||||||
if(!contents.len)
|
if(!contents.len)
|
||||||
user << "<span class='warning'>There's nothing inside this to remove!</span>"
|
user << "<span class='warning'>There's nothing inside this to remove!</span>"
|
||||||
return 0
|
return 0
|
||||||
@@ -69,6 +81,11 @@
|
|||||||
option.disconnect_all()
|
option.disconnect_all()
|
||||||
option.forceMove(get_turf(src))
|
option.forceMove(get_turf(src))
|
||||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||||
|
user << "<span class='notice'>You pop \the [option] out of the case, and slide it out.</span>"
|
||||||
|
if(istype(I, /obj/item/weapon/crowbar))
|
||||||
|
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||||
|
opened = !opened
|
||||||
|
user << "<span class='notice'>You [opened ? "opened" : "closed"] \the [src].</span>"
|
||||||
|
|
||||||
/obj/item/device/electronic_assembly/attack_self(mob/user)
|
/obj/item/device/electronic_assembly/attack_self(mob/user)
|
||||||
var/list/available_inputs = list()
|
var/list/available_inputs = list()
|
||||||
@@ -77,3 +94,8 @@
|
|||||||
var/obj/item/integrated_circuit/input/choice = input(user, "What do you want to interact with?", "Interaction") as null|anything in available_inputs
|
var/obj/item/integrated_circuit/input/choice = input(user, "What do you want to interact with?", "Interaction") as null|anything in available_inputs
|
||||||
if(choice)
|
if(choice)
|
||||||
choice.ask_for_input(user)
|
choice.ask_for_input(user)
|
||||||
|
|
||||||
|
/obj/item/device/electronic_assembly/emp_act(severity)
|
||||||
|
..()
|
||||||
|
for(var/atom/movable/AM in contents)
|
||||||
|
AM.emp_act(severity)
|
||||||
|
|||||||
101
code/modules/integrated_electronics/converters.dm
Normal file
101
code/modules/integrated_electronics/converters.dm
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
//These circuits convert one variable to another.
|
||||||
|
/obj/item/integrated_circuit/converter
|
||||||
|
complexity = 2
|
||||||
|
number_of_inputs = 1
|
||||||
|
number_of_outputs = 1
|
||||||
|
number_of_activators = 1
|
||||||
|
input_names = list(
|
||||||
|
"input",
|
||||||
|
)
|
||||||
|
output_names = list(
|
||||||
|
"result"
|
||||||
|
)
|
||||||
|
activator_names = list(
|
||||||
|
"convert"
|
||||||
|
)
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/num2text
|
||||||
|
name = "number to string"
|
||||||
|
desc = "This circuit can convert a number variable into a string."
|
||||||
|
icon_state = "addition"
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/num2text/work()
|
||||||
|
var/result = null
|
||||||
|
var/datum/integrated_io/incoming = inputs[1]
|
||||||
|
var/datum/integrated_io/outgoing = outputs[1]
|
||||||
|
if(incoming.data && isnum(incoming.data))
|
||||||
|
result = num2text(incoming.data)
|
||||||
|
|
||||||
|
outgoing.data = result
|
||||||
|
outgoing.push_data()
|
||||||
|
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/text2num
|
||||||
|
name = "number to string"
|
||||||
|
desc = "This circuit can convert a string variable into a number."
|
||||||
|
icon_state = "addition"
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/text2num/work()
|
||||||
|
var/result = null
|
||||||
|
var/datum/integrated_io/incoming = inputs[1]
|
||||||
|
var/datum/integrated_io/outgoing = outputs[1]
|
||||||
|
if(incoming.data && istext(incoming.data))
|
||||||
|
result = text2num(incoming.data)
|
||||||
|
|
||||||
|
outgoing.data = result
|
||||||
|
outgoing.push_data()
|
||||||
|
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/ref2text
|
||||||
|
name = "reference to string"
|
||||||
|
desc = "This circuit can convert a reference to something else to a string, specifically the name of that reference."
|
||||||
|
icon_state = "addition"
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/ref2text/work()
|
||||||
|
var/result = null
|
||||||
|
var/datum/integrated_io/incoming = inputs[1]
|
||||||
|
var/datum/integrated_io/outgoing = outputs[1]
|
||||||
|
if(incoming.data && istype(incoming.data, /atom/))
|
||||||
|
var/atom/A = incoming.data
|
||||||
|
result = A.name
|
||||||
|
|
||||||
|
outgoing.data = result
|
||||||
|
outgoing.push_data()
|
||||||
|
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/lowercase
|
||||||
|
name = "lowercase string converter"
|
||||||
|
desc = "this will cause a string to come out in all lowercase."
|
||||||
|
icon_state = "addition"
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/lowercase/work()
|
||||||
|
var/result = null
|
||||||
|
var/datum/integrated_io/incoming = inputs[1]
|
||||||
|
var/datum/integrated_io/outgoing = outputs[1]
|
||||||
|
if(incoming.data && istext(incoming.data))
|
||||||
|
result = lowertext(incoming.data)
|
||||||
|
|
||||||
|
outgoing.data = result
|
||||||
|
outgoing.push_data()
|
||||||
|
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/uppercase
|
||||||
|
name = "uppercase string converter"
|
||||||
|
desc = "THIS WILL CAUSE A STRING TO COME OUT IN ALL UPPERCASE."
|
||||||
|
icon_state = "addition"
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/converter/uppercase/work()
|
||||||
|
var/result = null
|
||||||
|
var/datum/integrated_io/incoming = inputs[1]
|
||||||
|
var/datum/integrated_io/outgoing = outputs[1]
|
||||||
|
if(incoming.data && istext(incoming.data))
|
||||||
|
result = uppertext(incoming.data)
|
||||||
|
|
||||||
|
outgoing.data = result
|
||||||
|
outgoing.push_data()
|
||||||
|
|
||||||
|
..()
|
||||||
74
code/modules/integrated_electronics/coordinate.dm
Normal file
74
code/modules/integrated_electronics/coordinate.dm
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
//This circuit gives information on where the machine is.
|
||||||
|
/obj/item/integrated_circuit/gps
|
||||||
|
name = "global positioning system"
|
||||||
|
desc = "This allows you to easily know the position of a machine containing this device."
|
||||||
|
complexity = 4
|
||||||
|
number_of_inputs = 0
|
||||||
|
number_of_outputs = 2
|
||||||
|
number_of_activators = 1
|
||||||
|
input_names = list(
|
||||||
|
)
|
||||||
|
output_names = list(
|
||||||
|
"X (abs)",
|
||||||
|
"Y (abs)"
|
||||||
|
)
|
||||||
|
activator_names = list(
|
||||||
|
"get coordinates"
|
||||||
|
)
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/gps/work()
|
||||||
|
var/turf/T = get_turf(src)
|
||||||
|
var/datum/integrated_io/result_x = outputs[1]
|
||||||
|
var/datum/integrated_io/result_y = outputs[2]
|
||||||
|
|
||||||
|
result_x.data = null
|
||||||
|
result_y.data = null
|
||||||
|
if(!T)
|
||||||
|
return
|
||||||
|
|
||||||
|
result_x.data = T.x
|
||||||
|
result_y.data = T.y
|
||||||
|
|
||||||
|
for(var/datum/integrated_io/output/O in outputs)
|
||||||
|
O.push_data()
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/abs_to_rel_coords
|
||||||
|
name = "abs to rel coordinate converter"
|
||||||
|
desc = "Easily convert absolute coordinates to relative coordinates with this."
|
||||||
|
complexity = 4
|
||||||
|
number_of_inputs = 0
|
||||||
|
number_of_outputs = 4
|
||||||
|
number_of_activators = 1
|
||||||
|
input_names = list(
|
||||||
|
"X1 (abs)",
|
||||||
|
"Y1 (abs)",
|
||||||
|
"X2 (abs)",
|
||||||
|
"Y2 (abs)"
|
||||||
|
)
|
||||||
|
output_names = list(
|
||||||
|
"X (rel)",
|
||||||
|
"Y (rel)"
|
||||||
|
)
|
||||||
|
activator_names = list(
|
||||||
|
"compute rel coordinates"
|
||||||
|
)
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/abs_to_rel_coords/work()
|
||||||
|
var/datum/integrated_io/x1 = inputs[1]
|
||||||
|
var/datum/integrated_io/y1 = inputs[2]
|
||||||
|
|
||||||
|
var/datum/integrated_io/x2 = inputs[3]
|
||||||
|
var/datum/integrated_io/y2 = inputs[4]
|
||||||
|
|
||||||
|
var/datum/integrated_io/result_x = outputs[1]
|
||||||
|
var/datum/integrated_io/result_y = outputs[2]
|
||||||
|
|
||||||
|
if(x1.data && y1.data && x2.data && y2.data)
|
||||||
|
result_x.data = x1.data - x2.data
|
||||||
|
result_y.data = y1.data - y2.data
|
||||||
|
|
||||||
|
|
||||||
|
for(var/datum/integrated_io/output/O in outputs)
|
||||||
|
O.push_data()
|
||||||
|
..()
|
||||||
@@ -72,6 +72,7 @@
|
|||||||
O.data = 1
|
O.data = 1
|
||||||
O.push_data()
|
O.push_data()
|
||||||
A.push_data()
|
A.push_data()
|
||||||
|
P.push_data()
|
||||||
else
|
else
|
||||||
O.data = 0
|
O.data = 0
|
||||||
|
|
||||||
@@ -90,6 +91,7 @@
|
|||||||
O.data = 1
|
O.data = 1
|
||||||
O.push_data()
|
O.push_data()
|
||||||
A.push_data()
|
A.push_data()
|
||||||
|
P.push_data()
|
||||||
else
|
else
|
||||||
O.data = 0
|
O.data = 0
|
||||||
|
|
||||||
@@ -108,6 +110,7 @@
|
|||||||
O.data = 1
|
O.data = 1
|
||||||
O.push_data()
|
O.push_data()
|
||||||
A.push_data()
|
A.push_data()
|
||||||
|
P.push_data()
|
||||||
else
|
else
|
||||||
O.data = 0
|
O.data = 0
|
||||||
|
|
||||||
@@ -126,6 +129,7 @@
|
|||||||
O.data = 1
|
O.data = 1
|
||||||
O.push_data()
|
O.push_data()
|
||||||
A.push_data()
|
A.push_data()
|
||||||
|
P.push_data()
|
||||||
else
|
else
|
||||||
O.data = 0
|
O.data = 0
|
||||||
|
|
||||||
@@ -134,7 +138,7 @@
|
|||||||
desc = "This will output 'one' if the first input is greater than the second input."
|
desc = "This will output 'one' if the first input is greater than the second input."
|
||||||
icon_state = "greater_than"
|
icon_state = "greater_than"
|
||||||
|
|
||||||
/obj/item/integrated_circuit/logic/geater_than/work()
|
/obj/item/integrated_circuit/logic/greater_than/work()
|
||||||
..()
|
..()
|
||||||
var/datum/integrated_io/A = inputs[1]
|
var/datum/integrated_io/A = inputs[1]
|
||||||
var/datum/integrated_io/B = inputs[2]
|
var/datum/integrated_io/B = inputs[2]
|
||||||
@@ -144,6 +148,7 @@
|
|||||||
O.data = 1
|
O.data = 1
|
||||||
O.push_data()
|
O.push_data()
|
||||||
A.push_data()
|
A.push_data()
|
||||||
|
P.push_data()
|
||||||
else
|
else
|
||||||
O.data = 0
|
O.data = 0
|
||||||
|
|
||||||
@@ -162,5 +167,6 @@
|
|||||||
O.data = 1
|
O.data = 1
|
||||||
O.push_data()
|
O.push_data()
|
||||||
A.push_data()
|
A.push_data()
|
||||||
|
P.push_data()
|
||||||
else
|
else
|
||||||
O.data = 0
|
O.data = 0
|
||||||
87
code/modules/integrated_electronics/manipulation.dm
Normal file
87
code/modules/integrated_electronics/manipulation.dm
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/obj/item/integrated_circuit/weapon_firing
|
||||||
|
name = "weapon firing mechanism"
|
||||||
|
desc = "This somewhat complicated system allows one to slot in a gun, direct it towards a position, and remotely fire it."
|
||||||
|
extended_desc = "The firing mechanism can slot in most ranged weapons, ballistic and energy. \
|
||||||
|
The first and second inputs need to be numbers. They are coordinates for the gun to fire at, relative to the machine itself. \
|
||||||
|
The 'fire' activator will cause the mechanism to attempt to fire the weapon at the coordinates, if possible. Note that the \
|
||||||
|
normal limitations to firearms, such as ammunition requirements and firing delays, still hold true if fired by the mechanism."
|
||||||
|
complexity = 20
|
||||||
|
number_of_inputs = 2
|
||||||
|
number_of_outputs = 0
|
||||||
|
number_of_activators = 1
|
||||||
|
input_names = list(
|
||||||
|
"target X rel",
|
||||||
|
"target Y rel"
|
||||||
|
)
|
||||||
|
activator_names = list(
|
||||||
|
"fire"
|
||||||
|
)
|
||||||
|
var/obj/item/weapon/gun/installed_gun = null
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/weapon_firing/Destroy()
|
||||||
|
qdel(installed_gun)
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/weapon_firing/attackby(var/obj/O, var/mob/user)
|
||||||
|
if(istype(O, /obj/item/weapon/gun))
|
||||||
|
var/obj/item/weapon/gun/gun = O
|
||||||
|
if(installed_gun)
|
||||||
|
user << "<span class='warning'>There's already a weapon installed.</span>"
|
||||||
|
return
|
||||||
|
user.drop_from_inventory(gun)
|
||||||
|
installed_gun = gun
|
||||||
|
gun.forceMove(src)
|
||||||
|
user << "<span class='notice'>You slide \the [gun] into the firing mechanism.</span>"
|
||||||
|
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||||
|
else
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/weapon_firing/attack_self(var/mob/user)
|
||||||
|
if(installed_gun)
|
||||||
|
installed_gun.forceMove(get_turf(src))
|
||||||
|
user << "<span class='notice'>You slide \the [installed_gun] out of the firing mechanism.</span>"
|
||||||
|
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||||
|
installed_gun = null
|
||||||
|
else
|
||||||
|
user << "<span class='notice'>There's no weapon to remove from the mechanism.</span>"
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/weapon_firing/work()
|
||||||
|
if(!installed_gun)
|
||||||
|
return
|
||||||
|
|
||||||
|
var/datum/integrated_io/target_x = inputs[1]
|
||||||
|
var/datum/integrated_io/target_y = inputs[2]
|
||||||
|
|
||||||
|
if(target_x.data && target_y.data && isnum(target_x.data) && isnum(target_y.data))
|
||||||
|
var/turf/T = get_turf(src)
|
||||||
|
|
||||||
|
if(target_x.data == 0 && target_y.data == 0) // Don't shoot ourselves.
|
||||||
|
return
|
||||||
|
|
||||||
|
// We need to do this in order to enable relative coordinates, as locate() only works for absolute coordinates.
|
||||||
|
var/i
|
||||||
|
if(target_x.data > 0)
|
||||||
|
i = abs(target_x.data)
|
||||||
|
while(i)
|
||||||
|
T = get_step(T, EAST)
|
||||||
|
i--
|
||||||
|
else if(target_x.data < 0)
|
||||||
|
i = abs(target_x.data)
|
||||||
|
while(i)
|
||||||
|
T = get_step(T, WEST)
|
||||||
|
i--
|
||||||
|
|
||||||
|
if(target_y.data > 0)
|
||||||
|
i = abs(target_y.data)
|
||||||
|
while(i)
|
||||||
|
T = get_step(T, NORTH)
|
||||||
|
i--
|
||||||
|
else if(target_y.data < 0)
|
||||||
|
i = abs(target_y.data)
|
||||||
|
while(i)
|
||||||
|
T = get_step(T, SOUTH)
|
||||||
|
i--
|
||||||
|
|
||||||
|
if(!T)
|
||||||
|
return
|
||||||
|
installed_gun.Fire_userless(T)
|
||||||
@@ -5,13 +5,113 @@
|
|||||||
number_of_inputs = 0
|
number_of_inputs = 0
|
||||||
number_of_outputs = 0
|
number_of_outputs = 0
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/delay
|
||||||
|
name = "two-sec delay circuit"
|
||||||
|
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||||
|
This circuit is set to send a pulse after a delay of two seconds."
|
||||||
|
number_of_activators = 2
|
||||||
|
var/delay = 20
|
||||||
|
activator_names = list(
|
||||||
|
"incoming pulse",
|
||||||
|
"outgoing pulse"
|
||||||
|
)
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/delay/work()
|
||||||
|
..()
|
||||||
|
var/datum/integrated_io/out_pulse = activators[2]
|
||||||
|
sleep(delay)
|
||||||
|
out_pulse.push_data()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/delay/five_sec
|
||||||
|
name = "five-sec delay circuit"
|
||||||
|
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||||
|
This circuit is set to send a pulse after a delay of five seconds."
|
||||||
|
delay = 10
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/delay/one_sec
|
||||||
|
name = "one-sec delay circuit"
|
||||||
|
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||||
|
This circuit is set to send a pulse after a delay of one second."
|
||||||
|
delay = 10
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/delay/half_sec
|
||||||
|
name = "half-sec delay circuit"
|
||||||
|
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||||
|
This circuit is set to send a pulse after a delay of half a second."
|
||||||
|
delay = 5
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/delay/tenth_sec
|
||||||
|
name = "tenth-sec delay circuit"
|
||||||
|
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||||
|
This circuit is set to send a pulse after a delay of 1/10th of a second."
|
||||||
|
delay = 1
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/delay/custom
|
||||||
|
name = "custom delay circuit"
|
||||||
|
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \
|
||||||
|
This circuit's delay can be customized, between 1/10th of a second to one hour. The delay is updated upon receiving a pulse."
|
||||||
|
number_of_inputs = 1
|
||||||
|
input_names = list(
|
||||||
|
"delay time",
|
||||||
|
)
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/delay/custom/work()
|
||||||
|
var/datum/integrated_io/delay_input = inputs[1]
|
||||||
|
if(delay_input.data && isnum(delay_input.data) )
|
||||||
|
var/new_delay = min(delay_input.data, 1)
|
||||||
|
new_delay = max(new_delay, 36000) //An hour.
|
||||||
|
delay = new_delay
|
||||||
|
|
||||||
|
..()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/ticker
|
||||||
|
name = "ticker circuit"
|
||||||
|
desc = "This circuit sends an automatic pulse every four seconds."
|
||||||
|
complexity = 8
|
||||||
|
number_of_inputs = 1
|
||||||
|
number_of_activators = 1
|
||||||
|
var/ticks_to_pulse = 2
|
||||||
|
var/ticks_completed = 0
|
||||||
|
input_names = list(
|
||||||
|
"toggle ticking"
|
||||||
|
)
|
||||||
|
activator_names = list(
|
||||||
|
"outgoing pulse"
|
||||||
|
)
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/ticker/New()
|
||||||
|
..()
|
||||||
|
processing_objects |= src
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/ticker/Destroy()
|
||||||
|
processing_objects -= src
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/ticker/process()
|
||||||
|
ticks_completed++
|
||||||
|
if( (ticks_completed % ticks_to_pulse) == 0)
|
||||||
|
var/datum/integrated_io/pulser = activators[1]
|
||||||
|
pulser.push_data()
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/ticker/fast
|
||||||
|
name = "fast ticker"
|
||||||
|
desc = "This advanced circuit sends an automatic pulse every two seconds."
|
||||||
|
complexity = 12
|
||||||
|
ticks_to_pulse = 1
|
||||||
|
|
||||||
|
/obj/item/integrated_circuit/time/ticker/slow
|
||||||
|
name = "slow ticker"
|
||||||
|
desc = "This simple circuit sends an automatic pulse every six seconds."
|
||||||
|
complexity = 4
|
||||||
|
ticks_to_pulse = 3
|
||||||
|
|
||||||
|
|
||||||
/obj/item/integrated_circuit/time/clock
|
/obj/item/integrated_circuit/time/clock
|
||||||
name = "integrated clock"
|
name = "integrated clock"
|
||||||
desc = "Tells you what the local time is, specific to your station or planet."
|
desc = "Tells you what the local time is, specific to your station or planet."
|
||||||
number_of_inputs = 0
|
number_of_inputs = 0
|
||||||
number_of_outputs = 6
|
number_of_outputs = 6
|
||||||
number_of_activators = 1
|
number_of_activators = 1
|
||||||
name_of_outputs = list(
|
output_names = list(
|
||||||
"time (string)",
|
"time (string)",
|
||||||
"minute (string)",
|
"minute (string)",
|
||||||
"hour (string)",
|
"hour (string)",
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
if(istext(temporary_data))
|
if(istext(temporary_data))
|
||||||
probe.data = temporary_data
|
probe.data = temporary_data
|
||||||
if("number")
|
if("number")
|
||||||
temporary_data = sanitize(input(user, "Please a number.", "number input") as null|num)
|
temporary_data = sanitize(input(user, "Please give a number.", "number input") as null|num)
|
||||||
if(isnum(temporary_data))
|
if(isnum(temporary_data))
|
||||||
probe.data = temporary_data
|
probe.data = temporary_data
|
||||||
if("reference")
|
if("reference")
|
||||||
@@ -63,8 +63,10 @@
|
|||||||
|
|
||||||
|
|
||||||
/obj/item/device/integrated_electronics/wirer
|
/obj/item/device/integrated_electronics/wirer
|
||||||
name = "data wirer"
|
name = "circuit wirer"
|
||||||
desc = "Used to connect various inputs and outputs together."
|
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_state = "multitool"
|
icon_state = "multitool"
|
||||||
flags = CONDUCT
|
flags = CONDUCT
|
||||||
w_class = 2
|
w_class = 2
|
||||||
@@ -74,6 +76,58 @@
|
|||||||
/obj/item/device/integrated_electronics/wirer/New()
|
/obj/item/device/integrated_electronics/wirer/New()
|
||||||
..()
|
..()
|
||||||
|
|
||||||
|
/obj/item/device/integrated_electronics/wirer/proc/wire(var/datum/integrated_io/io, mob/user)
|
||||||
|
if(mode == WIRE)
|
||||||
|
selected_io = io
|
||||||
|
user << "<span class='notice'>You attach a data wire to \the [selected_io.holder]'s [selected_io.name] data channel.</span>"
|
||||||
|
mode = WIRING
|
||||||
|
else if(mode == WIRING)
|
||||||
|
if(io == selected_io)
|
||||||
|
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)
|
||||||
|
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
|
||||||
|
selected_io.linked |= io
|
||||||
|
io.linked |= selected_io
|
||||||
|
|
||||||
|
user << "<span class='notice'>You connect \the [selected_io.holder]'s [selected_io.name] to \the [io.holder]'s [io.name].</span>"
|
||||||
|
mode = WIRE
|
||||||
|
//io.updateDialog()
|
||||||
|
//selected_io.updateDialog()
|
||||||
|
selected_io = null
|
||||||
|
|
||||||
|
else if(mode == UNWIRE)
|
||||||
|
selected_io = io
|
||||||
|
if(!io.linked.len)
|
||||||
|
user << "<span class='warning'>There is nothing connected to \the [selected_io] data channel.</span>"
|
||||||
|
selected_io = null
|
||||||
|
return
|
||||||
|
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
|
||||||
|
return
|
||||||
|
|
||||||
|
else if(mode == UNWIRING)
|
||||||
|
if(io == selected_io)
|
||||||
|
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)
|
||||||
|
user << "<span class='notice'>You disconnect \the [selected_io.holder]'s [selected_io.name] from \
|
||||||
|
\the [io.holder]'s [io.name].</span>"
|
||||||
|
//io.updateDialog()
|
||||||
|
//selected_io.updateDialog()
|
||||||
|
selected_io = null
|
||||||
|
mode = UNWIRE
|
||||||
|
else
|
||||||
|
user << "<span class='warning'>\The [selected_io.holder]'s [selected_io.name] and \the [io.holder]'s \
|
||||||
|
[io.name] are not connected.<span>"
|
||||||
|
return
|
||||||
|
return
|
||||||
|
|
||||||
/obj/item/device/integrated_electronics/wirer/afterattack(atom/target, mob/user)
|
/obj/item/device/integrated_electronics/wirer/afterattack(atom/target, mob/user)
|
||||||
if(isobj(target))
|
if(isobj(target))
|
||||||
if(mode == WIRE)
|
if(mode == WIRE)
|
||||||
@@ -158,6 +212,11 @@
|
|||||||
mode = UNWIRE
|
mode = UNWIRE
|
||||||
if(UNWIRE)
|
if(UNWIRE)
|
||||||
mode = WIRE
|
mode = WIRE
|
||||||
|
if(UNWIRING)
|
||||||
|
if(selected_io)
|
||||||
|
user << "<span class='notice'>You decide not to disconnect the data channel.</span>"
|
||||||
|
selected_io = null
|
||||||
|
mode = UNWIRE
|
||||||
user << "<span class='notice'>You set \the [src] to [mode].<span>"
|
user << "<span class='notice'>You set \the [src] to [mode].<span>"
|
||||||
|
|
||||||
#undef WIRE
|
#undef WIRE
|
||||||
|
|||||||
@@ -254,6 +254,76 @@
|
|||||||
if(muzzle_flash)
|
if(muzzle_flash)
|
||||||
set_light(0)
|
set_light(0)
|
||||||
|
|
||||||
|
// Similar to the above proc, but does not require a user, which is ideal for things like turrets.
|
||||||
|
/obj/item/weapon/gun/proc/Fire_userless(atom/target)
|
||||||
|
if(!target)
|
||||||
|
return
|
||||||
|
|
||||||
|
if(world.time < next_fire_time)
|
||||||
|
return
|
||||||
|
|
||||||
|
var/shoot_time = (burst - 1)* burst_delay
|
||||||
|
next_fire_time = world.time + shoot_time
|
||||||
|
|
||||||
|
var/turf/targloc = get_turf(target) //cache this in case target gets deleted during shooting, e.g. if it was a securitron that got destroyed.
|
||||||
|
for(var/i in 1 to burst)
|
||||||
|
var/obj/projectile = consume_next_projectile()
|
||||||
|
if(!projectile)
|
||||||
|
handle_click_empty()
|
||||||
|
break
|
||||||
|
|
||||||
|
if(istype(projectile, /obj/item/projectile))
|
||||||
|
var/obj/item/projectile/P = projectile
|
||||||
|
|
||||||
|
var/acc = burst_accuracy[min(i, burst_accuracy.len)]
|
||||||
|
var/disp = dispersion[min(i, dispersion.len)]
|
||||||
|
|
||||||
|
P.accuracy = accuracy + acc
|
||||||
|
P.dispersion = disp
|
||||||
|
|
||||||
|
P.shot_from = src.name
|
||||||
|
P.silenced = silenced
|
||||||
|
|
||||||
|
P.launch(target)
|
||||||
|
|
||||||
|
if(silenced)
|
||||||
|
playsound(src, fire_sound, 10, 1)
|
||||||
|
else
|
||||||
|
playsound(src, fire_sound, 50, 1)
|
||||||
|
|
||||||
|
if(muzzle_flash)
|
||||||
|
set_light(muzzle_flash)
|
||||||
|
update_icon()
|
||||||
|
|
||||||
|
//process_accuracy(projectile, user, target, acc, disp)
|
||||||
|
|
||||||
|
// if(pointblank)
|
||||||
|
// process_point_blank(projectile, user, target)
|
||||||
|
|
||||||
|
// if(process_projectile(projectile, null, target, user.zone_sel.selecting, clickparams))
|
||||||
|
// handle_post_fire(null, target, pointblank, reflex)
|
||||||
|
|
||||||
|
// update_icon()
|
||||||
|
|
||||||
|
if(i < burst)
|
||||||
|
sleep(burst_delay)
|
||||||
|
|
||||||
|
if(!(target && target.loc))
|
||||||
|
target = targloc
|
||||||
|
//pointblank = 0
|
||||||
|
|
||||||
|
log_and_message_admins("Fired [src].")
|
||||||
|
|
||||||
|
//admin_attack_log(usr, attacker_message="Fired [src]", admin_message="fired a gun ([src]) (MODE: [src.mode_name]) [reflex ? "by reflex" : "manually"].")
|
||||||
|
|
||||||
|
//update timing
|
||||||
|
next_fire_time = world.time + fire_delay
|
||||||
|
|
||||||
|
if(muzzle_flash)
|
||||||
|
set_light(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//obtains the next projectile to fire
|
//obtains the next projectile to fire
|
||||||
/obj/item/weapon/gun/proc/consume_next_projectile()
|
/obj/item/weapon/gun/proc/consume_next_projectile()
|
||||||
return null
|
return null
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -1365,9 +1365,12 @@
|
|||||||
#include "code\modules\integrated_electronics\_limits.dm"
|
#include "code\modules\integrated_electronics\_limits.dm"
|
||||||
#include "code\modules\integrated_electronics\arithmetic.dm"
|
#include "code\modules\integrated_electronics\arithmetic.dm"
|
||||||
#include "code\modules\integrated_electronics\assemblies.dm"
|
#include "code\modules\integrated_electronics\assemblies.dm"
|
||||||
|
#include "code\modules\integrated_electronics\converters.dm"
|
||||||
|
#include "code\modules\integrated_electronics\coordinate.dm"
|
||||||
#include "code\modules\integrated_electronics\data_transfer.dm"
|
#include "code\modules\integrated_electronics\data_transfer.dm"
|
||||||
#include "code\modules\integrated_electronics\input_output.dm"
|
#include "code\modules\integrated_electronics\input_output.dm"
|
||||||
#include "code\modules\integrated_electronics\logic.dm"
|
#include "code\modules\integrated_electronics\logic.dm"
|
||||||
|
#include "code\modules\integrated_electronics\manipulation.dm"
|
||||||
#include "code\modules\integrated_electronics\memory.dm"
|
#include "code\modules\integrated_electronics\memory.dm"
|
||||||
#include "code\modules\integrated_electronics\time.dm"
|
#include "code\modules\integrated_electronics\time.dm"
|
||||||
#include "code\modules\integrated_electronics\tools.dm"
|
#include "code\modules\integrated_electronics\tools.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user