[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 08:14:17 -08:00
committed by GitHub
co-authored by John Willard GoldenAlpharex
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()
@@ -28,10 +28,9 @@
computer.visible_message(span_notice("\The [computer]'s screen brightly flashes and loud electrical buzzing is heard."))
computer.enabled = FALSE
computer.update_appearance()
var/obj/item/computer_hardware/battery/battery_module = computer.all_components[MC_CELL]
computer.take_damage(25, BRUTE, 0, 0)
if(battery_module && prob(25))
qdel(battery_module)
if(computer.internal_cell && prob(25))
QDEL_NULL(computer.internal_cell)
computer.visible_message(span_notice("\The [computer]'s battery explodes in rain of sparks."))
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread
spark_system.start()
@@ -19,20 +19,17 @@
if(!computer)
return 0
var/obj/item/computer_hardware/battery/battery_module = computer.all_components[MC_CELL]
var/list/data = get_header_data()
data["disk_size"] = computer.max_capacity
data["disk_used"] = computer.used_capacity
data["power_usage"] = computer.last_power_usage
data["battery_exists"] = battery_module ? 1 : 0
if(battery_module?.battery)
data["battery_rating"] = battery_module.battery.maxcharge
data["battery_percent"] = round(battery_module.battery.percent())
if(battery_module?.battery)
data["battery"] = list("max" = battery_module.battery.maxcharge, "charge" = round(battery_module.battery.charge))
data["battery"] = null
if(computer.internal_cell)
data["battery"] = list(
"max" = computer.internal_cell.maxcharge,
"charge" = round(computer.internal_cell.charge),
)
var/list/all_entries[0]
for(var/I in computer.all_components)
@@ -42,8 +39,8 @@
"desc" = H.desc,
"enabled" = H.enabled,
"critical" = H.critical,
"powerusage" = H.power_usage
)))
"powerusage" = H.power_usage,
)))
data["hardware"] = all_entries
return data
@@ -1,98 +0,0 @@
/obj/item/computer_hardware/battery
name = "power cell controller"
desc = "A charge controller for standard power cells, used in all kinds of modular computers."
icon_state = "cell_con"
critical = 1
malfunction_probability = 1
device_type = MC_CELL
var/obj/item/stock_parts/cell/battery
/obj/item/computer_hardware/battery/get_cell()
return battery
/obj/item/computer_hardware/battery/Initialize(mapload, battery_type)
. = ..()
if(battery_type)
battery = new battery_type(src)
/obj/item/computer_hardware/battery/Destroy()
if(battery)
QDEL_NULL(battery)
return ..()
///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)
return FALSE
if(!istype(I, /obj/item/stock_parts/cell))
return FALSE
if(battery)
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_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_notice("You connect \the [I] to \the [src]."))
return TRUE
/obj/item/computer_hardware/battery/try_eject(mob/living/user, forced = FALSE)
if(!battery)
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())
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."
icon = 'icons/obj/module.dmi'
icon_state = "cell_mini"
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."
icon_state = "cell"
w_class = WEIGHT_CLASS_SMALL
maxcharge = 1500
/obj/item/stock_parts/cell/computer/super
name = "super battery"
desc = "An advanced power cell, often used in high-end laptops."
icon_state = "cell"
w_class = WEIGHT_CLASS_SMALL
maxcharge = 2000
/obj/item/stock_parts/cell/computer/micro
name = "micro battery"
desc = "A small power cell, commonly seen in most portable microcomputers."
icon_state = "cell_micro"
maxcharge = 500
/obj/item/stock_parts/cell/computer/nano
name = "nano battery"
desc = "A tiny power cell, commonly seen in low-end portable microcomputers."
icon_state = "cell_micro"
maxcharge = 300
@@ -19,7 +19,6 @@
var/credits = 0
// Device loadout
var/dev_battery = 1 // 1: Default, 2: Upgraded, 3: Advanced
var/dev_card = 0 // 0: None, 1: Standard
// Removes all traces of old order and allows you to begin configuration from scratch.
@@ -32,32 +31,16 @@
if(fabricated_tablet)
qdel(fabricated_tablet)
fabricated_tablet = null
dev_battery = 1
dev_card = 0
// Recalculates the price and optionally even fabricates the device.
/obj/machinery/lapvend/proc/fabricate_and_recalc_price(fabricate = FALSE)
total_price = 0
if(devtype == 1) // Laptop, generally cheaper to make it accessible for most station roles
var/obj/item/computer_hardware/battery/battery_module = null
if(fabricate)
fabricated_laptop = new /obj/item/modular_computer/laptop/buildable(src)
fabricated_laptop.install_component(new /obj/item/computer_hardware/card_slot)
fabricated_laptop.install_component(new /obj/item/computer_hardware/battery)
battery_module = fabricated_laptop.all_components[MC_CELL]
total_price = 99
switch(dev_battery)
if(1) // Basic(750C)
if(fabricate)
battery_module.try_insert(new /obj/item/stock_parts/cell/computer)
if(2) // Upgraded(1100C)
if(fabricate)
battery_module.try_insert(new /obj/item/stock_parts/cell/computer/advanced)
total_price += 199
if(3) // Advanced(1500C)
if(fabricate)
battery_module.try_insert(new /obj/item/stock_parts/cell/computer/super)
total_price += 499
if(dev_card)
total_price += 199
if(fabricate)
@@ -65,25 +48,10 @@
return total_price
else if(devtype == 2) // Tablet, more expensive, not everyone could probably afford this.
var/obj/item/computer_hardware/battery/battery_module = null
if(fabricate)
fabricated_tablet = new(src)
fabricated_tablet.install_component(new /obj/item/computer_hardware/battery)
fabricated_tablet.install_component(new/obj/item/computer_hardware/card_slot)
battery_module = fabricated_tablet.all_components[MC_CELL]
total_price = 199
switch(dev_battery)
if(1) // Basic(300C)
if(fabricate)
battery_module.try_insert(new /obj/item/stock_parts/cell/computer/nano)
if(2) // Upgraded(500C)
if(fabricate)
battery_module.try_insert(new /obj/item/stock_parts/cell/computer/micro)
total_price += 199
if(3) // Advanced(750C)
if(fabricate)
battery_module.try_insert(new /obj/item/stock_parts/cell/computer)
total_price += 499
if(dev_card)
total_price += 199
if(fabricate)
@@ -91,10 +59,6 @@
return total_price
return FALSE
/obj/machinery/lapvend/ui_act(action, params)
. = ..()
if(.)
@@ -121,10 +85,6 @@
state = 2 // Wait for ID swipe for payment processing
fabricate_and_recalc_price(FALSE)
return TRUE
if("hw_battery")
dev_battery = text2num(params["battery"])
fabricate_and_recalc_price(FALSE)
return TRUE
if("hw_card")
dev_card = text2num(params["card"])
fabricate_and_recalc_price(FALSE)
@@ -185,7 +145,6 @@
data["state"] = state
if(state == 1)
data["devtype"] = devtype
data["hw_battery"] = dev_battery
data["hw_card"] = dev_card
if(state == 1 || state == 2)
data["totalprice"] = total_price