mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Ai update (#8023)
Co-authored-by: silicons <2003111+silicons@users.noreply.github.com> Co-authored-by: silicons <no@you.cat>
This commit is contained in:
@@ -31,4 +31,51 @@
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, desired_dir)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
activate_pin(2) //CHOMPEdit
|
||||
|
||||
//CHOMPEdit Begin
|
||||
/obj/item/integrated_circuit/smart/advanced_pathfinder
|
||||
name = "advanced pathfinder"
|
||||
desc = "This circuit uses a complex processor for long-range pathfinding."
|
||||
extended_desc = "This circuit uses absolute coordinates to find its target. A path will be generated to the target, taking obstacles into account, \
|
||||
and pathing around any instances of said input. The passkey provided from a card reader is used to calculate a valid path through airlocks."
|
||||
icon_state = "numberpad"
|
||||
complexity = 40
|
||||
cooldown_per_use = 50
|
||||
inputs = list("X target" = IC_PINTYPE_NUMBER,"Y target" = IC_PINTYPE_NUMBER,"obstacle" = IC_PINTYPE_REF,"access" = IC_PINTYPE_STRING)
|
||||
outputs = list("X" = IC_PINTYPE_LIST,"Y" = IC_PINTYPE_LIST)
|
||||
activators = list("calculate path" = IC_PINTYPE_PULSE_IN, "on calculated" = IC_PINTYPE_PULSE_OUT,"not calculated" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 80
|
||||
var/obj/item/weapon/card/id/idc
|
||||
|
||||
/obj/item/integrated_circuit/smart/advanced_pathfinder/Initialize(mapload)
|
||||
.=..()
|
||||
idc = new(src)
|
||||
|
||||
/obj/item/integrated_circuit/smart/advanced_pathfinder/do_work()
|
||||
if(!assembly)
|
||||
activate_pin(3)
|
||||
return
|
||||
//idc.access = assembly.access_card.access
|
||||
var/turf/a_loc = get_turf(assembly)
|
||||
|
||||
var/turf/target_turf = locate(get_pin_data(IC_INPUT, 1), get_pin_data(IC_INPUT, 2), a_loc.z)
|
||||
var/list/P = SSpathfinder.default_circuit_pathfinding(src, target_turf, 0, 200)
|
||||
|
||||
if(!P)
|
||||
activate_pin(3)
|
||||
return
|
||||
else
|
||||
var/list/Xn = new/list(P.len)
|
||||
var/list/Yn = new/list(P.len)
|
||||
var/turf/T
|
||||
for(var/i =1 to P.len)
|
||||
T=P[i]
|
||||
Xn[i] = T.x
|
||||
Yn[i] = T.y
|
||||
set_pin_data(IC_OUTPUT, 1, Xn)
|
||||
set_pin_data(IC_OUTPUT, 2, Yn)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
//CHOMPEdit End
|
||||
|
||||
Reference in New Issue
Block a user