Update printer.dm
This commit is contained in:
@@ -194,184 +194,4 @@
|
||||
name = "integrated circuit printer upgrade disk - circuit cloner"
|
||||
desc = "Install this into your integrated circuit printer to enhance it. This one allows the printer to duplicate assemblies."
|
||||
icon_state = "upgrade_disk_clone"
|
||||
<<<<<<< HEAD
|
||||
origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 5)
|
||||
|
||||
/obj/item/device/integrated_circuit_printer/proc/sanity_check(var/program,var/mob/user)
|
||||
var/list/chap = splittext( program ,"{{*}}")
|
||||
if(chap.len != 6)
|
||||
return 0 //splitting incorrect
|
||||
var/list/elements = list()
|
||||
var/list/elements_input = list()
|
||||
var/list/element = list()
|
||||
var/obj/item/PA
|
||||
var/obj/item/device/electronic_assembly/PF
|
||||
var/datum/integrated_io/IO
|
||||
var/datum/integrated_io/IO2
|
||||
var/i = 0
|
||||
var/obj/item/integrated_circuit/comp
|
||||
var/list/ioa = list()
|
||||
var/list/as_samp = list()
|
||||
var/list/all_circuits = SScircuit.all_circuits // It's free. Performance. We're giving you cpu time. It's free. We're giving you time. It's performance, free. It's free cpu time for you jim!
|
||||
var/list/assembly_list = list(
|
||||
/obj/item/device/electronic_assembly,
|
||||
/obj/item/device/electronic_assembly/medium,
|
||||
/obj/item/device/electronic_assembly/large,
|
||||
/obj/item/device/electronic_assembly/drone,
|
||||
)
|
||||
var/compl = 0
|
||||
var/maxcomp = 0
|
||||
var/cap = 0
|
||||
var/maxcap = 0
|
||||
var/metalcost = 0
|
||||
for(var/k in 1 to assembly_list.len)
|
||||
var/obj/item/I = assembly_list[k]
|
||||
as_samp[initial(I.name)] = I
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>started successful</span>")
|
||||
if(chap[2] != "")
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>assembly</span>")
|
||||
element = splittext( chap[2] ,"=-=")
|
||||
PA = as_samp[element[1]]
|
||||
if(ispath(PA,/obj/item/device/electronic_assembly))
|
||||
PF = PA
|
||||
maxcap = initial(PF.max_components)
|
||||
maxcomp = initial(PF.max_complexity)
|
||||
metalcost = metalcost + round( (initial(PF.max_complexity) + initial(PF.max_components) ) / 4)
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>maxcap[maxcap]maxcomp[maxcomp]</span>")
|
||||
else
|
||||
return 0
|
||||
to_chat(usr, "<span class='notice'>This is program for [element[2]]</span>")
|
||||
|
||||
else
|
||||
return 0 //what's the point if there is no assembly?
|
||||
if(chap[3] != "components") //if there is only one word,there is no components.
|
||||
elements_input = splittext( chap[3] ,"^%^")
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>components[elements_input.len]</span>")
|
||||
i = 0
|
||||
elements = list()
|
||||
for(var/elem in elements_input)
|
||||
i=i+1
|
||||
if(i>1)
|
||||
elements.Add(elem)
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>components[elements.len]</span>")
|
||||
if(elements_input.len<1)
|
||||
return 0
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>inserting components[elements.len]</span>")
|
||||
i=0
|
||||
for(var/E in elements)
|
||||
i=i+1
|
||||
element = splittext( E ,"=-=")
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>[E]</span>")
|
||||
comp = all_circuits[element[1]]
|
||||
if(!comp)
|
||||
break
|
||||
if(!upgraded)
|
||||
var/obj/item/integrated_circuit/IC = comp
|
||||
if(!(initial(IC.spawn_flags) & IC_SPAWN_DEFAULT))
|
||||
return -1
|
||||
compl = compl + initial(comp.complexity)
|
||||
cap = cap + initial(comp.size)
|
||||
metalcost = metalcost + initial(initial(comp.w_class))
|
||||
var/obj/item/integrated_circuit/circuit = new comp
|
||||
var/list/ini = circuit.inputs
|
||||
if(length(ini))
|
||||
for(var/j in 1 to ini.len)
|
||||
var/datum/integrated_io/IN = ini[j]
|
||||
ioa["[i]i[j]"] = IN
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>[i]i[j]</span>")
|
||||
ini = circuit.outputs
|
||||
if(length(ini))
|
||||
for(var/j in 1 to ini.len) //Also this block uses for setting all i/o id's
|
||||
var/datum/integrated_io/OUT = ini[j]
|
||||
ioa["[i]o[j]"] = OUT
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>[i]o[j]</span>")
|
||||
ini = circuit.activators
|
||||
if(length(ini))
|
||||
for(var/j in 1 to ini.len)
|
||||
var/datum/integrated_io/ACT = ini.[j]
|
||||
ioa["[i]a[j]"] = ACT
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>[i]a[j]</span>")
|
||||
if(i<elements.len)
|
||||
return 0
|
||||
else
|
||||
return 0
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>cap[cap]compl[compl]maxcompl[maxcomp]maxcap[maxcap]</span>")
|
||||
if(cap == 0)
|
||||
return 0
|
||||
if(cap>maxcap)
|
||||
return 0
|
||||
if(compl>maxcomp)
|
||||
return 0
|
||||
if(chap[4] != "values") //if there is only one word,there is no values
|
||||
elements_input = splittext( chap[4] ,"^%^")
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>values[elements_input.len]</span>")
|
||||
i=0
|
||||
elements = list()
|
||||
for(var/elem in elements_input)
|
||||
i=i+1
|
||||
if(i>1)
|
||||
elements.Add(elem)
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>values[elements.len]</span>")
|
||||
if(elements.len>0)
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>setting values[elements.len]</span>")
|
||||
for(var/E in elements)
|
||||
element = splittext( E ,":+:")
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>[E]</span>")
|
||||
if(!ioa[element[1]])
|
||||
return 0
|
||||
if(element[2]=="text")
|
||||
continue
|
||||
else if(element[2]=="num")
|
||||
continue
|
||||
else if(element[2]=="list")
|
||||
continue
|
||||
else
|
||||
return 0
|
||||
|
||||
if(chap[5] != "wires") //if there is only one word,there is no wires
|
||||
elements_input = splittext( chap[5] ,"^%^")
|
||||
i=0
|
||||
elements = list()
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>wires[elements_input.len]</span>")
|
||||
for(var/elem in elements_input)
|
||||
i=i+1
|
||||
if(i>1)
|
||||
elements.Add(elem)
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>wires[elements.len]</span>")
|
||||
if(elements.len>0)
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>setting wires[elements.len]</span>")
|
||||
for(var/E in elements)
|
||||
element = splittext( E ,"=-=")
|
||||
if(debug)
|
||||
visible_message( "<span class='notice'>[E]</span>")
|
||||
IO = ioa[element[1]]
|
||||
IO2 = ioa[element[2]]
|
||||
if(!((element[2]+"=-="+element[1]) in elements))
|
||||
return 0
|
||||
if(!IO)
|
||||
return 0
|
||||
if(!IO2)
|
||||
return 0
|
||||
if(initial(IO.io_type) != initial(IO2.io_type))
|
||||
return 0
|
||||
return metalcost
|
||||
=======
|
||||
>>>>>>> b161b18... Integrated circuit fixes and code improvements (#32773)
|
||||
|
||||
Reference in New Issue
Block a user