-
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
337 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#define SAUNA_H2O_TEMP T20C + 80 | ||
#define SAUNA_LOG_FUEL 150 | ||
#define SAUNA_MAXIMUM_FUEL 3000 | ||
#define SAUNA_WATER_PER_WATER_UNIT 3 | ||
|
||
/obj/structure/sauna_oven | ||
name = "sauna oven" | ||
desc = "A modest sauna oven with rocks. Add some fuel, pour some water and enjoy the moment." | ||
icon_state = "sauna" | ||
density = TRUE | ||
anchored = TRUE | ||
resistance_flags = FIRE_PROOF | ||
var/lit = FALSE | ||
var/fuel_amount = 0 | ||
var/water_amount = 0 | ||
|
||
/obj/structure/sauna_oven/examine(mob/user) | ||
. = ..() | ||
. += "<span class='notice'>The rocks are [water_amount ? "moist" : "dry"].</span>" | ||
. += "<span class='notice'>There's [fuel_amount ? "some fuel" : "no fuel"] in the oven.</span>" | ||
|
||
/obj/structure/sauna_oven/Initialize() | ||
. = ..() | ||
RegisterSignal(src, COMSIG_ATOM_EXPOSE_REAGENTS, PROC_REF(add_water)) | ||
|
||
/obj/structure/sauna_oven/proc/add_water(atom/source, list/reagents, datum/reagents/source_reagents, method, volume_modifier, show_message) | ||
SIGNAL_HANDLER | ||
|
||
if(method != TOUCH) // Only splashing/pouring | ||
return | ||
|
||
for(var/reagent in reagents) | ||
if(istype(reagent, /datum/reagent/water)) | ||
water_amount += reagents[reagent] * SAUNA_WATER_PER_WATER_UNIT | ||
|
||
/obj/structure/sauna_oven/Destroy() | ||
if(lit) | ||
STOP_PROCESSING(SSobj, src) | ||
return ..() | ||
|
||
/obj/structure/sauna_oven/attack_hand(mob/user) | ||
. = ..() | ||
if(.) | ||
return | ||
if(lit) | ||
lit = FALSE | ||
STOP_PROCESSING(SSobj, src) | ||
user.visible_message("<span class='notice'>[user] turns on [src].</span>", "<span class='notice'>You turn on [src].</span>") | ||
else if (fuel_amount) | ||
lit = TRUE | ||
START_PROCESSING(SSobj, src) | ||
user.visible_message("<span class='notice'>[user] turns off [src].</span>", "<span class='notice'>You turn off [src].</span>") | ||
update_icon() | ||
|
||
/obj/structure/sauna_oven/update_overlays() | ||
. = ..() | ||
if(lit) | ||
. += "sauna_on_overlay" | ||
|
||
/obj/structure/sauna_oven/update_icon() | ||
..() | ||
icon_state = "[lit ? "sauna_on" : initial(icon_state)]" | ||
|
||
/obj/structure/sauna_oven/attackby(obj/item/T, mob/user) | ||
if(T.tool_behaviour == TOOL_WRENCH) | ||
to_chat(user, "<span class='notice'>You begin to deconstruct [src].</span>") | ||
if(T.use_tool(src, user, 60, volume=50)) | ||
to_chat(user, "<span class='notice'>You successfully deconstructed [src].</span>") | ||
new /obj/item/stack/sheet/mineral/wood(get_turf(src), 30) | ||
qdel(src) | ||
|
||
else if(istype(T, /obj/item/stack/sheet/mineral/wood)) | ||
var/obj/item/stack/sheet/mineral/wood/wood = T | ||
if(fuel_amount > SAUNA_MAXIMUM_FUEL) | ||
to_chat(user, "<span class='warning'>You can't fit any more of [T] in [src]!</span>") | ||
return | ||
fuel_amount += SAUNA_LOG_FUEL * wood.amount | ||
wood.use(wood.amount) | ||
user.visible_message("<span class='notice'>[user] tosses some \ | ||
wood into [src].</span>", "<span class='notice'>You add \ | ||
some fuel to [src].</span>") | ||
return ..() | ||
|
||
/obj/structure/sauna_oven/process() | ||
if(water_amount) | ||
var/used_amt | ||
if(water_amount >= 10) | ||
used_amt = water_amount/10 | ||
else if(water_amount >= 1) | ||
used_amt = 1 | ||
else | ||
used_amt = water_amount | ||
// The above is equal to used_amt = max(water_amount/10, min(1, water_amount) | ||
water_amount -= used_amt | ||
var/turf/pos = get_turf(src) | ||
if(pos) | ||
pos.atmos_spawn_air("water_vapor=[used_amt];TEMP=[SAUNA_H2O_TEMP]") | ||
fuel_amount-- | ||
|
||
if(fuel_amount <= 0) | ||
lit = FALSE | ||
STOP_PROCESSING(SSobj, src) | ||
update_icon() | ||
|
||
#undef SAUNA_H2O_TEMP | ||
#undef SAUNA_LOG_FUEL | ||
#undef SAUNA_MAXIMUM_FUEL | ||
#undef SAUNA_WATER_PER_WATER_UNIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
/// Default shape of the towel, when it's folded. | ||
#define TOWEL_FOLDED "" | ||
/// Chest-down variant of the towel. | ||
#define TOWEL_FULL "chest" | ||
/// Waist-down variant of the towel. | ||
#define TOWEL_WAIST "waist" | ||
/// Head variant of the towel. | ||
#define TOWEL_HEAD "head" | ||
/// Shape of the towel when it has been used, and is no longer neatly folded. | ||
#define TOWEL_USED "used" | ||
|
||
/// Icon path to the obj icon of the towel. | ||
#define TOWEL_OBJ_ICON 'icons/obj/clothing/towel.dmi' | ||
/// Icon path to the worn icon of the towel. | ||
#define TOWEL_WORN_ICON 'icons/mob/clothing/towel.dmi' | ||
|
||
/// How much cloth goes into a towel. | ||
#define TOWEL_CLOTH_AMOUNT 2 | ||
|
||
/obj/item/towel | ||
name = "towel" | ||
desc = "Everyone knows what a towel is. Use it to dry yourself, or wear it around your chest, your waist or even your head!" | ||
icon = TOWEL_OBJ_ICON | ||
mob_overlay_icon = TOWEL_WORN_ICON | ||
icon_state = "towel" | ||
base_icon_state = "towel" | ||
force = 0 | ||
throwforce = 0 | ||
throw_speed = 1 | ||
throw_range = 3 // They're not very aerodynamic. | ||
w_class = WEIGHT_CLASS_SMALL // Don't ask me why other cloth-related items are considered tiny, and not small like this one. | ||
item_flags = NOBLUDGEON | ||
resistance_flags = FLAMMABLE | ||
flags_inv = HIDEHAIR // Only relevant when in head shape, but useful to keep around regardless. | ||
supports_variations = DIGITIGRADE_VARIATION_NO_NEW_ICON | ||
/// The shape we're currently in. | ||
var/shape = TOWEL_FOLDED | ||
|
||
/obj/item/towel/examine(mob/user) | ||
. = ..() | ||
|
||
if(!ishuman(user) && !iscyborg(user)) | ||
return | ||
|
||
. += "" // Just for an empty line | ||
|
||
var/in_hands = TRUE | ||
if(ishuman(user)) | ||
in_hands = user.get_active_held_item() == src || user.get_inactive_held_item() == src | ||
|
||
if(in_hands) | ||
. += span_notice("<b>Use in hand</b> to shape [src] into something different.") | ||
|
||
if(iscyborg(user)) | ||
return | ||
|
||
if(shape == TOWEL_FULL || shape == TOWEL_WAIST) | ||
. += span_notice("<b>Alt-click</b> to adjust the fit of [src].") | ||
|
||
/obj/item/towel/attack_self(mob/user, modifiers) | ||
. = ..() | ||
|
||
/// Initializing this only once to avoid having to do it every time | ||
var/static/list/datum/radial_menu_choice/worn_options = list() | ||
|
||
if(!length(worn_options)) | ||
for(var/variant in list(TOWEL_FULL, TOWEL_WAIST, TOWEL_HEAD)) | ||
var/datum/radial_menu_choice/option = new | ||
var/image/variant_image = image(icon = TOWEL_OBJ_ICON, icon_state = "[base_icon_state]-[variant]") | ||
|
||
option.image = variant_image | ||
worn_options[capitalize(variant)] = option | ||
|
||
var/choice = show_radial_menu(user, src, worn_options, require_near = TRUE, tooltips = TRUE) | ||
|
||
if(!choice) | ||
return | ||
|
||
change_towel_shape(user, lowertext(choice)) | ||
|
||
/obj/item/towel/attackby(obj/item/I, mob/user, params) | ||
if(I.tool_behaviour == TOOL_WIRECUTTER || I.get_sharpness()) | ||
var/obj/item/stack/sheet/cotton/cloth/shreds = new (get_turf(src), 3) | ||
if(!QDELETED(shreds)) //stacks merged | ||
transfer_fingerprints_to(shreds) | ||
shreds.add_fingerprint(user) | ||
qdel(src) | ||
to_chat(user, "<span class='notice'>You tear [src] up.</span>") | ||
else | ||
return ..() | ||
|
||
/obj/item/towel/AltClick(mob/user) | ||
. = ..() | ||
|
||
if(. == FALSE) | ||
return | ||
|
||
if(!(shape == TOWEL_FULL || shape == TOWEL_WAIST)) | ||
return FALSE | ||
|
||
if(!ishuman(user)) | ||
return FALSE | ||
|
||
var/mob/living/carbon/human/towel_user = user | ||
var/worn = towel_user.wear_suit == src | ||
|
||
change_towel_shape(user, shape == TOWEL_FULL ? TOWEL_WAIST : TOWEL_FULL, silent = worn) | ||
|
||
// No need to display the different message if they're not wearing it. | ||
if(!worn) | ||
return | ||
|
||
to_chat(user, span_notice(shape == TOWEL_FULL ? "You raise \the [src] over your [shape]." : "You lower \the [src] down to your [shape].")) | ||
|
||
/obj/item/towel/machine_wash(obj/machinery/washing_machine/washer) | ||
. = ..() // This isn't really needed, including it in case we ever get dyeable towels. | ||
make_used(null, silent = TRUE) | ||
|
||
/obj/item/towel/dropped(mob/user, silent) | ||
. = ..() | ||
if(!ishuman(loc)) | ||
make_used(user, silent = TRUE) | ||
|
||
/* | ||
* Helper to change the shape of the towel, so that it updates its look both | ||
* in-hand and on the body of the wearer. | ||
* | ||
* Arguments: | ||
* * user - Mob that's trying to change the shape of the towel. | ||
* * new_shape - The new shape that the towel can be in. | ||
* * silent (optional) - Whether we produce a to_chat to the user to elaborate on | ||
* the new shape it is now in. Requires `user` to be non-null if `TRUE` in order to | ||
* do anything. Defaults to `FALSE`. | ||
*/ | ||
/obj/item/towel/proc/change_towel_shape(mob/user, new_shape, silent = FALSE) | ||
if(new_shape == shape) | ||
return | ||
|
||
shape = new_shape | ||
|
||
icon_state = "[base_icon_state][shape ? "-[shape]" : ""]" | ||
|
||
if(shape == TOWEL_HEAD) | ||
flags_inv |= HIDEHAIR | ||
else | ||
flags_inv &= ~HIDEHAIR | ||
|
||
update_appearance() | ||
update_slot_related_flags() | ||
|
||
if(!silent && user) | ||
to_chat(user, span_notice(shape ? "You adjust [src] so that it can be worn over your [shape]." : "You fold [src] neatly.")) | ||
|
||
/* | ||
* Helper proc to change the slot flags of the towel based on its shape. | ||
*/ | ||
/obj/item/towel/proc/update_slot_related_flags() | ||
switch(shape) | ||
if(TOWEL_FULL) | ||
slot_flags = ITEM_SLOT_OCLOTHING | ||
body_parts_covered = CHEST | GROIN | LEGS | ||
|
||
if(TOWEL_WAIST) | ||
slot_flags = ITEM_SLOT_OCLOTHING | ||
body_parts_covered = GROIN | LEGS | ||
|
||
if(TOWEL_HEAD) | ||
slot_flags = ITEM_SLOT_HEAD | ||
body_parts_covered = HEAD | ||
|
||
else | ||
slot_flags = NONE | ||
body_parts_covered = NONE | ||
|
||
update_slot_icon() | ||
|
||
/* | ||
* Simple helper to make the towel into a used towel shape. | ||
* | ||
* Arguments: | ||
* * user - Mob that's making the towel used. Can be null if `silent` is `FALSE`. | ||
* * silent (optional) - Whether we produce a to_chat to the user to elaborate on | ||
* the new shape it is now in. Requires `user` to be non-null if `TRUE` in order to | ||
* do anything. Defaults to `FALSE`. | ||
*/ | ||
/obj/item/towel/proc/make_used(mob/user, silent = FALSE) | ||
change_towel_shape(user, TOWEL_USED, silent) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters