mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 21:17:44 +01:00
Makes try_install_component a function of the hardware.
This commit is contained in:
@@ -525,7 +525,7 @@
|
||||
if(istype(W, /obj/item/weapon/computer_hardware))
|
||||
var/obj/item/weapon/computer_hardware/C = W
|
||||
if(C.hardware_size <= max_hardware_size)
|
||||
try_install_component(user, C)
|
||||
C.try_install_component(user, src)
|
||||
else
|
||||
user << "This component is too large for \the [src]."
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
@@ -586,58 +586,6 @@
|
||||
/obj/item/modular_computer/proc/relay_qdel()
|
||||
return
|
||||
|
||||
// Attempts to install the hardware into apropriate slot.
|
||||
/obj/item/modular_computer/proc/try_install_component(mob/living/user, obj/item/weapon/computer_hardware/H, found = 0)
|
||||
// "USB" flash drive.
|
||||
if(istype(H, /obj/item/weapon/computer_hardware/hard_drive/portable))
|
||||
if(portable_drive)
|
||||
user << "This computer's portable drive slot is already occupied by \the [portable_drive]."
|
||||
return
|
||||
found = 1
|
||||
portable_drive = H
|
||||
else if(istype(H, /obj/item/weapon/computer_hardware/hard_drive))
|
||||
if(hard_drive)
|
||||
user << "This computer's hard drive slot is already occupied by \the [hard_drive]."
|
||||
return
|
||||
found = 1
|
||||
hard_drive = H
|
||||
else if(istype(H, /obj/item/weapon/computer_hardware/network_card))
|
||||
if(network_card)
|
||||
user << "This computer's network card slot is already occupied by \the [network_card]."
|
||||
return
|
||||
found = 1
|
||||
network_card = H
|
||||
else if(istype(H, /obj/item/weapon/computer_hardware/nano_printer))
|
||||
if(nano_printer)
|
||||
user << "This computer's nano printer slot is already occupied by \the [nano_printer]."
|
||||
return
|
||||
found = 1
|
||||
nano_printer = H
|
||||
else if(istype(H, /obj/item/weapon/computer_hardware/card_slot))
|
||||
if(card_slot)
|
||||
user << "This computer's card slot is already occupied by \the [card_slot]."
|
||||
return
|
||||
found = 1
|
||||
card_slot = H
|
||||
else if(istype(H, /obj/item/weapon/computer_hardware/battery_module))
|
||||
if(battery_module)
|
||||
user << "This computer's battery slot is already occupied by \the [battery_module]."
|
||||
return
|
||||
found = 1
|
||||
battery_module = H
|
||||
else if(istype(H, /obj/item/weapon/computer_hardware/processor_unit))
|
||||
if(processor_unit)
|
||||
user << "This computer's processor slot is already occupied by \the [processor_unit]."
|
||||
return
|
||||
found = 1
|
||||
processor_unit = H
|
||||
if(found)
|
||||
user << "You install \the [H] into \the [src]"
|
||||
H.holder2 = src
|
||||
if(!user.drop_item(H))
|
||||
return
|
||||
H.forceMove(src)
|
||||
|
||||
// Uninstalls component. Found and Critical vars may be passed by parent types, if they have additional hardware.
|
||||
/obj/item/modular_computer/proc/uninstall_component(mob/living/user, obj/item/weapon/computer_hardware/H, found = 0, critical = 0)
|
||||
if(portable_drive == H)
|
||||
|
||||
@@ -92,18 +92,6 @@
|
||||
machinery_computer.use_power = 0
|
||||
return
|
||||
|
||||
// Tesla links only work on machinery types, so we'll override the default try_install_component() proc
|
||||
/obj/item/modular_computer/processor/try_install_component(mob/living/user, obj/item/weapon/computer_hardware/H, found = 0)
|
||||
if(istype(H, /obj/item/weapon/computer_hardware/tesla_link))
|
||||
if(machinery_computer.tesla_link)
|
||||
user << "This computer's tesla link slot is already occupied by \the [machinery_computer.tesla_link]."
|
||||
return
|
||||
var/obj/item/weapon/computer_hardware/tesla_link/L = H
|
||||
L.holder = machinery_computer
|
||||
machinery_computer.tesla_link = L
|
||||
found = 1
|
||||
..(user, H, found)
|
||||
|
||||
/obj/item/modular_computer/processor/uninstall_component(mob/living/user, obj/item/weapon/computer_hardware/H, found = 0, critical = 0)
|
||||
if(machinery_computer.tesla_link == H)
|
||||
machinery_computer.tesla_link = null
|
||||
|
||||
@@ -68,4 +68,12 @@
|
||||
|
||||
/obj/item/weapon/computer_hardware/battery_module/proc/charge_to_full()
|
||||
if(battery)
|
||||
battery.charge = battery.maxcharge
|
||||
battery.charge = battery.maxcharge
|
||||
|
||||
/obj/item/weapon/computer_hardware/battery_module/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(M.battery_module)
|
||||
user << "This computer's battery slot is already occupied by \the [M.battery_module]."
|
||||
return
|
||||
found = 1
|
||||
M.battery_module = src
|
||||
..(user, M, found)
|
||||
@@ -18,4 +18,12 @@
|
||||
if(stored_card2)
|
||||
stored_card2.forceMove(get_turf(holder2))
|
||||
holder2 = null
|
||||
..()
|
||||
..()
|
||||
|
||||
/obj/item/weapon/computer_hardware/card_slot/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(M.card_slot)
|
||||
user << "This computer's card slot is already occupied by \the [M.card_slot]."
|
||||
return
|
||||
found = 1
|
||||
M.card_slot = src
|
||||
..(user, M, found)
|
||||
@@ -164,4 +164,12 @@
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/New()
|
||||
install_default_programs()
|
||||
..()
|
||||
..()
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(M.hard_drive)
|
||||
user << "This computer's hard drive slot is already occupied by \the [M.hard_drive]."
|
||||
return
|
||||
found = 1
|
||||
M.hard_drive = src
|
||||
..(user, M, found)
|
||||
@@ -89,3 +89,11 @@
|
||||
damage += round(amount) // We want nice rounded numbers here.
|
||||
damage = max(0, min(damage, max_damage)) // Clamp the value.
|
||||
|
||||
// Attempts to install the hardware into apropriate slot.
|
||||
/obj/item/weapon/computer_hardware/proc/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(found)
|
||||
user << "You install \the [src] into \the [M]"
|
||||
holder2 = M
|
||||
if(!user.drop_item(src))
|
||||
return
|
||||
forceMove(M)
|
||||
@@ -49,4 +49,12 @@
|
||||
if(holder2 && (holder2.nano_printer == src))
|
||||
holder2.nano_printer = null
|
||||
holder2 = null
|
||||
..()
|
||||
..()
|
||||
|
||||
/obj/item/weapon/computer_hardware/nano_printer/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(M.nano_printer)
|
||||
user << "This computer's nano printer slot is already occupied by \the [M.nano_printer]."
|
||||
return
|
||||
found = 1
|
||||
M.nano_printer = src
|
||||
..(user, M, found)
|
||||
@@ -93,4 +93,12 @@ var/global/ntnet_card_uid = 1
|
||||
/obj/item/weapon/computer_hardware/network_card/Destroy()
|
||||
if(holder2 && (holder2.network_card == src))
|
||||
holder2.network_card = null
|
||||
..()
|
||||
..()
|
||||
|
||||
/obj/item/weapon/computer_hardware/network_card/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(M.network_card)
|
||||
user << "This computer's network card slot is already occupied by \the [M.network_card]."
|
||||
return
|
||||
found = 1
|
||||
M.network_card = src
|
||||
..(user, M, found)
|
||||
@@ -29,4 +29,13 @@
|
||||
/obj/item/weapon/computer_hardware/hard_drive/portable/New()
|
||||
..()
|
||||
stored_files = list()
|
||||
recalculate_size()
|
||||
recalculate_size()
|
||||
|
||||
|
||||
/obj/item/weapon/computer_hardware/hard_drive/portable/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(M.portable_drive)
|
||||
user << "This computer's portable drive slot is already occupied by \the [M.portable_drive]."
|
||||
return
|
||||
found = 1
|
||||
M.portable_drive = src
|
||||
..(user, M, found)
|
||||
@@ -38,4 +38,12 @@
|
||||
hardware_size = 1
|
||||
power_usage = 75
|
||||
max_idle_programs = 2
|
||||
origin_tech = list("programming" = 4, "engineering" = 3)
|
||||
origin_tech = list("programming" = 4, "engineering" = 3)
|
||||
|
||||
/obj/item/weapon/computer_hardware/processor_unit/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(M.processor_unit)
|
||||
user << "This computer's processor slot is already occupied by \the [M.processor_unit]."
|
||||
return
|
||||
found = 1
|
||||
M.processor_unit = src
|
||||
..(user, M, found)
|
||||
@@ -17,4 +17,15 @@
|
||||
/obj/item/weapon/computer_hardware/tesla_link/Destroy()
|
||||
if(holder && (holder.tesla_link == src))
|
||||
holder.tesla_link = null
|
||||
..()
|
||||
..()
|
||||
|
||||
/obj/item/weapon/computer_hardware/tesla_link/try_install_component(mob/living/user, obj/item/modular_computer/M, found = 0)
|
||||
if(istype(M, /obj/item/modular_computer/processor))
|
||||
var/obj/item/modular_computer/processor/P = M
|
||||
if(P.machinery_computer.tesla_link)
|
||||
user << "This computer's tesla link slot is already occupied by \the [P.machinery_computer.tesla_link]."
|
||||
return
|
||||
holder = P.machinery_computer
|
||||
P.machinery_computer.tesla_link = src
|
||||
found = 1
|
||||
..(user, M, found)
|
||||
Reference in New Issue
Block a user