From 9e94f561038c0f2d16e0a1dd6e27ddeccfe28f27 Mon Sep 17 00:00:00 2001 From: phil235 Date: Sun, 26 Apr 2015 19:23:22 +0200 Subject: [PATCH] Fixes Autodrobe not having any contraband/deluxe items in stock. Adding a warning to prevent future bug. Fixes dropped resuply canisters having most charges go in a single canister (and going above the initial charge amount). Fixes exploit with cult constructs creation. --- code/game/gamemodes/wizard/soulstone.dm | 2 ++ code/game/machinery/vending.dm | 28 +++++++++++++------ .../objects/items/weapons/vending_items.dm | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/code/game/gamemodes/wizard/soulstone.dm b/code/game/gamemodes/wizard/soulstone.dm index 2df1b4cd4ca..7f8ade33d02 100644 --- a/code/game/gamemodes/wizard/soulstone.dm +++ b/code/game/gamemodes/wizard/soulstone.dm @@ -169,6 +169,8 @@ var/mob/living/simple_animal/shade/A = locate() in C if(A) var/construct_class = alert(U, "Please choose which type of construct you wish to create.",,"Juggernaut","Wraith","Artificer") + if(!T || !T.loc) + return switch(construct_class) if("Juggernaut") makeNewConstruct(/mob/living/simple_animal/construct/armored, A, U) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 405abb48ddc..f2da54cc7a0 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -234,14 +234,6 @@ return if(component_parts && istype(W, /obj/item/weapon/crowbar)) - var/list/all_products = product_records + hidden_records + coin_records - for(var/datum/data/vending_product/machine_content in all_products) - while(machine_content.amount !=0) - for(var/obj/item/weapon/vending_refill/VR in component_parts) - VR.charges++ - machine_content.amount-- - if(!machine_content.amount) - break default_deconstruction_crowbar(W) if(istype(W, /obj/item/weapon/screwdriver) && anchored) @@ -282,6 +274,25 @@ else ..() + +/obj/machinery/vending/default_deconstruction_crowbar(var/obj/item/O) + var/list/all_products = product_records + hidden_records + coin_records + for(var/datum/data/vending_product/machine_content in all_products) + while(machine_content.amount !=0) + var/safety = 0 //to avoid infinite loop + for(var/obj/item/weapon/vending_refill/VR in component_parts) + safety++ + if(VR.charges < initial(VR.charges)) + VR.charges++ + machine_content.amount-- + if(!machine_content.amount) + break + else + safety-- + if(safety <= 0) + break + ..() + /obj/machinery/vending/emag_act(user as mob) if(!emagged) emagged = 1 @@ -594,6 +605,7 @@ contraband = list() premium = list() +IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY CANISTER CHARGES in vending_items.dm */ /* diff --git a/code/game/objects/items/weapons/vending_items.dm b/code/game/objects/items/weapons/vending_items.dm index 7edc9dba09b..c6ec42d40bd 100644 --- a/code/game/objects/items/weapons/vending_items.dm +++ b/code/game/objects/items/weapons/vending_items.dm @@ -56,7 +56,7 @@ /obj/item/weapon/vending_refill/autodrobe machine_name = "AutoDrobe" icon_state = "refill_costume" - charges = 26// of 77 + charges = 29// of 87 /obj/item/weapon/vending_refill/clothing machine_name = "ClothesMate"