mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-25 14:16:30 +01:00
re-sealing envelopes with stamps + style tweaks
Also adds item/proc/BlockInteraction. Carries out common or configurable checks for whether a given interaction should be allowed to continue; reduces boilerplate somewhat. Also refactors stamps to make this possible. Stamps are now configured with authority_name and authority_suffix rather than setting the stamp name directly. This is so that envelope seals can be sealed by a `Sol Government seal` rather than `Sol Government logo stamp seal`, or a `clown seal` rather than a `clown's rubber stamp seal`. You get the idea. Also partially refactors folders. Their attackby behavior was a sin.
This commit is contained in:
@@ -921,3 +921,45 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
|
||||
/obj/item/proc/animal_consumed(var/mob/user)
|
||||
user.visible_message(SPAN_NOTICE("\The [user] finishes eating \the [src]."), SPAN_NOTICE("You finish eating \the [src]."))
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/item/proc/BlockInteraction(mob/living/user, silent, list/options)
|
||||
var/static/list/default_options = list(
|
||||
"type" = /mob/living,
|
||||
"distance" = TRUE,
|
||||
"incapacitation" = INCAPACITATION_DEFAULT,
|
||||
"dexterity" = FALSE
|
||||
)
|
||||
. = TRUE // A code per case is possible. For now, just TRUE if the interaction should be blocked.
|
||||
if (QDELETED(user))
|
||||
return
|
||||
if (!options)
|
||||
options = default_options
|
||||
var/test_type = options["type"]
|
||||
if (test_type)
|
||||
if (!istype(user, test_type))
|
||||
if (!silent)
|
||||
to_chat(user, SPAN_WARNING("You're the wrong kind of mob to use \the [src]."))
|
||||
return
|
||||
var/test_distance = options["distance"]
|
||||
if (test_distance > 0)
|
||||
if (test_distance <= 1)
|
||||
if (!Adjacent(user)) //Adjacency is more costly than simple distance, but common use.
|
||||
if (!silent)
|
||||
to_chat(user, SPAN_WARNING("You're not close enough to \the [src]."))
|
||||
return
|
||||
else if (get_dist(src, user) > test_distance)
|
||||
if (!silent)
|
||||
to_chat(user, SPAN_WARNING("You're not close enough to \the [src]."))
|
||||
return
|
||||
var/test_incapacitation = options["incapacitation"]
|
||||
if (test_incapacitation)
|
||||
if (user.incapacitated(test_incapacitation))
|
||||
if (!silent)
|
||||
to_chat(user, SPAN_WARNING("You're in no condition to use \the [src]."))
|
||||
return
|
||||
var/test_dexterity = options["dexterity"]
|
||||
if (test_dexterity)
|
||||
if (!user.check_dexterity(test_dexterity, src, silent)) // Handles its own failure message.
|
||||
return
|
||||
return FALSE
|
||||
|
||||
Reference in New Issue
Block a user