[MIRROR] Removes tablet cell parts [MDB IGNORE] (#17498)

* Removes tablet cell parts (#71078)

## About The Pull Request

Removes cell parts and cell part cells, now tablets directly stole a
power cell in them, and uses regular stock cells like every other
machine in the game. This also makes it less confusing because people
are more used to stock cells over computer cells. Because cells
generally hold more power than computer ones, I bumped up the active
power usage from 50 to 75.

## Why It's Good For The Game

We are nearly finished removing all parts, holy cr*p

## Changelog

🆑
balance: Tablets now use regular cells instead of computer cells.
balance: Tablets no longer need a power cell component to hold power
cells.
/🆑

* Removes tablet cell parts

* Feex

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
SkyratBot
2022-11-16 17:14:17 +01:00
committed by GitHub
parent 176219d257
commit 5afc46835b
22 changed files with 60 additions and 363 deletions
@@ -14,9 +14,11 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
armor = list(MELEE = 0, BULLET = 20, LASER = 20, ENERGY = 100, BOMB = 0, BIO = 0, FIRE = 0, ACID = 0)
light_system = MOVABLE_LIGHT_DIRECTIONAL
///The power cell the computer uses to run on.
var/obj/item/stock_parts/cell/internal_cell = /obj/item/stock_parts/cell
///The disk in this PDA. If set, this will be inserted on Initialize.
var/obj/item/computer_disk/inserted_disk
///The amount of storage space the computer starts with.
var/max_capacity = 128
///The amount of storage space we've got filled
@@ -62,7 +64,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
///The last recorded amount of power used.
var/last_power_usage = 0
///Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too.
var/base_active_power_usage = 50
var/base_active_power_usage = 75
///Power usage when the computer is idle and screen is off (currently only applies to laptops)
var/base_idle_power_usage = 5
@@ -131,6 +133,8 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
add_item_action(/datum/action/item_action/toggle_computer_light)
if(inserted_disk)
inserted_disk = new inserted_disk(src)
if(internal_cell)
internal_cell = new internal_cell(src)
update_appearance()
register_context()
@@ -193,6 +197,9 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
/obj/item/modular_computer/proc/play_ping()
playsound(loc, 'sound/machines/ping.ogg', get_clamped_volume(), FALSE, -1)
/obj/item/modular_computer/get_cell()
return internal_cell
/obj/item/modular_computer/AltClick(mob/user)
..()
if(issilicon(user))
@@ -438,6 +445,12 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
. += mutable_appearance(init_icon, "bsod")
. += mutable_appearance(init_icon, "broken")
/obj/item/modular_computer/Exited(atom/movable/gone, direction)
if(internal_cell == gone)
internal_cell = null
if(enabled && !use_power())
shutdown_computer()
return ..()
// On-click handling. Turns on the computer if it's off and opens the GUI.
/obj/item/modular_computer/interact(mob/user)
@@ -549,12 +562,10 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
var/list/data = list()
data["PC_device_theme"] = device_theme
data["PC_showbatteryicon"] = !!internal_cell
var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL]
data["PC_showbatteryicon"] = !!battery_module
if(battery_module && battery_module.battery)
switch(battery_module.battery.percent())
if(internal_cell)
switch(internal_cell.percent())
if(80 to 200) // 100 should be maximal but just in case..
data["PC_batteryicon"] = "batt_100.gif"
if(60 to 80)
@@ -567,7 +578,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
data["PC_batteryicon"] = "batt_20.gif"
else
data["PC_batteryicon"] = "batt_5.gif"
data["PC_batterypercent"] = "[round(battery_module.battery.percent())]%"
data["PC_batterypercent"] = "[round(internal_cell.percent())]%"
else
data["PC_batteryicon"] = "batt_5.gif"
data["PC_batterypercent"] = "N/C"
@@ -752,6 +763,18 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
balloon_alert(user, "inserted pai")
return
if(istype(attacking_item, /obj/item/stock_parts/cell))
if(ismachinery(loc))
return
if(internal_cell)
to_chat(user, span_warning("You try to connect \the [attacking_item] to \the [src], but its connectors are occupied."))
return
if(user && !user.transferItemToLoc(attacking_item, src))
return
internal_cell = attacking_item
to_chat(user, span_notice("You plug \the [attacking_item] to \the [src]."))
return
// Check if any Applications need it
for(var/datum/computer_file/item_holding_app as anything in stored_files)
if(item_holding_app.try_insert(attacking_item, user))
@@ -821,7 +844,10 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
var/choice = tgui_input_list(user, "Component to uninstall", "Computer maintenance", sort_list(component_names))
if(isnull(choice))
return
if(internal_cell)
user.put_in_hands(internal_cell)
to_chat(user, span_notice("You detach \the [internal_cell] from \the [src]."))
return TOOL_ACT_TOOLTYPE_SUCCESS
if(!Adjacent(user))
return
@@ -2,33 +2,25 @@
/obj/item/modular_computer/proc/use_power(amount = 0)
if(check_power_override())
return TRUE
if(ismachinery(loc))
var/obj/machinery/machine_holder = loc
if(machine_holder.powered())
machine_holder.use_power(amount)
return TRUE
var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL]
if(battery_module && battery_module.battery && battery_module.battery.charge)
var/obj/item/stock_parts/cell/cell = battery_module.battery
if(cell.use(amount JOULES))
return TRUE
else // Discharge the cell anyway.
cell.use(min(amount JOULES, cell.charge))
return FALSE
return FALSE
if(!internal_cell || !internal_cell.charge)
return FALSE
if(!internal_cell.use(amount JOULES))
internal_cell.use(min(amount JOULES, internal_cell.charge)) //drain it anyways.
return FALSE
return TRUE
/obj/item/modular_computer/proc/give_power(amount)
var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL]
if(battery_module?.battery)
return battery_module.battery.give(amount)
if(internal_cell)
return internal_cell.give(amount)
return 0
/obj/item/modular_computer/get_cell()
var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL]
return battery_module?.get_cell()
// Used in following function to reduce copypaste
/obj/item/modular_computer/proc/power_failure()
if(enabled) // Shut down the computer
@@ -1,7 +1,3 @@
/obj/item/modular_computer/laptop/preset/Initialize(mapload)
. = ..()
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
/obj/item/modular_computer/laptop/preset/civilian
desc = "A low-end laptop often used for personal recreation."
starting_programs = list(
@@ -25,6 +25,7 @@
// Obtain reference to machinery computer
machinery_computer = loc
machinery_computer.cpu = src
internal_cell = machinery_computer.internal_cell
hardware_flag = machinery_computer.hardware_flag
max_hardware_size = machinery_computer.max_hardware_size
steel_sheet_cost = machinery_computer.steel_sheet_cost
@@ -429,5 +429,4 @@
/obj/item/modular_computer/tablet/pda/Initialize(mapload)
. = ..()
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
install_component(new /obj/item/computer_hardware/card_slot)
@@ -4,7 +4,3 @@
/datum/computer_file/program/ntnetdownload/syndicate,
/datum/computer_file/program/radar/fission360,
)
/obj/item/modular_computer/tablet/nukeops/Initialize(mapload)
. = ..()
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
@@ -1,7 +1,6 @@
/obj/machinery/modular_computer/console/preset
// Can be changed to give devices specific hardware
var/_has_second_id_slot = FALSE
var/_has_battery = FALSE
///List of programs the computer starts with, given on Initialize.
var/list/datum/computer_file/starting_programs = list()
@@ -13,8 +12,6 @@
cpu.install_component(new /obj/item/computer_hardware/card_slot)
if(_has_second_id_slot)
cpu.install_component(new /obj/item/computer_hardware/card_slot/secondary)
if(_has_battery)
cpu.install_component(new /obj/item/computer_hardware/battery(cpu, /obj/item/stock_parts/cell/computer/super))
for(var/programs in starting_programs)
var/datum/computer_file/program/program_type = new programs
cpu.store_file(program_type)
@@ -11,6 +11,8 @@
icon_state = null
idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05
///The power cell, null by default as we use the APC we're in
var/internal_cell = null
///A flag that describes this device type
var/hardware_flag = NONE
///Power usage during last tick
@@ -20,10 +20,6 @@
/obj/machinery/modular_computer/console/Initialize(mapload)
. = ..()
var/obj/item/computer_hardware/battery/battery_module = cpu.all_components[MC_CELL]
if(battery_module)
qdel(battery_module)
if(cpu)
cpu.screen_on = TRUE
update_appearance()