diff --git a/code/game/turfs/floor_attackby.dm b/code/game/turfs/floor_attackby.dm index 4a66565d48..36c6517011 100644 --- a/code/game/turfs/floor_attackby.dm +++ b/code/game/turfs/floor_attackby.dm @@ -64,7 +64,6 @@ else ChangeTurf(/turf/floor/dirt)*/ -var/mining_in_progress = null // Define the variable out of any scopes and the attackby() procedures. /turf/floor/attackby(obj/item/C as obj, mob/user as mob) if (!C || !user) @@ -276,16 +275,16 @@ var/mining_in_progress = null // Define the variable out of any scopes and the a var/turf/T = get_turf(src) var/mob/living/human/H = user if (istype(T, /turf/floor/dirt/underground) && istype(H)) - if (mining_in_progress) - to_chat(user, SPAN_WARNING("You are already breaking the rock with \the [C.name].")) + if (T.mining_in_progress) + to_chat(user, SPAN_WARNING("The rock is already being mined.")) return // Set mining_in_progress to TRUE to indicate the process has started - mining_in_progress = TRUE + T.mining_in_progress = TRUE user.visible_message("[user] starts to break the rock with \the [C.name].", "You start to break the rock with \the [C.name].") playsound(src,'sound/effects/pickaxe.ogg',100,1) if (!do_after(user, (320/(H.getStatCoeff("strength"))/SH.usespeed))) - mining_in_progress = FALSE // In case we abort mid-way. + T.mining_in_progress = FALSE // In case we abort mid-way. return collapse_check() if (istype(src, /turf/floor/dirt/underground/empty)) @@ -293,7 +292,7 @@ var/mining_in_progress = null // Define the variable out of any scopes and the a TT.mining_clear_debris() else if (!istype(src, /turf/floor/dirt/underground/empty)) mining_proc(H) - mining_in_progress = FALSE // Reset the variable to FALSE after the breaking process is complete + T.mining_in_progress = FALSE // Reset the variable to FALSE after the breaking process is complete return else if (istype(C, /obj/item/weapon/reagent_containers/glass/extraction_kit)) @@ -303,7 +302,7 @@ var/mining_in_progress = null // Define the variable out of any scopes and the a to_chat(H, SPAN_NOTICE("Empty \the [ET] first.")) return if (istype(H)) - user.visible_message("[user] carefully examines \the [src] with \the [C.name]...", "You start to carefully examine \the [src] with \the [C.name].") + user.visible_message(SPAN_NOTICE("[user] carefully examines \the [src] with \the [C.name]..."), SPAN_NOTICE("You start to carefully examine \the [src] with \the [C.name].")) playsound(src,'sound/effects/pickaxe.ogg',100,1) var/timera = 110/(H.getStatCoeff("dexterity")) if (do_after(user, timera)) @@ -577,19 +576,19 @@ var/mining_in_progress = null // Define the variable out of any scopes and the a if (istype(C, /obj/item/weapon/material/pickaxe)) var/mob/living/human/H = user if (istype(H)) - if(mining_in_progress) + if(src.mining_in_progress) to_chat(user, SPAN_WARNING("You are already trying to break the rocky floor with \the [C.name].")) return // Set mining_in_progress to TRUE to indicate the process has started. - mining_in_progress = TRUE + src.mining_in_progress = TRUE visible_message(SPAN_NOTICE("[user] starts to break the rocky floor with \the [C.name]."), SPAN_NOTICE("You start to break the rocky floor with \the [C.name].")) playsound(src,'sound/effects/pickaxe.ogg',100,1) var/timera = 320/(H.getStatCoeff("strength")) if (do_after(user, timera)) mining_proc(H) - mining_in_progress = FALSE // Reset the variable to FALSE after finishing the breaking process. + src.mining_in_progress = FALSE // Reset the variable to FALSE after finishing the breaking process. else - mining_in_progress = FALSE // In case we abort mid-way. + src.mining_in_progress = FALSE // In case we abort mid-way. return ..(C, user) else if (istype(C, /obj/item/weapon/reagent_containers/glass/extraction_kit)) var/mob/living/human/H = user @@ -826,15 +825,14 @@ var/mining_in_progress = null // Define the variable out of any scopes and the a var/turf/floor/dirt/underground/U = src var/mob/living/human/H = user if (H.ant && H.a_intent == I_GRAB) - if(mining_in_progress) + if(src.mining_in_progress) to_chat(user, SPAN_WARNING("You are already trying to break the rocky floor.")) return - // Set mining_in_progress to TRUE to indicate the process has started. - mining_in_progress = TRUE + src.mining_in_progress = TRUE visible_message(SPAN_NOTICE("[user] starts to break the rock with their hands..."), SPAN_NOTICE("You start to break the rock with the your hands...")) playsound(src,'sound/effects/pickaxe.ogg',100,1) if (!do_after(user, (320/(H.getStatCoeff("strength"))/1.5))) - mining_in_progress = FALSE // In case we abort mid-way. + src.mining_in_progress = FALSE // In case we abort mid-way. return U.collapse_check() if (istype(src, /turf/floor/dirt/underground/empty)) @@ -842,7 +840,7 @@ var/mining_in_progress = null // Define the variable out of any scopes and the a T.mining_clear_debris() else if (!istype(src, /turf/floor/dirt/underground/empty)) mining_proc(H) - mining_in_progress = FALSE // Reset the mining_in_progress variable after the process has finished. + src.mining_in_progress = FALSE // Reset the mining_in_progress variable after the process has finished. return TRUE else ..() @@ -854,59 +852,56 @@ var/mining_in_progress = null // Define the variable out of any scopes and the a var/turf/floor/T = src var/mob/living/human/H = user if (H.ant && H.a_intent == I_GRAB) - if (!H.shoveling) - if (T.icon == 'icons/turf/snow.dmi' && istype(H)) - if (T.available_snow > 0) - H.shoveling = TRUE - user.visible_message("[user] starts to collect snow into a pile.", "You start to collect snow into a pile.") - playsound(src,'sound/effects/shovelling.ogg',100,1) - if (do_after(user, rand(45,60))) - user.visible_message("[user] collects the snow into a pile.", "You collect the snow into a pile.") - H.shoveling = FALSE - H.adaptStat("strength", 1) - T.available_snow -= 1 - new /obj/item/weapon/snowwall(T) - if (T.available_snow <= 0) - if (istype(T, /turf/floor/winter/grass)) - T.ChangeTurf(/turf/floor/grass) - else if (istype(T, /turf/floor/dirt/winter)) - T.ChangeTurf(/turf/floor/dirt) - - else - H.shoveling = FALSE - else - to_chat(user, SPAN_NOTICE("All the loose snow has been shoveled out of this spot already.")) - - else if (istype(T, /turf/floor/dirt) && istype(H) && !H.shoveling) - if (T.available_dirt > 0) - H.shoveling = TRUE - user.visible_message("[user] starts to collect dirt into a pile.", "You start to collect dirt into a pile.") - playsound(src,'sound/effects/shovelling.ogg',100,1) - if (do_after(user, rand(45,60))) - user.visible_message("[user] collects the dirt into a pile.", "You collect the dirt into a pile.") - H.shoveling = FALSE - H.adaptStat("strength", 1) - T.available_dirt -= 1 - new /obj/item/weapon/barrier(T) - else - H.shoveling = FALSE + if (H.shoveling) + ..() + if (T.icon == 'icons/turf/snow.dmi' && istype(H)) + if (T.available_snow <= 0) + to_chat(user, SPAN_NOTICE("All the loose snow has been shoveled out of this spot already.")) + return + H.shoveling = TRUE + user.visible_message("[user] starts to collect snow into a pile.", "You start to collect snow into a pile.") + playsound(src,'sound/effects/shovelling.ogg',100,1) + if (!do_after(user, rand(45,60))) + H.shoveling = FALSE + user.visible_message("[user] collects the snow into a pile.", "You collect the snow into a pile.") + H.shoveling = FALSE + H.adaptStat("strength", 1) + T.available_snow -= 1 + new /obj/item/weapon/snowwall(T) + if (T.available_snow <= 0) + if (istype(T, /turf/floor/winter/grass)) + T.ChangeTurf(/turf/floor/grass) + else if (istype(T, /turf/floor/dirt/winter)) + T.ChangeTurf(/turf/floor/dirt) + + else if (istype(T, /turf/floor/dirt) && istype(H) && !H.shoveling) + if (T.available_dirt > 0) + H.shoveling = TRUE + user.visible_message("[user] starts to collect dirt into a pile.", "You start to collect dirt into a pile.") + playsound(src,'sound/effects/shovelling.ogg',100,1) + if (do_after(user, rand(45,60))) + user.visible_message("[user] collects the dirt into a pile.", "You collect the dirt into a pile.") + H.shoveling = FALSE + H.adaptStat("strength", 1) + T.available_dirt -= 1 + new /obj/item/weapon/barrier(T) else - user << "All the loose dirt has been shoveled out of this spot already." - else if (istype(T, /turf/floor/beach/sand) && istype(H) && !H.shoveling) - if (T.available_sand > 0) - H.shoveling = TRUE - user.visible_message("[user] starts to collect sand into a pile.", "You start to collect sand into a pile.") - playsound(src,'sound/effects/shovelling.ogg',100,1) - if (do_after(user, rand(45,60))) - user.visible_message("[user] collects the sand into a pile.", "You collect the sand into a pile.") - H.shoveling = FALSE - H.adaptStat("strength", 1) - T.available_sand -= 1 - new /obj/item/stack/ore/glass(T) - else - H.shoveling = FALSE + H.shoveling = FALSE else - ..() + user << "All the loose dirt has been shoveled out of this spot already." + else if (istype(T, /turf/floor/beach/sand) && istype(H) && !H.shoveling) + if (T.available_sand > 0) + H.shoveling = TRUE + user.visible_message("[user] starts to collect sand into a pile.", "You start to collect sand into a pile.") + playsound(src,'sound/effects/shovelling.ogg',100,1) + if (do_after(user, rand(45,60))) + user.visible_message("[user] collects the sand into a pile.", "You collect the sand into a pile.") + H.shoveling = FALSE + H.adaptStat("strength", 1) + T.available_sand -= 1 + new /obj/item/stack/ore/glass(T) + else + H.shoveling = FALSE else ..() else @@ -990,31 +985,30 @@ var/mining_in_progress = null // Define the variable out of any scopes and the a to_chat(H, SPAN_WARNING("It's probably not a good idea to drink saltwater.")) return to_chat(H, SPAN_NOTICE("You start drinking some water from the ground...")) - if (do_after(H,50,src)) - var/watertype = "water" - if (radiation>0) - watertype = "irradiated_water" - if (watertype == "irradiated_water") - H.rad_act(5) - else - var/dmod = 1 - if (H.find_trait("Weak Immune System")) - dmod = 2 - if (H.find_trait("Strong Immune System")) - dmod = 0.2 - if (prob(sickness*15*dmod) && !H.orc && !H.crab) - if (H.disease == 0) - H.disease_progression = 0 - H.disease_type ="cholera" - H.disease = 1 - if (H.water < 0) - H.water += rand(40,50) - H.water += 75 - H.bladder += 25 - to_chat(H, SPAN_NOTICE("You drink some water from \the [src].")) - playsound(H.loc, "drink", rand(10, 50), TRUE) + if (!do_after(H,50,src)) return + var/watertype = "water" + if (radiation > 0) + watertype = "irradiated_water" + if (watertype == "irradiated_water") + H.rad_act(5) else - return + var/dmod = 1 + if (H.find_trait("Weak Immune System")) + dmod = 2 + if (H.find_trait("Strong Immune System")) + dmod = 0.2 + if (prob(sickness*15*dmod) && !H.orc && !H.crab) + if (H.disease == 0) + H.disease_progression = 0 + H.disease_type ="cholera" + H.disease = 1 + if (H.water < 0) + H.water += rand(40,50) + H.water += 75 + H.bladder += 25 + to_chat(H, SPAN_NOTICE("You drink some water from \the [src].")) + playsound(H.loc, "drink", rand(10, 50), TRUE) + return else ..() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index b849f15a8d..60a17475bb 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -41,6 +41,7 @@ var/list/interior_areas = list(/area/caribbean/houses, var/is_diggable = FALSE //can be digged with a shovel? var/is_plowed = FALSE // ready to be farmed? var/is_mineable = FALSE //can be mined with a pickaxe? + var/mining_in_progress = FALSE //Is it being mined actually? //Mining resources (for the large drills). // var/has_resources // var/list/resources @@ -135,25 +136,25 @@ var/list/interior_areas = list(/area/caribbean/houses, var/turf/floor/dirt/underground/U = src var/mob/living/human/H = user if (H.ant) - if(mining_in_progress) + if(src.mining_in_progress) to_chat(user, SPAN_WARNING("You are already trying to break the rocky floor.")) return // Set mining_in_progress to TRUE to indicate the process has started. - mining_in_progress = TRUE - visible_message("[user] starts to break the rock with their hands...", "You start to break the rock with the your hands...") + src.mining_in_progress = TRUE + user.visible_message(SPAN_NOTICE("[user] starts to break the rock with their hands..."), SPAN_NOTICE("You start to break the rock with the your hands...")) playsound(src,'sound/effects/pickaxe.ogg',100,1) if (!do_after(user, (160/(H.getStatCoeff("strength"))/1.5))) - mining_in_progress = FALSE // In case we abort mid-way. + src.mining_in_progress = FALSE // In case we abort mid-way. return U.collapse_check() if (istype(src, /turf/floor/dirt/underground/empty)) var/turf/floor/dirt/underground/empty/T = src T.mining_clear_debris() - mining_in_progress = FALSE // Reset the variable after the process has finished. + src.mining_in_progress = FALSE // Reset the variable after the process has finished. return else if (!istype(src, /turf/floor/dirt/underground/empty)) mining_proc(H) - mining_in_progress = FALSE + src.mining_in_progress = FALSE return TRUE if (world.time >= user.next_push) diff --git a/code/modules/materials/material_sheets.dm b/code/modules/materials/material_sheets.dm index 75f2e884e1..760dccebba 100644 --- a/code/modules/materials/material_sheets.dm +++ b/code/modules/materials/material_sheets.dm @@ -399,6 +399,7 @@ flammable = TRUE var/onfire = FALSE var/ash_production = FALSE + var/splitting_in_progress = FALSE /obj/item/stack/material/wood/twentyfive amount = 25 @@ -414,27 +415,27 @@ qdel(NF) qdel(src) -var/splitting_in_progress = null // Initialize the variable outside of the scopes and procedure attackby() /obj/item/stack/material/wood/attackby(obj/item/T as obj, mob/living/human/user as mob) if (istype(T, /obj/item/flashlight/torch)) var/obj/item/flashlight/torch/F = T if(user.a_intent == "harm" && F.on && !onfire) - user.visible_message("[user.name] tries to set \the [src] on fire!", "You try to set \the [src] on fire!") + user.visible_message(SPAN_RED("[user.name] tries to set \the [src] on fire!"), SPAN_RED("You try to set \the [src] on fire!")) if(prob(30)) ash_production = 1 src.onfire = 1 start_fire() - user.visible_message("[user.name] sets \the [src] on fire!", "You set \the [src] on fire!") + user.visible_message(SPAN_RED("[user.name] sets \the [src] on fire!"), SPAN_RED("You set \the [src] on fire!")) return if (istype(T, /obj/item/weapon/material/hatchet)) // var/obj/item/weapon/material/hatchet/SH = T // Check if there's enough material if (src.amount < 2) to_chat(user, "You don't have enough material to try.") + return else // Check if splitting process is already in progress if (splitting_in_progress) - to_chat(user, SPAN_DANGER("You are already splitting \the [src].")) + to_chat(user, SPAN_DANGER("\The [src] is already being split.")) return // Set splitting_in_progress to TRUE to indicate the process has started splitting_in_progress = TRUE @@ -444,17 +445,16 @@ var/splitting_in_progress = null // Initialize the variable outside of the scop playsound(loc, 'sound/effects/woodfile.ogg', 100, TRUE) // Set a delay for the splitting process - if (do_after(user, (80/(user.getStatCoeff("strength"))), src)) // Was originally dividing by SH.chopping_speed after getstatcoeff but the flint hatchet has a faster chopping_speed than an iron one. TODO: refactor the speeds. - // Finish the splitting process - user.visible_message("[user.name] finishes carving \the [src] into a plank.", "You finish carving \the [src] into a plank.") - src.use(2) - var/obj/item/stack/material/woodplank/dropwood = new /obj/item/stack/material/woodplank(get_turf(user)) - dropwood.amount = 1 // You might expect to obtain anywhere from 2 to 4 planks from a single log. TODO: skill-based plank output - dropwood.update_strings() - splitting_in_progress = FALSE // Reset the variable to FALSE after the splitting process is complete - else + if (!do_after(user, (80/(user.getStatCoeff("strength"))), src)) // Was originally dividing by SH.chopping_speed after getstatcoeff but the flint hatchet has a faster chopping_speed than an iron one. TODO: refactor the speeds. splitting_in_progress = FALSE // In case we abort mid-way. return + // Finish the splitting process + user.visible_message("[user.name] finishes carving \the [src] into a plank.", "You finish carving \the [src] into a plank.") + src.use(2) + var/obj/item/stack/material/woodplank/dropwood = new /obj/item/stack/material/woodplank(get_turf(user)) + dropwood.amount = 1 // You might expect to obtain anywhere from 2 to 4 planks from a single log. TODO: skill-based plank output + dropwood.update_strings() + splitting_in_progress = FALSE // Reset the variable to FALSE after the splitting process is complete return ..()