diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index f44943ce87..3484389a65 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -518,16 +518,24 @@ Turf and target are separate in case you want to teleport some distance from a t Gets all contents of contents and returns them all in a list. */ -/atom/proc/GetAllContents() +/atom/proc/GetAllContents(var/T) var/list/processing_list = list(src) var/list/assembled = list() - while(processing_list.len) - var/atom/A = processing_list[1] - processing_list.Cut(1, 2) - //Byond does not allow things to be in multiple contents, or double parent-child hierarchies, so only += is needed - //This is also why we don't need to check against assembled as we go along - processing_list += A.contents - assembled += A + if(T) + while(processing_list.len) + var/atom/A = processing_list[1] + processing_list.Cut(1, 2) + //Byond does not allow things to be in multiple contents, or double parent-child hierarchies, so only += is needed + //This is also why we don't need to check against assembled as we go along + processing_list += A.contents + if(istype(A,T)) + assembled += A + else + while(processing_list.len) + var/atom/A = processing_list[1] + processing_list.Cut(1, 2) + processing_list += A.contents + assembled += A return assembled /atom/proc/GetAllContentsIgnoring(list/ignore_typecache) diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index 399debfe95..71605fc0dc 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -3,6 +3,7 @@ /obj/item/device/electronic_assembly name = "electronic assembly" + obj_flags = CAN_BE_HIT desc = "It's a case, for building small electronics with." w_class = WEIGHT_CLASS_SMALL icon = 'icons/obj/assemblies/electronic_setups.dmi' @@ -20,6 +21,8 @@ var/charge_tick = FALSE var/charge_delay = 4 var/use_cyborg_cell = TRUE + var/ext_next_use = 0 + var/atom/movable/collw var/allowed_circuit_action_flags = IC_ACTION_COMBAT | IC_ACTION_LONG_RANGE //which circuit flags are allowed var/combat_circuits = 0 //number of combat cicuits in the assembly, used for diagnostic hud var/long_range_circuits = 0 //number of long range cicuits in the assembly, used for diagnostic hud @@ -31,6 +34,9 @@ /obj/item/device/electronic_assembly/proc/check_interactivity(mob/user) return user.canUseTopic(src, BE_CLOSE) +/obj/item/device/electronic_assembly/CollidedWith(atom/movable/AM) + collw = AM + ..() /obj/item/device/electronic_assembly/Initialize() .=..() diff --git a/code/modules/integrated_electronics/core/integrated_circuit.dm b/code/modules/integrated_electronics/core/integrated_circuit.dm index ce55a50151..1b99b00765 100644 --- a/code/modules/integrated_electronics/core/integrated_circuit.dm +++ b/code/modules/integrated_electronics/core/integrated_circuit.dm @@ -15,7 +15,8 @@ var/next_use = 0 // Uses world.time var/complexity = 1 // This acts as a limitation on building machines, more resource-intensive components cost more 'space'. var/size = 1 // This acts as a limitation on building machines, bigger components cost more 'space'. -1 for size 0 - var/cooldown_per_use = 9 // Circuits are limited in how many times they can be work()'d by this variable. + var/cooldown_per_use = 1 // Circuits are limited in how many times they can be work()'d by this variable. + var/ext_cooldown = 0 // Circuits are limited in how many times they can be work()'d with external world by this variable. var/power_draw_per_use = 0 // How much power is drawn when work()'d. var/power_draw_idle = 0 // How much power is drawn when doing nothing. var/spawn_flags // Used for world initializing, see the #defines above. @@ -212,6 +213,9 @@ a creative player the means to solve many problems. Circuits are held inside an HTML += "" HTML += "
Complexity: [complexity]" + HTML += "
Cooldown per use: [cooldown_per_use/10] sec" + if(ext_cooldown) + HTML += "
External manipulation cooldown: [ext_cooldown/10] sec" if(power_draw_idle) HTML += "
Power Draw: [power_draw_idle] W (Idle)" if(power_draw_per_use) @@ -301,11 +305,15 @@ a creative player the means to solve many problems. Circuits are held inside an /obj/item/integrated_circuit/proc/check_then_do_work(ord,var/ignore_power = FALSE) if(world.time < next_use) // All intergrated circuits have an internal cooldown, to protect from spam. return FALSE + if(assembly && ext_cooldown && (world.time < assembly.ext_next_use)) // Some circuits have external cooldown, to protect from spam. + return FALSE if(power_draw_per_use && !ignore_power) if(!check_power()) power_fail() return FALSE next_use = world.time + cooldown_per_use + if(assembly) + assembly.ext_next_use = world.time + ext_cooldown do_work(ord) return TRUE diff --git a/code/modules/integrated_electronics/core/printer.dm b/code/modules/integrated_electronics/core/printer.dm index e1ec172710..c8ca7514fd 100644 --- a/code/modules/integrated_electronics/core/printer.dm +++ b/code/modules/integrated_electronics/core/printer.dm @@ -27,6 +27,8 @@ /obj/item/device/integrated_circuit_printer/debug //translation: "integrated_circuit_printer/local_server" name = "debug circuit printer" debug = TRUE + upgraded = TRUE + can_clone = TRUE w_class = WEIGHT_CLASS_TINY /obj/item/device/integrated_circuit_printer/Initialize() @@ -56,7 +58,6 @@ return TRUE to_chat(user, "You install [O] into [src]. ") upgraded = TRUE - qdel(O) interact(user) return TRUE @@ -66,7 +67,6 @@ return TRUE to_chat(user, "You install [O] into [src]. Circuit cloning will now be instant. ") fast_clone = TRUE - qdel(O) interact(user) return TRUE diff --git a/code/modules/integrated_electronics/passive/power.dm b/code/modules/integrated_electronics/passive/power.dm index f7df21fc9a..186a2df257 100644 --- a/code/modules/integrated_electronics/passive/power.dm +++ b/code/modules/integrated_electronics/passive/power.dm @@ -97,11 +97,15 @@ activators = list() spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH var/volume = 60 - var/list/fuel = list("plasma" = 10000, "welding_fuel" = 3000, "carbon" = 2000, "ethanol" = 2000, "nutriment" = 1600, "blood" = 1000) + var/list/fuel = list("plasma" = 50000, "welding_fuel" = 15000, "carbon" = 10000, "ethanol" = 10000, "nutriment" = 8000) + var/multi = 1 + var/lfwb =TRUE /obj/item/integrated_circuit/passive/power/chemical_cell/New() ..() create_reagents(volume) + extended_desc +="But no fuel can be compared with blood of living human." + /obj/item/integrated_circuit/passive/power/chemical_cell/interact(mob/user) set_pin_data(IC_OUTPUT, 2, WEAKREF(src)) @@ -115,7 +119,18 @@ /obj/item/integrated_circuit/passive/power/chemical_cell/make_energy() if(assembly) if(assembly.battery) + var/bp = 5000 + if(reagents.get_reagent_amount("blood")) //only blood is powerful enough to power the station(c) + var/datum/reagent/blood/B = locate() in reagents.reagent_list + if(lfwb) + if(B && B.data["cloneable"]) + var/mob/M = B.data["donor"] + if(M && M.stat != DEAD && M.client) + bp = 500000 + if((assembly.battery.maxcharge-assembly.battery.charge) / GLOB.CELLRATE > bp) + if(reagents.remove_reagent("blood", 1)) + assembly.give_power(bp) for(var/I in fuel) if((assembly.battery.maxcharge-assembly.battery.charge) / GLOB.CELLRATE > fuel[I]) if(reagents.remove_reagent(I, 1)) - assembly.give_power(fuel[I]) + assembly.give_power(fuel[I]*multi) diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index d9f151a23c..fa292c5644 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -416,6 +416,7 @@ spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH power_draw_per_use = 30 var/radius = 1 + cooldown_per_use = 10 /obj/item/integrated_circuit/input/advanced_locator_list/on_data_written() var/rad = get_pin_data(IC_INPUT, 2) @@ -526,7 +527,7 @@ action_flags = IC_ACTION_LONG_RANGE power_draw_idle = 5 power_draw_per_use = 40 - + cooldown_per_use = 5 var/frequency = FREQ_SIGNALER var/code = DEFAULT_SIGNALER_CODE var/datum/radio_frequency/radio_connection @@ -583,9 +584,7 @@ return 0 activate_pin(3) - - for(var/mob/O in hearers(1, get_turf(src))) - audible_message("[icon2html(src, hearers(src))] *beep* *beep*", null, 1) + audible_message("[icon2html(src, hearers(src))] *beep* *beep*", null, 1) /obj/item/integrated_circuit/input/ntnet_packet name = "NTNet networking circuit" @@ -596,6 +595,7 @@ can be send to multiple recepients. Addresses must be separated with ; symbol." icon_state = "signal" complexity = 4 + cooldown_per_use = 5 inputs = list( "target NTNet addresses"= IC_PINTYPE_STRING, "data to send" = IC_PINTYPE_STRING, diff --git a/code/modules/integrated_electronics/subtypes/lists.dm b/code/modules/integrated_electronics/subtypes/lists.dm index aa373c9940..9f7dbe078b 100644 --- a/code/modules/integrated_electronics/subtypes/lists.dm +++ b/code/modules/integrated_electronics/subtypes/lists.dm @@ -13,6 +13,7 @@ ) category_text = "Lists" power_draw_per_use = 20 + cooldown_per_use = 10 /obj/item/integrated_circuit/lists/pick name = "pick circuit" @@ -28,6 +29,7 @@ "on failure" = IC_PINTYPE_PULSE_OUT, ) spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH + cooldown_per_use = 1 /obj/item/integrated_circuit/lists/pick/do_work() var/list/input_list = get_pin_data(IC_INPUT, 1) // List pins guarantee that there is a list inside, even if just an empty one. @@ -83,6 +85,7 @@ ) icon_state = "addition" spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH + cooldown_per_use = 1 /obj/item/integrated_circuit/lists/search/do_work() var/list/input_list = get_pin_data(IC_INPUT, 1) @@ -115,6 +118,7 @@ ) icon_state = "addition" spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH + cooldown_per_use = 1 /obj/item/integrated_circuit/lists/at/do_work() var/list/input_list = get_pin_data(IC_INPUT, 1) @@ -218,6 +222,7 @@ set_pin_data(IC_OUTPUT, 1, input_list.len) push_data() activate_pin(2) + cooldown_per_use = 1 /obj/item/integrated_circuit/lists/jointext @@ -240,6 +245,7 @@ ) icon_state = "addition" spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH + cooldown_per_use = 1 /obj/item/integrated_circuit/lists/jointext/do_work() var/list/input_list = get_pin_data(IC_INPUT, 1) @@ -312,7 +318,7 @@ ) outputs = list() spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH - var/number_of_pins = 4 + var/number_of_pins = 16 /obj/item/integrated_circuit/lists/deconstructor/Initialize() for(var/i = 1 to number_of_pins) diff --git a/code/modules/integrated_electronics/subtypes/manipulation.dm b/code/modules/integrated_electronics/subtypes/manipulation.dm index ddac72a76a..b30500fad4 100644 --- a/code/modules/integrated_electronics/subtypes/manipulation.dm +++ b/code/modules/integrated_electronics/subtypes/manipulation.dm @@ -25,6 +25,7 @@ spawn_flags = IC_SPAWN_RESEARCH action_flags = IC_ACTION_COMBAT power_draw_per_use = 0 + ext_cooldown = 1 var/mode = FALSE var/stun_projectile = null //stun mode projectile type @@ -57,7 +58,7 @@ if(gun_properties["shot_delay"]) cooldown_per_use = gun_properties["shot_delay"]*10 if(cooldown_per_use<30) - cooldown_per_use = 40 + cooldown_per_use = 30 if(gun_properties["reqpower"]) power_draw_per_use = gun_properties["reqpower"] set_pin_data(IC_OUTPUT, 1, WEAKREF(installed_gun)) @@ -139,8 +140,10 @@ being held, or anchored in some way. It should be noted that the ability to move is dependant on the type of assembly that this circuit inhabits." w_class = WEIGHT_CLASS_SMALL complexity = 20 + cooldown_per_use = 8 + ext_cooldown = 1 inputs = list("direction" = IC_PINTYPE_DIR) - outputs = list() + outputs = list("obstacle" = IC_PINTYPE_REF) activators = list("step towards dir" = IC_PINTYPE_PULSE_IN,"on step"=IC_PINTYPE_PULSE_OUT,"blocked"=IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_RESEARCH action_flags = IC_ACTION_MOVEMENT @@ -159,6 +162,7 @@ activate_pin(2) return else + set_pin_data(IC_OUTPUT, 1, WEAKREF(assembly.collw)) activate_pin(3) return FALSE return FALSE @@ -171,6 +175,7 @@ Beware: Once primed there is no aborting the process!" icon_state = "grenade" complexity = 30 + cooldown_per_use = 10 inputs = list("detonation time" = IC_PINTYPE_NUMBER) outputs = list() activators = list("prime grenade" = IC_PINTYPE_PULSE_IN) @@ -241,6 +246,7 @@ icon_state = "plant_m" extended_desc = "The circuit accepts a reference to a hydroponic tray in an adjacent tile. \ Mode(0- harvest, 1-uproot weeds, 2-uproot plant) determinies action." + cooldown_per_use = 10 w_class = WEIGHT_CLASS_TINY complexity = 10 inputs = list("target" = IC_PINTYPE_REF,"mode" = IC_PINTYPE_NUMBER) @@ -300,7 +306,7 @@ extended_desc = "The circuit accepts a reference to an object to be grabbed and can store up to 10 objects. Modes: 1 to grab, 0 to eject the first object, and -1 to eject all objects." w_class = WEIGHT_CLASS_SMALL size = 3 - + cooldown_per_use = 5 complexity = 10 inputs = list("target" = IC_PINTYPE_REF,"mode" = IC_PINTYPE_NUMBER) outputs = list("first" = IC_PINTYPE_REF, "last" = IC_PINTYPE_REF, "amount" = IC_PINTYPE_NUMBER,"contents" = IC_PINTYPE_LIST) @@ -362,13 +368,14 @@ extended_desc = "The circuit accepts a reference to thing to be pulled. Modes: 0 for release. 1 for pull." w_class = WEIGHT_CLASS_SMALL size = 3 - + cooldown_per_use = 5 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 + ext_cooldown = 1 var/max_grab = GRAB_PASSIVE /obj/item/integrated_circuit/manipulation/claw/do_work() @@ -403,6 +410,8 @@ complexity = 15 w_class = WEIGHT_CLASS_SMALL size = 2 + cooldown_per_use = 10 + ext_cooldown = 1 inputs = list( "target X rel" = IC_PINTYPE_NUMBER, "target Y rel" = IC_PINTYPE_NUMBER, diff --git a/code/modules/integrated_electronics/subtypes/output.dm b/code/modules/integrated_electronics/subtypes/output.dm index 649c66ae3d..88c6530ccb 100644 --- a/code/modules/integrated_electronics/subtypes/output.dm +++ b/code/modules/integrated_electronics/subtypes/output.dm @@ -3,6 +3,7 @@ /obj/item/integrated_circuit/output/screen name = "small screen" + extended_desc = " use <br> to start a new line" desc = "Takes any data type as an input, and displays it to the user upon examining." icon_state = "screen" inputs = list("displayed data" = IC_PINTYPE_ANY) @@ -10,6 +11,8 @@ activators = list("load data" = IC_PINTYPE_PULSE_IN) spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH power_draw_per_use = 10 + cooldown_per_use = 10 + var/eol = "<br>" var/stuff_to_display = null /obj/item/integrated_circuit/output/screen/disconnect_all() @@ -30,7 +33,7 @@ if(d) stuff_to_display = "[d]" else - stuff_to_display = I.data + stuff_to_display = replacetext("[I.data]", eol , "
") /obj/item/integrated_circuit/output/screen/medium name = "screen" @@ -219,6 +222,7 @@ desc = "Takes any string as an input and will make the device say the string when pulsed." extended_desc = "This unit is more advanced than the plain speaker circuit, able to transpose any valid text to speech." icon_state = "speaker" + ext_cooldown = 2 complexity = 12 inputs = list("text" = IC_PINTYPE_STRING) outputs = list() diff --git a/code/modules/integrated_electronics/subtypes/power.dm b/code/modules/integrated_electronics/subtypes/power.dm index 872f70a20f..7db6ecfcc8 100644 --- a/code/modules/integrated_electronics/subtypes/power.dm +++ b/code/modules/integrated_electronics/subtypes/power.dm @@ -28,7 +28,8 @@ extended_desc = "This circuit transmits 20 kJ of electricity every time the activator pin is pulsed. The input pin must be \ a reference to a machine to send electricity to. This can be a battery, or anything containing a battery. The machine can exist \ inside the assembly, or adjacent to it. The power is sourced from the assembly's power cell. If the target is outside of the assembly, \ - some power is lost due to ineffiency." + some power is lost due to ineffiency.Warning!Don't stack more than 1 power transmittors.it becomes less efficient for every other \ + transmission circuit in its own assembly and other nearby ones. " w_class = WEIGHT_CLASS_BULKY complexity = 32 power_draw_per_use = 2000 @@ -49,6 +50,8 @@ if(A.Adjacent(B)) if(AM.loc != assembly) transfer_amount *= 0.8 // Losses due to distance. + var/list/U=A.GetAllContents(/obj/item/integrated_circuit/power/transmitter) + transfer_amount *= 1 / U.len set_pin_data(IC_OUTPUT, 1, cell.charge) set_pin_data(IC_OUTPUT, 2, cell.maxcharge) set_pin_data(IC_OUTPUT, 3, cell.percent()) @@ -61,7 +64,6 @@ if(istype(AM, /obj/item)) var/obj/item/I = AM I.update_icon() - return TRUE else set_pin_data(IC_OUTPUT, 1, null) diff --git a/code/modules/integrated_electronics/subtypes/reagents.dm b/code/modules/integrated_electronics/subtypes/reagents.dm index 9e267b120c..2cd3ccb8cf 100644 --- a/code/modules/integrated_electronics/subtypes/reagents.dm +++ b/code/modules/integrated_electronics/subtypes/reagents.dm @@ -3,6 +3,7 @@ /obj/item/integrated_circuit/reagent category_text = "Reagent" resistance_flags = UNACIDABLE | FIRE_PROOF + cooldown_per_use = 10 var/volume = 0 /obj/item/integrated_circuit/reagent/Initialize() @@ -21,7 +22,7 @@ icon_state = "smoke" extended_desc = "This smoke generator creates clouds of smoke on command. It can also hold liquids inside, which will go \ into the smoke clouds when activated. The reagents are consumed when smoke is made." - + ext_cooldown = 1 container_type = OPENCONTAINER volume = 100 @@ -281,6 +282,7 @@ activate_pin(2) /obj/item/integrated_circuit/reagent/storage + cooldown_per_use = 1 name = "reagent storage" desc = "Stores liquid inside the device away from electrical components. It can store up to 60u." icon_state = "reagent_storage" diff --git a/code/modules/integrated_electronics/subtypes/time.dm b/code/modules/integrated_electronics/subtypes/time.dm index d93aafef58..86e5e99059 100644 --- a/code/modules/integrated_electronics/subtypes/time.dm +++ b/code/modules/integrated_electronics/subtypes/time.dm @@ -1,7 +1,7 @@ /obj/item/integrated_circuit/time name = "time circuit" desc = "Now you can build your own clock!" - complexity = 2 + complexity = 1 inputs = list() outputs = list() category_text = "Time" @@ -71,7 +71,7 @@ name = "ticker circuit" desc = "This circuit sends an automatic pulse every four seconds." icon_state = "tick-m" - complexity = 8 + complexity = 4 var/delay = 4 SECONDS var/next_fire = 0 var/is_running = FALSE @@ -102,11 +102,28 @@ activate_pin(1) +/obj/item/integrated_circuit/time/ticker/custom + name = "custom ticker" + desc = "This advanced circuit sends an automatic pulse every given interval." + icon_state = "tick-f" + complexity = 8 + delay = 2 SECONDS + inputs = list("enable ticking" = IC_PINTYPE_BOOLEAN,"delay time" = IC_PINTYPE_NUMBER) + spawn_flags = IC_SPAWN_RESEARCH + power_draw_per_use = 8 + +/obj/item/integrated_circuit/time/ticker/custom/on_data_written() + var/delay_input = get_pin_data(IC_INPUT, 2) + if(delay_input && isnum(delay_input) ) + var/new_delay = CLAMP(delay_input ,1 ,1 HOURS) + delay = new_delay + ..() + /obj/item/integrated_circuit/time/ticker/fast name = "fast ticker" desc = "This advanced circuit sends an automatic pulse every two seconds." icon_state = "tick-f" - complexity = 12 + complexity = 6 delay = 2 SECONDS spawn_flags = IC_SPAWN_RESEARCH power_draw_per_use = 8 @@ -115,7 +132,7 @@ name = "slow ticker" desc = "This simple circuit sends an automatic pulse every six seconds." icon_state = "tick-s" - complexity = 4 + complexity = 2 delay = 6 SECONDS spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH power_draw_per_use = 2 @@ -142,4 +159,4 @@ set_pin_data(IC_OUTPUT, 3, text2num(time2text(wtime, "mm") ) ) set_pin_data(IC_OUTPUT, 4, text2num(time2text(wtime, "ss") ) ) push_data() - activate_pin(2) \ No newline at end of file + activate_pin(2)