Runtime fixes.

This commit is contained in:
davipatury
2017-02-20 21:44:06 -03:00
parent 67ee6fdd41
commit 84f71a7d0f
7 changed files with 47 additions and 25 deletions
@@ -307,7 +307,7 @@
update_icon()
/obj/item/device/modular_computer/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/item/device/modular_computer/attackby(obj/item/weapon/W, mob/user)
// Insert items into the components
for(var/h in all_components)
var/obj/item/weapon/computer_hardware/H = all_components[h]
@@ -3,11 +3,13 @@
return FALSE
if(H.w_class > max_hardware_size)
to_chat(user, "<span class='warning'>This component is too large for \the [src]!</span>")
if(user)
to_chat(user, "<span class='warning'>This component is too large for \the [src]!</span>")
return FALSE
if(all_components[H.device_type])
to_chat(user, "<span class='warning'>This computer's hardware slot is already occupied by \the [all_components[H.device_type]].</span>")
if(user)
to_chat(user, "<span class='warning'>This computer's hardware slot is already occupied by \the [all_components[H.device_type]].</span>")
return FALSE
return TRUE
@@ -23,7 +25,8 @@
all_components[H.device_type] = H
to_chat(user, "<span class='notice'>You install \the [H] into \the [src].</span>")
if(user)
to_chat(user, "<span class='notice'>You install \the [H] into \the [src].</span>")
H.holder = src
H.on_install(src, user)
@@ -35,7 +38,8 @@
all_components.Remove(H.device_type)
to_chat(user, "<span class='notice'>You remove \the [H] from \the [src].</span>")
if(user)
to_chat(user, "<span class='notice'>You remove \the [H] from \the [src].</span>")
H.forceMove(get_turf(src))
H.holder = null
@@ -30,25 +30,29 @@
return FALSE
if(stored_card)
to_chat(user, "<span class='warning'>You try to insert \the [I] into \the [src], but the slot is occupied.</span>")
if(user)
to_chat(user, "<span class='warning'>You try to insert \the [I] into \the [src], but the slot is occupied.</span>")
return FALSE
if(user && !user.unEquip(I))
return FALSE
I.forceMove(src)
stored_card = I
to_chat(user, "<span class='notice'>You insert \the [I] into \the [src].</span>")
if(user)
to_chat(user, "<span class='notice'>You insert \the [I] into \the [src].</span>")
return TRUE
/obj/item/weapon/computer_hardware/ai_slot/try_eject(slot=0,mob/living/user = null,forced = 0)
/obj/item/weapon/computer_hardware/ai_slot/try_eject(slot=0, mob/living/user = null, forced = 0)
if(!stored_card)
to_chat(user, "<span class='warning'>There is no card in \the [src].</span>")
if(user)
to_chat(user, "<span class='warning'>There is no card in \the [src].</span>")
return FALSE
if(locked && !forced)
to_chat(user, "<span class='warning'>Safeties prevent you from removing the card until reconstruction is complete...</span>")
if(user)
to_chat(user, "<span class='warning'>Safeties prevent you from removing the card until reconstruction is complete...</span>")
return FALSE
if(stored_card)
@@ -57,7 +61,8 @@
stored_card.verb_pickup()
stored_card = null
to_chat(user, "<span class='notice'>You remove the card from \the [src].</span>")
if(user)
to_chat(user, "<span class='notice'>You remove the card from \the [src].</span>")
return TRUE
return FALSE
@@ -66,5 +71,5 @@
return
if(istype(I, /obj/item/weapon/screwdriver))
to_chat(user, "<span class='notice'>You press down on the manual eject button with \the [I].</span>")
try_eject(,user,1)
try_eject(0, user, 1)
return
@@ -21,11 +21,13 @@
return FALSE
if(battery)
to_chat(user, "<span class='warning'>You try to connect \the [I] to \the [src], but its connectors are occupied.</span>")
if(user)
to_chat(user, "<span class='warning'>You try to connect \the [I] to \the [src], but its connectors are occupied.</span>")
return FALSE
if(I.w_class > holder.max_hardware_size)
to_chat(user, "<span class='warning'>This power cell is too large for \the [holder]!</span>")
if(user)
to_chat(user, "<span class='warning'>This power cell is too large for \the [holder]!</span>")
return FALSE
if(user && !user.unEquip(I))
@@ -33,18 +35,21 @@
I.forceMove(src)
battery = I
to_chat(user, "<span class='notice'>You connect \the [I] to \the [src].</span>")
if(user)
to_chat(user, "<span class='notice'>You connect \the [I] to \the [src].</span>")
return TRUE
/obj/item/weapon/computer_hardware/battery/try_eject(slot=0, mob/living/user = null, forced = 0)
if(!battery)
to_chat(user, "<span class='warning'>There is no power cell connected to \the [src].</span>")
if(user)
to_chat(user, "<span class='warning'>There is no power cell connected to \the [src].</span>")
return FALSE
else
battery.forceMove(get_turf(src))
to_chat(user, "<span class='notice'>You detach \the [battery] from \the [src].</span>")
if(user)
to_chat(user, "<span class='notice'>You detach \the [battery] from \the [src].</span>")
battery = null
if(holder)
@@ -44,7 +44,8 @@
return FALSE
if(stored_card && stored_card2)
to_chat(user, "<span class='warning'>You try to insert \the [I] into \the [src], but its slots are occupied.</span>")
if(user)
to_chat(user, "<span class='warning'>You try to insert \the [I] into \the [src], but its slots are occupied.</span>")
return FALSE
if(user && !user.unEquip(I))
return FALSE
@@ -55,14 +56,17 @@
stored_card = I
else
stored_card2 = I
to_chat(user, "<span class='notice'>You insert \the [I] into \the [src].</span>")
if(user)
to_chat(user, "<span class='notice'>You insert \the [I] into \the [src].</span>")
return TRUE
/obj/item/weapon/computer_hardware/card_slot/try_eject(slot=0, mob/living/user = null, forced = 0)
/obj/item/weapon/computer_hardware/card_slot/try_eject(slot = 0, mob/living/user = null, forced = 0)
if(!stored_card && !stored_card2)
to_chat(user, "<span class='warning'>There are no cards in \the [src].</span>")
if(user)
to_chat(user, "<span class='warning'>There are no cards in \the [src].</span>")
return FALSE
var/ejected = 0
@@ -87,7 +91,8 @@
var/datum/computer_file/program/P = I
P.event_idremoved(1, slot)
to_chat(user, "<span class='notice'>You remove the card[ejected>1 ? "s" : ""] from \the [src].</span>")
if(user)
to_chat(user, "<span class='notice'>You remove the card[ejected>1 ? "s" : ""] from \the [src].</span>")
return TRUE
return FALSE
@@ -41,13 +41,15 @@
/obj/item/weapon/computer_hardware/printer/try_insert(obj/item/I, mob/living/user = null)
if(istype(I, /obj/item/weapon/paper))
if(stored_paper >= max_paper)
to_chat(user, "<span class='warning'>You try to add \the [I] into [src], but its paper bin is full!</span>")
if(user)
to_chat(user, "<span class='warning'>You try to add \the [I] into [src], but its paper bin is full!</span>")
return FALSE
if(user && !user.unEquip(I))
return FALSE
to_chat(user, "<span class='notice'>You insert \the [I] into [src]'s paper recycler.</span>")
if(user)
to_chat(user, "<span class='notice'>You insert \the [I] into [src]'s paper recycler.</span>")
qdel(I)
stored_paper++
return TRUE
@@ -57,7 +57,8 @@
/obj/item/weapon/computer_hardware/recharger/wired/can_install(obj/item/device/modular_computer/M, mob/living/user = null)
if(istype(M.physical, /obj/machinery) && M.physical.anchored)
return ..()
to_chat(user, "<span class='warning'>\The [src] is incompatible with portable computers!</span>")
if(user)
to_chat(user, "<span class='warning'>\The [src] is incompatible with portable computers!</span>")
return 0
/obj/item/weapon/computer_hardware/recharger/wired/use_power(amount, charging=0)