frontend
This commit is contained in:
@@ -4,25 +4,28 @@
|
||||
icon_state = "cell_con"
|
||||
critical = 1
|
||||
malfunction_probability = 1
|
||||
var/obj/item/stock_parts/cell/battery = null
|
||||
var/obj/item/stock_parts/cell/battery
|
||||
device_type = MC_CELL
|
||||
|
||||
/obj/item/computer_hardware/battery/get_cell()
|
||||
return battery
|
||||
|
||||
/obj/item/computer_hardware/battery/New(loc, battery_type = null)
|
||||
/obj/item/computer_hardware/battery/Initialize(mapload, battery_type)
|
||||
. = ..()
|
||||
if(battery_type)
|
||||
battery = new battery_type(src)
|
||||
..()
|
||||
|
||||
/obj/item/computer_hardware/battery/Destroy()
|
||||
. = ..()
|
||||
QDEL_NULL(battery)
|
||||
battery = null
|
||||
return ..()
|
||||
|
||||
/obj/item/computer_hardware/battery/handle_atom_del(atom/A)
|
||||
if(A == battery)
|
||||
try_eject(forced = TRUE)
|
||||
. = ..()
|
||||
///What happens when the battery is removed (or deleted) from the module, through try_eject() or not.
|
||||
/obj/item/computer_hardware/battery/Exited(atom/movable/gone, direction)
|
||||
if(battery == gone)
|
||||
battery = null
|
||||
if(holder?.enabled && !holder.use_power())
|
||||
holder.shutdown_computer()
|
||||
return ..()
|
||||
|
||||
/obj/item/computer_hardware/battery/try_insert(obj/item/I, mob/living/user = null)
|
||||
if(!holder)
|
||||
@@ -32,46 +35,33 @@
|
||||
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>")
|
||||
to_chat(user, span_warning("You try to connect \the [I] to \the [src], but its connectors are occupied."))
|
||||
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>")
|
||||
to_chat(user, span_warning("This power cell is too large for \the [holder]!"))
|
||||
return FALSE
|
||||
|
||||
if(user && !user.transferItemToLoc(I, src))
|
||||
return FALSE
|
||||
|
||||
battery = I
|
||||
to_chat(user, "<span class='notice'>You connect \the [I] to \the [src].</span>")
|
||||
to_chat(user, span_notice("You connect \the [I] to \the [src]."))
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/computer_hardware/battery/try_eject(mob/living/user = null, forced = FALSE)
|
||||
/obj/item/computer_hardware/battery/try_eject(mob/living/user, forced = FALSE)
|
||||
if(!battery)
|
||||
to_chat(user, "<span class='warning'>There is no power cell connected to \the [src].</span>")
|
||||
to_chat(user, span_warning("There is no power cell connected to \the [src]."))
|
||||
return FALSE
|
||||
else
|
||||
if(user)
|
||||
user.put_in_hands(battery)
|
||||
to_chat(user, span_notice("You detach \the [battery] from \the [src]."))
|
||||
else
|
||||
battery.forceMove(drop_location())
|
||||
to_chat(user, "<span class='notice'>You detach \the [battery] from \the [src].</span>")
|
||||
battery = null
|
||||
|
||||
if(holder)
|
||||
if(holder.enabled && !holder.use_power())
|
||||
holder.shutdown_computer()
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/item/stock_parts/cell/computer
|
||||
name = "standard battery"
|
||||
desc = "A standard power cell, commonly seen in high-end portable microcomputers or low-end laptops."
|
||||
@@ -80,7 +70,6 @@
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
maxcharge = 750
|
||||
|
||||
|
||||
/obj/item/stock_parts/cell/computer/advanced
|
||||
name = "advanced battery"
|
||||
desc = "An advanced power cell, often used in most laptops. It is too large to be fitted into smaller devices."
|
||||
|
||||
Reference in New Issue
Block a user