mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
Converts A && A.B into A?.B (#54342)
Implements the ?. operator, replacing code like A && A.B with A?.B BYOND Ref: When reading A?.B, it's equivalent to A && A.B except that A is only evaluated once, even if it's a complex expression like a proc call.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
var/obj/item/computer_hardware/recharger/recharger = all_components[MC_CHARGE]
|
||||
|
||||
if(recharger && recharger.check_functionality())
|
||||
if(recharger?.check_functionality())
|
||||
if(recharger.use_power(amount))
|
||||
return TRUE
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
/obj/item/modular_computer/proc/give_power(amount)
|
||||
var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL]
|
||||
if(battery_module && battery_module.battery)
|
||||
if(battery_module?.battery)
|
||||
return battery_module.battery.give(amount)
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user