Files
Bubberstation/code/game/objects/items/food/monkeycube.dm
AnturK 4d6a8bc537 515 Compatibility (#71161)
Makes the code compatible with 515.1594+

Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword

And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.

@tgstation/commit-access Since the .proc/stuff is pretty big change.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-11-15 03:50:11 +00:00

79 lines
3.6 KiB
Plaintext

/obj/item/food/monkeycube
name = "monkey cube"
desc = "Just add water!"
icon_state = "monkeycube"
bite_consumption = 12
food_reagents = list(/datum/reagent/monkey_powder = 30)
tastes = list("the jungle" = 1, "bananas" = 1)
foodtypes = MEAT | SUGAR
food_flags = FOOD_FINGER_FOOD
w_class = WEIGHT_CLASS_TINY
var/faction
var/spawned_mob = /mob/living/carbon/human/species/monkey
/obj/item/food/monkeycube/proc/Expand()
var/mob/spammer = get_mob_by_key(fingerprintslast)
var/mob/living/bananas = new spawned_mob(drop_location(), TRUE, spammer)
if(faction)
bananas.faction = faction
if (!QDELETED(bananas))
visible_message(span_notice("[src] expands!"))
bananas.log_message("spawned via [src], Last attached mob: [key_name(spammer)].", LOG_ATTACK)
else if (!spammer) // Visible message in case there are no fingerprints
visible_message(span_notice("[src] fails to expand!"))
qdel(src)
/obj/item/food/monkeycube/suicide_act(mob/living/user)
user.visible_message(span_suicide("[user] is putting [src] in [user.p_their()] mouth! It looks like [user.p_theyre()] trying to commit suicide!"))
var/eating_success = do_after(user, 1 SECONDS, src)
if(QDELETED(user)) //qdeletion: the nuclear option of self-harm
return SHAME
if(!eating_success || QDELETED(src)) //checks if src is gone or if they failed to wait for a second
user.visible_message(span_suicide("[user] chickens out!"))
return SHAME
if(HAS_TRAIT(user, TRAIT_NOHUNGER)) //plasmamen don't have saliva/stomach acid
user.visible_message(span_suicide("[user] realizes [user.p_their()] body won't activate [src]!")
,span_warning("Your body won't activate [src]..."))
return SHAME
playsound(user, 'sound/items/eatfood.ogg', rand(10, 50), TRUE)
user.temporarilyRemoveItemFromInventory(src) //removes from hands, keeps in M
addtimer(CALLBACK(src, PROC_REF(finish_suicide), user), 15) //you've eaten it, you can run now
return MANUAL_SUICIDE
/obj/item/food/monkeycube/proc/finish_suicide(mob/living/user) ///internal proc called by a monkeycube's suicide_act using a timer and callback. takes as argument the mob/living who activated the suicide
if(QDELETED(user) || QDELETED(src))
return
if(src.loc != user) //how the hell did you manage this
to_chat(user, span_warning("Something happened to [src]..."))
return
Expand()
user.visible_message(span_danger("[user]'s torso bursts open as a primate emerges!"))
user.gib(null, TRUE, null, TRUE)
/obj/item/food/monkeycube/syndicate
faction = list("neutral", ROLE_SYNDICATE)
/obj/item/food/monkeycube/gorilla
name = "gorilla cube"
desc = "A Waffle Co. brand gorilla cube. Now with extra molecules!"
bite_consumption = 20
food_reagents = list(/datum/reagent/monkey_powder = 30, /datum/reagent/medicine/strange_reagent = 5)
tastes = list("the jungle" = 1, "bananas" = 1, "jimmies" = 1)
spawned_mob = /mob/living/simple_animal/hostile/gorilla
/obj/item/food/monkeycube/chicken
name = "chicken cube"
desc = "A new Nanotrasen classic, the chicken cube. Tastes like everything!"
bite_consumption = 20
food_reagents = list(/datum/reagent/consumable/eggyolk = 30, /datum/reagent/medicine/strange_reagent = 1)
tastes = list("chicken" = 1, "the country" = 1, "chicken bouillon" = 1)
spawned_mob = /mob/living/simple_animal/chicken
/obj/item/food/monkeycube/bee
name = "bee cube"
desc = "We were sure it was a good idea. Just add water."
bite_consumption = 20
food_reagents = list(/datum/reagent/consumable/honey = 10, /datum/reagent/toxin = 5, /datum/reagent/medicine/strange_reagent = 1)
tastes = list("buzzing" = 1, "honey" = 1, "regret" = 1)
spawned_mob = /mob/living/simple_animal/hostile/bee