diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 7d18f1b6d114..ee82898fbde9 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -407,6 +407,7 @@ CB.apply_default_parts(src) RefreshParts() +// todo: this is fucked, refactor /obj/machinery/proc/default_part_replacement(var/mob/user, var/obj/item/storage/part_replacer/R) if(!istype(R)) return 0 @@ -418,14 +419,20 @@ if(panel_open || !R.panel_req) var/obj/item/circuitboard/CB = circuit var/P - for(var/obj/item/stock_parts/A in component_parts) + for(var/obj/item/A in component_parts) + var/our_rating = A.rped_rating() + if(isnull(our_rating)) + continue for(var/T in CB.req_components) if(ispath(A.type, T)) P = T break - for(var/obj/item/stock_parts/B in R.contents) + for(var/obj/item/B in R.contents) + var/their_rating = B.rped_rating() + if(isnull(their_rating)) + continue if(istype(B, P) && istype(A, P)) - if(B.rating > A.rating) + if(their_rating > our_rating) R.remove_from_storage(B, src) R.handle_item_insertion(A, null, TRUE) component_parts -= A @@ -433,8 +440,8 @@ B.loc = null to_chat(user, "[A.name] replaced with [B.name].") break - update_appearance() - RefreshParts() + update_appearance() + RefreshParts() return 1 // todo: refactor diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 4a10872a7473..eab4a93c53a5 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -724,8 +724,9 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. /// These procs are for RPEDs and part ratings. The concept for this was borrowed from /vg/station. /// Gets the rating of the item, used in stuff like machine construction. +/// return null for don't use as part /obj/item/proc/get_rating() - return FALSE + return null /// These procs are for RPEDs and part ratings, but used for RPED sorting of parts. /obj/item/proc/rped_rating() diff --git a/code/game/objects/items/stock_parts/part_replacer.dm b/code/game/objects/items/stock_parts/part_replacer.dm index c110c15d84cb..16008e25652e 100644 --- a/code/game/objects/items/stock_parts/part_replacer.dm +++ b/code/game/objects/items/stock_parts/part_replacer.dm @@ -3,7 +3,7 @@ desc = "A special mechanical module made to store, sort, and apply standard machine parts." icon_state = "RPED" w_class = ITEMSIZE_HUGE - can_hold = list(/obj/item/stock_parts) + can_hold = list(/obj/item/stock_parts, /obj/item/cell/, /obj/item/reagent_containers/glass/beaker/) storage_slots = 100 use_to_pickup = 1 allow_quick_gather = 1 diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 7803d3581ac1..f357acf48c95 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -24,6 +24,7 @@ var/charge_amount = 25 // How much power to give, if self_recharge is true. The number is in absolute cell charge, as it gets divided by CELLRATE later. var/last_use = 0 // A tracker for use in self-charging var/charge_delay = 0 // How long it takes for the cell to start recharging after last use + var/rating = 1 materials = list(MAT_STEEL = 700, MAT_GLASS = 50) // Overlay stuff. @@ -44,6 +45,9 @@ STOP_PROCESSING(SSobj, src) return ..() +/obj/item/cell/get_rating() + return rating + /obj/item/cell/get_cell() return src diff --git a/code/modules/power/cells/power_cells.dm b/code/modules/power/cells/power_cells.dm index a864b6881f56..2e3d4fae10be 100644 --- a/code/modules/power/cells/power_cells.dm +++ b/code/modules/power/cells/power_cells.dm @@ -28,6 +28,7 @@ origin_tech = list(TECH_POWER = 2) icon_state = "hcell" maxcharge = 10000 + rating = 2 materials = list(MAT_STEEL = 700, MAT_GLASS = 60) /obj/item/cell/high/empty @@ -38,6 +39,7 @@ origin_tech = list(TECH_POWER = 5) icon_state = "scell" maxcharge = 20000 + rating = 3 materials = list(MAT_STEEL = 700, MAT_GLASS = 70) /obj/item/cell/super/empty @@ -48,6 +50,7 @@ origin_tech = list(TECH_POWER = 6) icon_state = "hpcell" maxcharge = 30000 + rating = 4 materials = list(MAT_STEEL = 700, MAT_GLASS = 80) /obj/item/cell/hyper/empty @@ -58,6 +61,7 @@ icon_state = "icell" origin_tech = null maxcharge = 30000 //determines how badly mobs get shocked + rating = 6 materials = list(MAT_STEEL = 700, MAT_GLASS = 80) /obj/item/cell/infinite/check_charge() @@ -84,6 +88,7 @@ icon_state = "yellow slime extract" //"potato_battery" description_info = "This 'cell' holds a max charge of 10k and self recharges over time." maxcharge = 10000 + rating = 5 materials = null self_recharge = TRUE charge_amount = 750 diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index 3d54b62ce0d4..5241834c6c13 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -155,6 +155,8 @@ w_class = WEIGHT_CLASS_TINY drop_sound = 'sound/items/drop/glass.ogg' pickup_sound = 'sound/items/pickup/glass.ogg' + /// rped rating + var/rped_rating = 0 /obj/item/reagent_containers/glass/beaker/Initialize(mapload) . = ..() @@ -172,6 +174,9 @@ ..() update_icon() +/obj/item/reagent_containers/glass/beaker/rped_rating() + return rped_rating + /obj/item/reagent_containers/glass/beaker/update_icon() cut_overlays() var/list/overlays_to_add = list() @@ -209,6 +214,7 @@ amount_per_transfer_from_this = 10 possible_transfer_amounts = list(5,10,15,25,30,60,120) atom_flags = OPENCONTAINER + rped_rating = 1 /obj/item/reagent_containers/glass/beaker/noreact name = "cryostasis beaker" @@ -232,6 +238,7 @@ amount_per_transfer_from_this = 10 possible_transfer_amounts = list(5,10,15,25,30,60,120,300) atom_flags = OPENCONTAINER + rped_rating = 3 /obj/item/reagent_containers/glass/beaker/vial name = "vial"