Files
Bubberstation/code/game/objects/items/stacks/wrap.dm
Patrick Chieppe 2c8248575a Logging system refactor and improvement (#39521)
* Refactor several log lines to use datum_info_line and atom_loc_line

* Add default return strings from datum_info_line and atom_loc_line

* Add parentheses around atom_loc_line data

* Change more logs to use atom_loc_line

* Add check in atom_loc_line for turfs to avoid calling get_turf on them

* Re-add removed 'at'

* Replace datum_info_line with key_name and atom_loc_line with loc_name

* Refactor logging functions

* Avoid double-logging self-interactions

* Fallback to simple stringification if all else fails in key_name()

* Rewrite muscle spasm logging to use log_message

* Standardize logging of martial arts

* Tweak individual logging panel look

* Fix individual logging panel source

* When I typed || I really meant &&

* Fix Telecomms logging always showing client logs in the panel

* Reverts addition of buggy ownership log to panel

* Remove colon

* Fix missing log_directed_talk tag

* Add warning for missing type in log_direted_talk

* Change warnings to stack_traces

* Add square brackets around fallthrough key_name() case to help parsing

* Allow atom arguments/src in log_*() functions

* Change log_combat call with null argument to log_message

* Change mecha types' log_message() arguments to match atom and mob version

* Add key_name() case for atoms

* Fix resist_grab() unsetting pulledby before log_combat gets a chance to use it

* Fix log_globally logic

* Add logging for hitting objects with items

* Move log_combat() to atoms.dm

* Use utility functions for object stringification in log_combat()

* Use utility functions for object stringification in log_combat()

* Add missing logs for interacting with display cases

* Rewrite log_combat() comment

* Add missing space in log_combat()

* Add logging for hitting grilles barehanded

* Add missing ..()
2018-08-12 21:41:09 +02:00

132 lines
3.5 KiB
Plaintext

/*
* Wrapping Paper
*/
/obj/item/stack/wrapping_paper
name = "wrapping paper"
desc = "Wrap packages with this festive paper to make gifts."
icon = 'icons/obj/stack_objects.dmi'
icon_state = "wrap_paper"
item_flags = NOBLUDGEON
amount = 25
max_amount = 25
resistance_flags = FLAMMABLE
/obj/item/stack/wrapping_paper/use(used, transfer)
var/turf/T = get_turf(src)
. = ..()
if(QDELETED(src) && !transfer)
new /obj/item/c_tube(T)
/*
* Package Wrap
*/
/obj/item/stack/packageWrap
name = "package wrapper"
singular_name = "wrapping sheet"
desc = "You can use this to wrap items in."
icon = 'icons/obj/stack_objects.dmi'
icon_state = "deliveryPaper"
item_flags = NOBLUDGEON
amount = 25
max_amount = 25
resistance_flags = FLAMMABLE
/obj/item/stack/packageWrap/suicide_act(mob/living/user)
user.visible_message("<span class='suicide'>[user] begins wrapping [user.p_them()]self in \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
if(use(3))
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(user.loc))
P.icon_state = "deliverypackage5"
user.forceMove(P)
P.add_fingerprint(user)
return OXYLOSS
else
to_chat(user, "<span class='warning'>You need more paper!</span>")
return SHAME
/obj/item/proc/can_be_package_wrapped() //can the item be wrapped with package wrapper into a delivery package
return 1
/obj/item/storage/can_be_package_wrapped()
return 0
/obj/item/storage/box/can_be_package_wrapped()
return 1
/obj/item/smallDelivery/can_be_package_wrapped()
return 0
/obj/item/stack/packageWrap/afterattack(obj/target, mob/user, proximity)
. = ..()
if(!proximity)
return
if(!istype(target))
return
if(target.anchored)
return
if(isitem(target))
var/obj/item/I = target
if(!I.can_be_package_wrapped())
return
if(user.is_holding(I))
if(!user.dropItemToGround(I))
return
else if(!isturf(I.loc))
return
if(use(1))
var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(get_turf(I.loc))
if(user.Adjacent(I))
P.add_fingerprint(user)
I.add_fingerprint(user)
user.put_in_hands(P)
I.forceMove(P)
var/size = round(I.w_class)
P.name = "[weightclass2text(size)] parcel"
P.w_class = size
size = min(size, 5)
P.icon_state = "deliverypackage[size]"
else if(istype (target, /obj/structure/closet))
var/obj/structure/closet/O = target
if(O.opened)
return
if(!O.delivery_icon) //no delivery icon means unwrappable closet (e.g. body bags)
to_chat(user, "<span class='warning'>You can't wrap this!</span>")
return
if(use(3))
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
P.icon_state = O.delivery_icon
O.forceMove(P)
P.add_fingerprint(user)
O.add_fingerprint(user)
else
to_chat(user, "<span class='warning'>You need more paper!</span>")
return
else
to_chat(user, "<span class='warning'>The object you are trying to wrap is unsuitable for the sorting machinery!</span>")
return
user.visible_message("<span class='notice'>[user] wraps [target].</span>")
user.log_message("has used [name] on [key_name(target)]", LOG_ATTACK, color="blue")
/obj/item/stack/packageWrap/use(used, transfer = FALSE)
var/turf/T = get_turf(src)
. = ..()
if(QDELETED(src) && !transfer)
new /obj/item/c_tube(T)
/obj/item/c_tube
name = "cardboard tube"
desc = "A tube... of cardboard."
icon = 'icons/obj/stack_objects.dmi'
icon_state = "c_tube"
throwforce = 0
w_class = WEIGHT_CLASS_TINY
throw_speed = 3
throw_range = 5