mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 05:27:01 +01:00
Buffs the Rapid Cable Layer and Puts it in the Hands of People (#31513)
* cables * RCL deployment * Update RCL.dm * procedural colour woo * Update RCL.dm * Update RCL.dm * Update RCL.dm --------- Signed-off-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
This commit is contained in:
+148
-63
@@ -1,49 +1,67 @@
|
||||
/obj/item/rcl
|
||||
name = "rapid cable layer (RCL)"
|
||||
desc = "A device used to rapidly deploy cables. It has screws on the side which can be removed to slide off the cables."
|
||||
icon = 'icons/obj/tools.dmi'
|
||||
icon_state = "rcl-0"
|
||||
inhand_icon_state = "rcl-0"
|
||||
force = 5 //Plastic is soft
|
||||
desc = "An electrician's best friend, this plastic spool can hold a large amount of cable and rapidly lay it down."
|
||||
icon = 'icons/obj/rcl.dmi'
|
||||
icon_state = "rcl"
|
||||
inhand_icon_state = "rcl"
|
||||
throwforce = 5
|
||||
throw_speed = 1
|
||||
origin_tech = "engineering=4;materials=2"
|
||||
materials = list(MAT_METAL = 5000)
|
||||
var/max_amount = 90
|
||||
var/active = FALSE
|
||||
var/obj/structure/cable/last = null
|
||||
var/obj/item/stack/cable_coil/loaded = null
|
||||
var/obj/structure/cable/last
|
||||
var/obj/item/stack/cable_coil/random/rcl_spool/loaded
|
||||
new_attack_chain = TRUE
|
||||
|
||||
/obj/item/rcl/Initialize(mapload)
|
||||
. = ..()
|
||||
loaded = new()
|
||||
AddComponent(/datum/component/two_handed)
|
||||
update_icon(UPDATE_ICON_STATE|UPDATE_OVERLAYS)
|
||||
|
||||
/obj/item/rcl/examine(mob/user)
|
||||
. = ..()
|
||||
if(loaded.amount)
|
||||
. += SPAN_NOTICE("It contains <b>[loaded.amount]/[RCL_MAX_SPOOL_SIZE]</b> cables.")
|
||||
else
|
||||
. += SPAN_WARNING("It's empty!")
|
||||
. += SPAN_NOTICE("Use in-hand to swap to [active ? "standard" : "Rapid Cable Laying"] mode.")
|
||||
|
||||
/obj/item/rcl/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
||||
if(!istype(used, /obj/item/stack/cable_coil))
|
||||
return ..()
|
||||
|
||||
var/obj/item/stack/cable_coil/coil = used
|
||||
if(!loaded)
|
||||
if(!user.transfer_item_to(coil, src))
|
||||
to_chat(user, SPAN_WARNING("[coil] is stuck to your hand!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
loaded = coil
|
||||
loaded.max_amount = max_amount //We store a lot.
|
||||
else
|
||||
if(loaded.amount >= max_amount)
|
||||
to_chat(user, SPAN_WARNING("You cannot fit any more cable on [src]!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
var/amount = min(loaded.amount + coil.get_amount(), max_amount)
|
||||
coil.use(amount - loaded.amount)
|
||||
loaded.amount = amount
|
||||
refresh_icon(user)
|
||||
to_chat(user, SPAN_NOTICE("You add the cables to [src]. It now contains [loaded.amount]."))
|
||||
if(loaded.amount >= RCL_MAX_SPOOL_SIZE)
|
||||
to_chat(user, SPAN_WARNING("You cannot fit any more cable on [src]!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
// When loading an empty cable spool, turn it into either standard or heavy based on what we're loading.
|
||||
if(!loaded.amount)
|
||||
loaded.color = coil.color
|
||||
loaded.cable_type = coil.cable_type
|
||||
loaded.cable_merge_id = coil.cable_merge_id
|
||||
else if(loaded.cable_merge_id != coil.cable_merge_id)
|
||||
to_chat(user, SPAN_WARNING("These coils are of different types!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
var/amount = min(loaded.amount + coil.get_amount(), RCL_MAX_SPOOL_SIZE)
|
||||
coil.use(amount - loaded.amount)
|
||||
loaded.amount = amount
|
||||
refresh_icon(user)
|
||||
to_chat(user, SPAN_NOTICE("You add the cables to [src]. It now contains [loaded.amount]."))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/obj/item/rcl/interact_with_atom(atom/target, mob/living/user, list/modifiers)
|
||||
if(istype(target, /obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/C = target
|
||||
C.melee_attack_chain(user, src, list2params(modifiers))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
loaded.melee_attack_chain(user, target, list2params(modifiers))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/obj/item/rcl/proc/refresh_icon(mob/user)
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
update_icon(UPDATE_ICON_STATE|UPDATE_OVERLAYS)
|
||||
user.update_inv_l_hand()
|
||||
user.update_inv_r_hand()
|
||||
|
||||
@@ -55,57 +73,64 @@
|
||||
if(!I.use_tool(src, user, FALSE, volume = I.tool_volume))
|
||||
return
|
||||
to_chat(user, SPAN_NOTICE("You loosen the securing screws on the side, allowing you to lower the guiding edge and retrieve the wires."))
|
||||
while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89)
|
||||
var/diff = loaded.amount % 30
|
||||
if(diff)
|
||||
while(loaded.amount)
|
||||
var/diff = 30
|
||||
if(loaded.amount < 30)
|
||||
diff = loaded.amount
|
||||
if(loaded.cable_merge_id == CABLE_LOW_POWER)
|
||||
var/obj/item/stack/cable_coil/dropped_coil = new /obj/item/stack/cable_coil(user.loc, diff)
|
||||
dropped_coil.color = loaded.color
|
||||
loaded.use(diff)
|
||||
new /obj/item/stack/cable_coil(user.loc, diff)
|
||||
else
|
||||
loaded.use(30)
|
||||
new /obj/item/stack/cable_coil(user.loc, 30)
|
||||
loaded.max_amount = initial(loaded.max_amount)
|
||||
loaded.forceMove(user.loc)
|
||||
user.put_in_hands(loaded)
|
||||
loaded = null
|
||||
new /obj/item/stack/cable_coil/extra_insulated(user.loc, diff)
|
||||
loaded.use(diff)
|
||||
refresh_icon(user)
|
||||
|
||||
/obj/item/rcl/examine(mob/user)
|
||||
. = ..()
|
||||
if(loaded)
|
||||
. += SPAN_NOTICE("It contains [loaded.amount]/[max_amount] cables.")
|
||||
else
|
||||
. += SPAN_WARNING("It's empty!")
|
||||
|
||||
/obj/item/rcl/Destroy()
|
||||
QDEL_NULL(loaded)
|
||||
last = null
|
||||
active = FALSE
|
||||
return ..()
|
||||
|
||||
/obj/item/rcl/update_icon_state()
|
||||
if(!loaded)
|
||||
icon_state = "rcl-0"
|
||||
inhand_icon_state = "rcl-0"
|
||||
/obj/item/rcl/update_overlays()
|
||||
. = ..()
|
||||
overlays.Cut()
|
||||
if(!loaded.amount)
|
||||
return
|
||||
|
||||
var/coil_size
|
||||
switch(loaded.amount)
|
||||
if(61 to INFINITY)
|
||||
icon_state = "rcl-30"
|
||||
coil_size = "full"
|
||||
if(31 to 60)
|
||||
icon_state = "rcl-20"
|
||||
coil_size = "mid"
|
||||
if(1 to 30)
|
||||
icon_state = "rcl-10"
|
||||
else
|
||||
icon_state = "rcl-0"
|
||||
inhand_icon_state = "rcl[loaded.amount ? "" : "-0"]"
|
||||
coil_size = "low"
|
||||
|
||||
if(loaded.cable_merge_id == CABLE_LOW_POWER)
|
||||
var/image/cable_overlay = image('icons/obj/rcl.dmi', icon_state = "rcl_[coil_size]")
|
||||
cable_overlay.color = loaded.color
|
||||
overlays += cable_overlay
|
||||
else if(loaded.cable_type == /obj/structure/cable/extra_insulated)
|
||||
overlays += "rcl_[coil_size]_hd"
|
||||
else
|
||||
overlays += "rcl_[coil_size]_hd_connected"
|
||||
|
||||
|
||||
/obj/item/rcl/update_icon_state()
|
||||
. = ..()
|
||||
if(loaded.cable_merge_id == CABLE_LOW_POWER)
|
||||
inhand_icon_state = "rcl[loaded.amount ? "_[loaded.color]" : null]"
|
||||
else if(loaded.cable_type == /obj/structure/cable/extra_insulated)
|
||||
inhand_icon_state = "rcl[loaded.amount ? "_hd" : null]"
|
||||
else
|
||||
inhand_icon_state = "rcl[loaded.amount ? "_hd_connected" : null]"
|
||||
|
||||
/obj/item/rcl/proc/is_empty(mob/user, loud = 1)
|
||||
refresh_icon(user)
|
||||
if(!loaded || !loaded.amount)
|
||||
if(!loaded.amount)
|
||||
if(loud)
|
||||
to_chat(user, SPAN_WARNING("The last of the cables unreel from [src]!"))
|
||||
if(loaded)
|
||||
qdel(loaded)
|
||||
loaded = null
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -118,7 +143,10 @@
|
||||
if(..())
|
||||
return FINISH_ATTACK
|
||||
|
||||
active = HAS_TRAIT(src, TRAIT_WIELDED)
|
||||
if(iscarbon(user))
|
||||
active = HAS_TRAIT(src, TRAIT_WIELDED)
|
||||
else
|
||||
active = !active
|
||||
if(!active)
|
||||
last = null
|
||||
else if(!last)
|
||||
@@ -127,6 +155,8 @@
|
||||
last = C
|
||||
break
|
||||
|
||||
to_chat(user, SPAN_NOTICE("You [active ? "prepare to rapidly lay cable" : "stop rapidly laying cable"]."))
|
||||
|
||||
/obj/item/rcl/on_mob_move(direct, mob/user)
|
||||
if(active && isturf(user.loc))
|
||||
trigger(user)
|
||||
@@ -153,9 +183,64 @@
|
||||
last = loaded.place_turf(get_turf(loc), user, turn(user.dir, 180))
|
||||
is_empty(user) //If we've run out, display message
|
||||
|
||||
/obj/item/rcl/pre_loaded/Initialize(mapload) // Comes preloaded with cable, for testing stuff
|
||||
/obj/item/rcl/empty/Initialize(mapload)
|
||||
..()
|
||||
loaded.use(RCL_MAX_SPOOL_SIZE, FALSE)
|
||||
update_icon(UPDATE_ICON_STATE|UPDATE_OVERLAYS)
|
||||
|
||||
/obj/item/rcl/robot
|
||||
name = "robotic rapid cable layer (RRCL)"
|
||||
desc = "A Rapid Cable Layer used to hold a spool of cable for engineering and construction robots."
|
||||
/// Tells us if we're laying basic or insulated cable.
|
||||
var/heavy_mode = FALSE
|
||||
|
||||
/obj/item/rcl/robot/examine(mob/user)
|
||||
. = ..()
|
||||
loaded = new()
|
||||
loaded.max_amount = max_amount
|
||||
loaded.amount = max_amount
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
. += SPAN_NOTICE("[src] is currently dispensing [heavy_mode ? "<b>heavy duty cable</b>" : "<b>standard cable</b>"].")
|
||||
. += SPAN_NOTICE("<b>Alt-Click</b> to swap between laying <b>standard</b> and <b>heavy duty</b> cable.")
|
||||
. += SPAN_NOTICE("<b>Ctrl-Click</b> to [heavy_mode ? "toggle cable connectivity" : "select cable color"].")
|
||||
|
||||
/obj/item/rcl/robot/screwdriver_act(mob/user, obj/item/I)
|
||||
return
|
||||
|
||||
/obj/item/rcl/robot/AltClick(mob/user, modifiers)
|
||||
if(..())
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
if(heavy_mode)
|
||||
loaded.cable_type = /obj/structure/cable
|
||||
loaded.cable_merge_id = CABLE_LOW_POWER
|
||||
loaded.color = "red"
|
||||
else
|
||||
loaded.cable_type = /obj/structure/cable/extra_insulated
|
||||
loaded.cable_merge_id = CABLE_HIGH_POWER
|
||||
loaded.color = null
|
||||
heavy_mode = !heavy_mode
|
||||
to_chat(user, SPAN_NOTICE("You start dispensing [heavy_mode ? "heavy-duty cable" : "standard cable"]."))
|
||||
update_icon(UPDATE_ICON_STATE|UPDATE_OVERLAYS)
|
||||
|
||||
/obj/item/rcl/robot/CtrlClick(mob/user, modifiers)
|
||||
if(!heavy_mode)
|
||||
var/new_cable_color = tgui_input_list(user, "Pick a cable color.", "Cable Color", list("white","red","orange","yellow","green","blue","cyan","pink"))
|
||||
if(!new_cable_color)
|
||||
return
|
||||
|
||||
to_chat(user, SPAN_NOTICE("[src] is now dispensing [new_cable_color] cable."))
|
||||
// For reasons beyond my comprehension, BYOND cannot comprehend the fact that green is equal to itself unless you explicitly tell it so.
|
||||
if(new_cable_color == "green")
|
||||
new_cable_color = COLOR_GREEN
|
||||
loaded.cable_color(new_cable_color)
|
||||
else
|
||||
if(loaded.cable_type == /obj/structure/cable/extra_insulated/pre_connect)
|
||||
loaded.cable_type = /obj/structure/cable/extra_insulated
|
||||
to_chat(user, SPAN_NOTICE("[src] is now dispensing closed-connection heavy duty cable"))
|
||||
else
|
||||
loaded.cable_type = /obj/structure/cable/extra_insulated/pre_connect
|
||||
to_chat(user, SPAN_NOTICE("[src] is now dispensing open-connection heavy duty cable"))
|
||||
|
||||
update_icon(UPDATE_ICON_STATE|UPDATE_OVERLAYS)
|
||||
|
||||
/obj/item/stack/cable_coil/random/rcl_spool
|
||||
rcl_spool = TRUE
|
||||
max_amount = RCL_MAX_SPOOL_SIZE
|
||||
amount = RCL_MAX_SPOOL_SIZE
|
||||
|
||||
@@ -95,7 +95,8 @@
|
||||
/obj/item/robotanalyzer,
|
||||
/obj/item/rpd/bluespace,
|
||||
/obj/item/hammer,
|
||||
/obj/item/melee/sickly_blade/lock
|
||||
/obj/item/rcl,
|
||||
/obj/item/melee/sickly_blade/lock,
|
||||
)
|
||||
|
||||
/obj/item/storage/belt/utility/full/populate_contents()
|
||||
@@ -134,6 +135,7 @@
|
||||
name = "advanced toolbelt"
|
||||
desc = "Holds tools, looks snazzy, and fits nicely into a bag."
|
||||
icon_state = "utility_ce"
|
||||
max_combined_w_class = 20
|
||||
storable = TRUE
|
||||
|
||||
/obj/item/storage/belt/utility/chief/full/populate_contents()
|
||||
@@ -141,7 +143,7 @@
|
||||
new /obj/item/crowbar/power(src)
|
||||
new /obj/item/weldingtool/experimental(src)//This can be changed if this is too much
|
||||
new /obj/item/multitool(src)
|
||||
new /obj/item/stack/cable_coil/random(src, 30)
|
||||
new /obj/item/rcl(src)
|
||||
new /obj/item/extinguisher/mini(src)
|
||||
new /obj/item/analyzer(src)
|
||||
update_icon()
|
||||
|
||||
Reference in New Issue
Block a user