[READY]Pulling claw 2 (#33817)

Pulling claw is integrated circuit,which allows drones to pull things.
This commit is contained in:
arsserpentarium
2018-01-11 23:02:56 +03:00
committed by CitadelStationBot
parent b2021912d7
commit 1d91243ae2
10 changed files with 162 additions and 57 deletions
@@ -38,6 +38,7 @@
/obj/item/device/electronic_assembly/process()
handle_idle_power()
check_pulling()
/obj/item/device/electronic_assembly/proc/handle_idle_power()
// First we generate power.
@@ -376,6 +377,13 @@
var/obj/item/integrated_circuit/IC = I
IC.ext_moved(oldLoc, dir)
/obj/item/device/electronic_assembly/stop_pulling()
..()
for(var/I in assembly_components)
var/obj/item/integrated_circuit/IC = I
IC.stop_pulling()
// Returns the object that is supposed to be used in attack messages, location checks, etc.
// Override in children for special behavior.
/obj/item/device/electronic_assembly/proc/get_object()
@@ -393,8 +401,7 @@
return acting_object.drop_location()
/obj/item/device/electronic_assembly/default //The /default electronic_assemblys are to allow the introduction of the new naming scheme without breaking old saves.
name = "type-a electronic assembly"
name = "type-a electronic assembly"
/obj/item/device/electronic_assembly/calc
name = "type-b electronic assembly"
@@ -306,4 +306,4 @@
set_pin_data(IC_OUTPUT, 1, result)
push_data()
activate_pin(2)
activate_pin(2)
@@ -349,6 +349,45 @@
set_pin_data(IC_OUTPUT, 3, contents.len)
push_data()
/obj/item/integrated_circuit/manipulation/claw
name = "pulling claw"
desc = "Circuit which can pull things.."
icon_state = "pull_claw"
extended_desc = "The circuit accepts a reference to thing to be pulled. Modes: 0 for release.1 for pull. 2 for gressive grab."
w_class = WEIGHT_CLASS_SMALL
size = 3
complexity = 10
inputs = list("target" = IC_PINTYPE_REF,"mode" = IC_PINTYPE_INDEX)
outputs = list("is pulling" = IC_PINTYPE_BOOLEAN)
activators = list("pulse in" = IC_PINTYPE_PULSE_IN,"pulse out" = IC_PINTYPE_PULSE_OUT,"released" = IC_PINTYPE_PULSE_OUT)
spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 50
var/max_grab = 2 //change it to 1 if you tired of drone kung-fu.Return it to 2 if you miss it.
/obj/item/integrated_circuit/manipulation/claw/do_work()
var/obj/acting_object = get_object()
var/atom/movable/AM = get_pin_data_as_type(IC_INPUT, 1, /atom/movable)
var/mode = get_pin_data(IC_INPUT, 2)
if(mode>max_grab)
return
if(AM)
if(check_target(AM, exclude_contents = TRUE))
acting_object.start_pulling(AM,mode)
if(acting_object.pulling)
set_pin_data(IC_OUTPUT, 1, TRUE)
else
set_pin_data(IC_OUTPUT, 1, FALSE)
push_data()
activate_pin(2)
/obj/item/integrated_circuit/manipulation/claw/stop_pulling()
..()
set_pin_data(IC_OUTPUT, 1, FALSE)
activate_pin(2)
push_data()
/obj/item/integrated_circuit/manipulation/thrower
name = "thrower"