|
22 | 22 | armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, RAD = 0, FIRE = 100, ACID = 50) |
23 | 23 | resistance_flags = FIRE_PROOF |
24 | 24 | origin_tech = "engineering=4;materials=2" |
| 25 | + new_attack_chain = TRUE |
25 | 26 | var/datum/effect_system/spark_spread/spark_system |
26 | 27 | var/lastused |
27 | | - var/iconrotation = 0 //Used to orient icons and pipes |
28 | | - var/mode = RPD_ATMOS_MODE //Disposals, atmospherics, etc. |
29 | | - var/pipe_category = RPD_ATMOS_PIPING //For TGUI menus, this is a subtype of pipes e.g. scrubbers pipes, devices |
30 | | - var/whatpipe = PIPE_SIMPLE_STRAIGHT //What kind of atmos pipe is it? |
31 | | - var/whatdpipe = PIPE_DISPOSALS_STRAIGHT //What kind of disposals pipe is it? |
| 28 | + /// Used to orient icons and pipes. |
| 29 | + var/iconrotation = 0 |
| 30 | + /// Disposals, atmospherics, etc. |
| 31 | + var/mode = RPD_ATMOS_MODE |
| 32 | + /// For TGUI menus, this is a subtype of pipes e.g. scrubbers pipes, devices. |
| 33 | + var/pipe_category = RPD_ATMOS_PIPING |
| 34 | + /// What kind of atmos pipe are we trying to lay? |
| 35 | + var/whatpipe = PIPE_SIMPLE_STRAIGHT |
| 36 | + /// What kind of disposals pipe are we trying to lay? |
| 37 | + var/whatdpipe = PIPE_DISPOSALS_STRAIGHT |
| 38 | + /// What kind of transit tube are we trying to lay? |
32 | 39 | var/whatttube = PIPE_TRANSIT_TUBE |
| 40 | + /// Cooldown on RPD use. |
33 | 41 | var/spawndelay = RPD_COOLDOWN_TIME |
| 42 | + /// Time taken to drill a borehole before the pipe can be laid. |
34 | 43 | var/walldelay = RPD_WALLBUILD_TIME |
| 44 | + /// Can this RPD lay pipe on non-adjacent turfs? |
35 | 45 | var/ranged = FALSE |
36 | 46 | var/primary_sound = 'sound/machines/click.ogg' |
37 | 47 | var/alt_sound = null |
|
209 | 219 | return |
210 | 220 | // TGUI stuff |
211 | 221 |
|
212 | | -/obj/item/rpd/attack_self__legacy__attackchain(mob/user) |
| 222 | +/obj/item/rpd/activate_self(mob/user) |
| 223 | + if(..()) |
| 224 | + return |
213 | 225 | ui_interact(user) |
214 | 226 |
|
215 | 227 | /obj/item/rpd/ui_state(mob/user) |
|
303 | 315 | else |
304 | 316 | return //Either nothing was selected, or an invalid mode was selected |
305 | 317 | to_chat(user, "<span class='notice'>You set [src]'s mode.</span>") |
| 318 | + |
| 319 | +/obj/item/rpd/ranged_interact_with_atom(atom/target, mob/living/user, list/modifiers) |
| 320 | + if(!ranged) |
| 321 | + return NONE |
| 322 | + |
| 323 | + if(handle_atom_interaction(target, user, ranged)) |
| 324 | + return ITEM_INTERACT_COMPLETE |
| 325 | + |
| 326 | + return NONE |
| 327 | + |
| 328 | +/obj/item/rpd/interact_with_atom(atom/target, mob/living/user, list/modifiers) |
| 329 | + if(handle_atom_interaction(target, user, ranged)) |
| 330 | + return ITEM_INTERACT_COMPLETE |
306 | 331 |
|
307 | | -/obj/item/rpd/afterattack__legacy__attackchain(atom/target, mob/user, proximity) |
308 | | - ..() |
| 332 | + return NONE |
| 333 | + |
| 334 | +/obj/item/rpd/proc/handle_atom_interaction(atom/target, mob/living/user, ranged) |
309 | 335 | if(isstorage(target)) |
310 | 336 | var/obj/item/storage/S = target |
311 | 337 | if(!S.can_be_inserted(src, stop_messages = TRUE)) |
312 | | - return |
313 | | - if(loc != user) |
314 | | - return |
315 | | - if(!proximity && !ranged) |
316 | | - return |
| 338 | + return ITEM_INTERACT_COMPLETE |
| 339 | + return NONE |
| 340 | + |
317 | 341 | if(world.time < lastused + spawndelay) |
318 | | - return |
| 342 | + return ITEM_INTERACT_COMPLETE |
319 | 343 |
|
320 | | - var/turf/T = get_turf(target) |
| 344 | + // Use as melee weapon |
| 345 | + if(user.a_intent == INTENT_HARM) |
| 346 | + return NONE |
321 | 347 |
|
| 348 | + var/turf/T = get_turf(target) |
322 | 349 | if(!T) |
323 | | - return |
| 350 | + return ITEM_INTERACT_COMPLETE |
324 | 351 |
|
325 | 352 | if(target != T) |
326 | 353 | // We only check the rpd_act of the target if it isn't the turf, because otherwise |
|
329 | 356 | // If the object we are clicking on has a valid RPD interaction for just that specific object, do that and nothing else. |
330 | 357 | // Example: clicking on a pipe with a RPD in rotate mode should rotate that pipe and ignore everything else on the tile. |
331 | 358 | if(ranged) |
332 | | - user.Beam(T, icon_state="rped_upgrade", icon='icons/effects/effects.dmi', time=5) |
333 | | - return |
| 359 | + user.Beam(T, icon_state = "rped_upgrade", icon = 'icons/effects/effects.dmi', time = 0.5 SECONDS) |
| 360 | + return ITEM_INTERACT_COMPLETE |
334 | 361 |
|
335 | 362 | // If we get this far, we have to check every object in the tile, to make sure that none of them block RPD usage on this tile. |
336 | 363 | // This is done by calling rpd_blocksusage on every /obj in the tile. If any block usage, fail at this point. |
337 | | - |
338 | 364 | for(var/obj/O in T) |
339 | 365 | if(O.rpd_blocksusage()) |
340 | 366 | to_chat(user, "<span class='warning'>[O] blocks [src]!</span>") |
341 | | - return |
| 367 | + return ITEM_INTERACT_COMPLETE |
342 | 368 |
|
343 | 369 | // If we get here, then we're effectively acting on the turf, probably placing a pipe. |
344 | | - if(ranged) //woosh beam if bluespaced at a distance |
| 370 | + if(ranged) //woosh beam! |
345 | 371 | if(get_dist(src, T) >= (user.client.maxview() / 2)) |
346 | | - message_admins("\[EXPLOIT] [key_name_admin(user)] attempted to place pipes with a BRPD via a camera console. (Attempted range exploit)") |
| 372 | + message_admins("\[EXPLOIT] [key_name_admin(user)] attempted to place pipes with a BRPD via a camera console (attempted range exploit).") |
347 | 373 | playsound(src, 'sound/machines/synth_no.ogg', 15, TRUE) |
348 | | - to_chat(user, "<span class='notice'>ERROR: \The [T] is out of [src]'s range!</span>") |
349 | | - return |
| 374 | + to_chat(user, "<span class='warning'>ERROR: \The [T] is out of [src]'s range!</span>") |
| 375 | + return ITEM_INTERACT_COMPLETE |
350 | 376 |
|
351 | 377 | if(!(user in hearers(12, T))) // Checks if user can hear the target turf, cause viewers doesnt work for it. |
352 | 378 | to_chat(user, "<span class='warning'>[src] needs full visibility to determine the dispensing location.</span>") |
353 | 379 | playsound(src, 'sound/machines/synth_no.ogg', 50, TRUE) |
354 | | - return |
| 380 | + return ITEM_INTERACT_COMPLETE |
| 381 | + |
355 | 382 | user.Beam(T, icon_state = "rped_upgrade", icon = 'icons/effects/effects.dmi', time = 0.5 SECONDS) |
356 | 383 | T.rpd_act(user, src) |
357 | | - |
358 | | -/obj/item/rpd/attack_obj__legacy__attackchain(obj/O, mob/living/user) |
359 | | - if(user.a_intent != INTENT_HARM) |
360 | | - if(istype(O, /obj/machinery/atmospherics/pipe)) |
361 | | - return |
362 | | - else if(istype(O, /obj/structure/disposalconstruct)) |
363 | | - return |
364 | | - else if(istype(O, /obj/structure/transit_tube_construction)) |
365 | | - return |
366 | | - |
367 | | - return ..() |
| 384 | + return ITEM_INTERACT_COMPLETE |
368 | 385 |
|
369 | 386 | #undef RPD_COOLDOWN_TIME |
370 | 387 | #undef RPD_WALLBUILD_TIME |
|
0 commit comments