Skip to content

Commit

Permalink
Merge pull request Civ13#2700 from savethetreez/skibidibranch
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
savethetreez authored Apr 9, 2024
2 parents ca6124f + 0ea3e37 commit e99894c
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 110 deletions.
176 changes: 85 additions & 91 deletions code/game/turfs/floor_attackby.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -276,24 +275,24 @@ 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("<span class = 'notice'>[user] starts to break the rock with \the [C.name].</span>", "<span class = 'notice'>You start to break the rock with \the [C.name].</span>")
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))
var/turf/floor/dirt/underground/empty/TT = src
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))
Expand All @@ -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("<span class = 'notice'>[user] carefully examines \the [src] with \the [C.name]...</span>", "<span class = 'notice'>You start to carefully examine \the [src] with \the [C.name].</span>")
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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -826,23 +825,22 @@ 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))
var/turf/floor/dirt/underground/empty/T = src
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
..()
Expand All @@ -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("<span class = 'notice'>[user] starts to collect snow into a pile.</span>", "<span class = 'notice'>You start to collect snow into a pile.</span>")
playsound(src,'sound/effects/shovelling.ogg',100,1)
if (do_after(user, rand(45,60)))
user.visible_message("<span class = 'notice'>[user] collects the snow into a pile.</span>", "<span class = 'notice'>You collect the snow into a pile.</span>")
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("<span class = 'notice'>[user] starts to collect dirt into a pile.</span>", "<span class = 'notice'>You start to collect dirt into a pile.</span>")
playsound(src,'sound/effects/shovelling.ogg',100,1)
if (do_after(user, rand(45,60)))
user.visible_message("<span class = 'notice'>[user] collects the dirt into a pile.</span>", "<span class = 'notice'>You collect the dirt into a pile.</span>")
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("<span class = 'notice'>[user] starts to collect snow into a pile.</span>", "<span class = 'notice'>You start to collect snow into a pile.</span>")
playsound(src,'sound/effects/shovelling.ogg',100,1)
if (!do_after(user, rand(45,60)))
H.shoveling = FALSE
user.visible_message("<span class = 'notice'>[user] collects the snow into a pile.</span>", "<span class = 'notice'>You collect the snow into a pile.</span>")
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("<span class = 'notice'>[user] starts to collect dirt into a pile.</span>", "<span class = 'notice'>You start to collect dirt into a pile.</span>")
playsound(src,'sound/effects/shovelling.ogg',100,1)
if (do_after(user, rand(45,60)))
user.visible_message("<span class = 'notice'>[user] collects the dirt into a pile.</span>", "<span class = 'notice'>You collect the dirt into a pile.</span>")
H.shoveling = FALSE
H.adaptStat("strength", 1)
T.available_dirt -= 1
new /obj/item/weapon/barrier(T)
else
user << "<span class='notice'>All the loose dirt has been shoveled out of this spot already.</span>"
else if (istype(T, /turf/floor/beach/sand) && istype(H) && !H.shoveling)
if (T.available_sand > 0)
H.shoveling = TRUE
user.visible_message("<span class = 'notice'>[user] starts to collect sand into a pile.</span>", "<span class = 'notice'>You start to collect sand into a pile.</span>")
playsound(src,'sound/effects/shovelling.ogg',100,1)
if (do_after(user, rand(45,60)))
user.visible_message("<span class = 'notice'>[user] collects the sand into a pile.</span>", "<span class = 'notice'>You collect the sand into a pile.</span>")
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 << "<span class='notice'>All the loose dirt has been shoveled out of this spot already.</span>"
else if (istype(T, /turf/floor/beach/sand) && istype(H) && !H.shoveling)
if (T.available_sand > 0)
H.shoveling = TRUE
user.visible_message("<span class = 'notice'>[user] starts to collect sand into a pile.</span>", "<span class = 'notice'>You start to collect sand into a pile.</span>")
playsound(src,'sound/effects/shovelling.ogg',100,1)
if (do_after(user, rand(45,60)))
user.visible_message("<span class = 'notice'>[user] collects the sand into a pile.</span>", "<span class = 'notice'>You collect the sand into a pile.</span>")
H.shoveling = FALSE
H.adaptStat("strength", 1)
T.available_sand -= 1
new /obj/item/stack/ore/glass(T)
else
H.shoveling = FALSE
else
..()
else
Expand Down Expand Up @@ -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
..()
13 changes: 7 additions & 6 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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("<span class = 'notice'>[user] starts to break the rock with their hands...</span>", "<span class = 'notice'>You start to break the rock with the your hands...</span>")
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)
Expand Down
26 changes: 13 additions & 13 deletions code/modules/materials/material_sheets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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("<span class = 'red'>[user.name] tries to set \the [src] on fire!</span>", "<span class = 'red'>You try to set \the [src] on fire!</span>")
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("<span class = 'red'>[user.name] sets \the [src] on fire!</span>", "<span class = 'red'>You set \the [src] on fire!</span>")
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
Expand All @@ -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 ..()

Expand Down

0 comments on commit e99894c

Please sign in to comment.