rate limits pizza to prevent an edge case exploit

This commit is contained in:
deathride58
2022-05-27 23:48:04 -04:00
parent e577995c69
commit 6a17a044c4
+11 -3
View File
@@ -311,6 +311,7 @@
/obj/item/reagent_containers/food/snacks/pizza/donkpocket = 0.3,
/obj/item/reagent_containers/food/snacks/pizza/dank = 0.1) //pizzas here are weighted by chance to be someone's favorite
var/static/list/pizza_preferences
var/next_pizza_attunement
/obj/item/pizzabox/infinite/Initialize(mapload)
. = ..()
@@ -323,11 +324,18 @@
. += "<span class='deadsay'>This pizza box is anomalous, and will produce infinite pizza.</span>"
/obj/item/pizzabox/infinite/attack_self(mob/living/user)
QDEL_NULL(pizza)
if(ishuman(user))
attune_pizza(user)
if(world.time > next_pizza_attunement)
QDEL_NULL(pizza)
if(ishuman(user))
attune_pizza(user)
. = ..()
/obj/item/pizzabox/infinite/on_attack_hand(mob/user, act_intent, unarmed_attack_flags)
var/had_pizza = (pizza ? TRUE : FALSE)
. = ..()
if(had_pizza && !pizza)
next_pizza_attunement = world.time + (10 SECONDS) //This is balanced specifically so that it takes several hours to generate enough pizzas to use for lag methods that on item duping
/obj/item/pizzabox/infinite/proc/attune_pizza(mob/living/carbon/human/noms) //tonight on "proc names I never thought I'd type"
if(!pizza_preferences[noms.ckey])
pizza_preferences[noms.ckey] = pickweight(pizza_types)