Skip to content

Commit

Permalink
walls n planks
Browse files Browse the repository at this point in the history
  • Loading branch information
KanohaShinobi committed Feb 21, 2024
1 parent 540999c commit 50e7fd5
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 29 deletions.
11 changes: 10 additions & 1 deletion code/game/objects/covers_types/cover_walltypes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,17 @@
name = "medieval wall"
desc = "A dark-ages wall."
icon = 'icons/turf/walls.dmi'
icon_state = "medieval_wall"
icon_state = "medieval0"
base_icon_state = "medieval"
health = 330
adjusts = TRUE
mergewith = list(/obj/structure/window/classic/medieval,/obj/structure/window_frame/medieval,/obj/covers/wood_wall/medieval)
/obj/covers/wood_wall/medieval/can_join_with(var/atom/W)
if (istype(W,src))
return TRUE
for (var/i in mergewith)
if (istype(W,i))
return TRUE

/obj/covers/wood_wall/medieval/x
name = "medieval wall crossbeam"
Expand Down
97 changes: 95 additions & 2 deletions code/game/objects/structures/window.dm
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,49 @@
/obj/structure/window_frame/abashiri/Destroy()
check_relatives(0,1)
..()


/obj/structure/window_frame/medieval
icon_state = "medieval0"
var/base_icon_state = "medieval"
var/adjusts = TRUE
mergewith = list(/obj/structure/window/classic/medieval,/obj/structure/window_frame/medieval,/obj/covers/wood_wall/medieval)
/obj/structure/window_frame/medieval/check_relatives(var/update_self = FALSE, var/update_others = FALSE)
if (!adjusts)
return
var/junction
if (update_self)
junction = FALSE
for (var/checkdir in cardinal)
var/turf/T = get_step(src, checkdir)
for(var/atom/CV in T)
if (!can_join_with(CV))
continue
if (update_self)
if (can_join_with(CV))
junction |= get_dir(src,CV)
if (update_others)
CV.check_relatives(1,0)
if (!isnull(junction))
icon_state = "[base_icon_state][junction]"
return
/obj/structure/window_frame/medieval/can_join_with(var/atom/W)
if (istype(W,src))
return TRUE
for (var/i in mergewith)
if (istype(W,i))
return TRUE
/obj/structure/window_frame/medieval/update_icon()
..()
check_relatives(1,1)
/obj/structure/window_frame/medieval/New()
..()
check_relatives(1,1)

/obj/structure/window_frame/medieval/Destroy()
check_relatives(0,1)
..()

/obj/structure/window_frame/shoji
icon_state = "shoji_windownew_frame"
name = "shoji window frame"
Expand All @@ -515,7 +558,7 @@
flammable = FALSE
stucco_window = FALSE

/obj/structure/window_frame/medieval
/obj/structure/window_frame/medieval_old
icon_state = "medieval_windownew_frame"
name = "medieval window frame"
desc = "A dark ages window, minus the window."
Expand Down Expand Up @@ -807,7 +850,7 @@
damage_per_fire_tick = 1.0
maxhealth = 300.0

/obj/structure/window/classic/medieval
/obj/structure/window/classic/medieval_old
icon_state = "medieval_windownew"
basestate = "medieval_windownew"
name = "medieval window"
Expand Down Expand Up @@ -1060,3 +1103,53 @@
//player-constructed windows
if (constructed)
state = FALSE


/obj/structure/window/classic/medieval
icon_state = "medieval_glass0"
name = "window"
desc = "A window set inside a wall."
maximal_heat = T0C + 1600
damage_per_fire_tick = 1.0
health = 200
flammable = FALSE
var/base_icon_state = "medieval_glass"
var/adjusts = TRUE
mergewith = list(/obj/structure/window/classic/medieval,/obj/structure/window_frame/medieval,/obj/covers/wood_wall/medieval)
/obj/structure/window/classic/medieval/check_relatives(var/update_self = FALSE, var/update_others = FALSE)
if (!adjusts)
return
var/junction
if (update_self)
junction = FALSE
for (var/checkdir in cardinal)
var/turf/T = get_step(src, checkdir)
for(var/atom/CV in T)
if (!can_join_with(CV))
continue
if (update_self)
if (can_join_with(CV))
junction |= get_dir(src,CV)
if (update_others)
CV.check_relatives(1,0)
if (!isnull(junction))
icon_state = "[base_icon_state][junction]"
return

/obj/structure/window/classic/medieval/can_join_with(var/atom/W)
if (istype(W,src))
return TRUE
for (var/i in mergewith)
if (istype(W,i))
return TRUE
return FALSE
/obj/structure/window/classic/medieval/update_icon()
..()
check_relatives(1,1)
/obj/structure/window/classic/medieval/New()
..()
check_relatives(1,1)

/obj/structure/window/classic/medieval/Destroy()
check_relatives(0,1)
..()
27 changes: 22 additions & 5 deletions code/modules/1713/production.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2182,7 +2182,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/obj/structure/sawmill
name = "Primitive Saw Mill"
desc = "A small saw mill, used to cut logs into planks."
desc = "A small saw mill, used to cut logs into planks. This crude machine only produces 1 plank per log."
icon = 'icons/obj/plankage.dmi'
icon_state = "primitive_sawmill"
anchored = TRUE
Expand All @@ -2195,6 +2195,13 @@
var/tmp/mob/living/human/current_user = null
var/tmp/work_time_amount = 0

/obj/structure/sawmill/large
name = "Large Saw Mill"
desc = "A large saw mill, used to cut logs into planks. This one produces 2 planks per log."
icon = 'icons/obj/plankage_64.dmi'
icon_state = "sawmill"
bound_width = 64
bound_height = 32
/obj/structure/sawmill/proc/finish_work()
if (current_work)
current_user.visible_message(
Expand Down Expand Up @@ -2228,20 +2235,30 @@
if (current_work)
H << "<span class='warning'>\The [src.name] is busy, wait for the saw blade to finish cutting.</span>"
return
current_work = new P(null, W.amount * 2, FALSE) //in fact for information purpose only we really need new object
if (istype(src, /obj/structure/sawmill/large))
current_work = new P(null, W.amount * 2, FALSE) //in fact for information purpose only we really need new object
icon = 'icons/obj/plankage_64.dmi'
icon_state = "sawmill1"
work_time_amount = round(10000/(W.amount*3+47)) //The efficiency increases with the amount of material. For 1 material we get 20 deciseconds, for 50 material - 254 deciseconds.
else
current_work = new P(null, W.amount, FALSE) //in fact for information purpose only we really need new object
icon_state = "primitive_sawmill1"
work_time_amount = round(20000/(W.amount*3+47)) //The efficiency increases with the amount of material. For 1 material we get 20 deciseconds, for 50 material - 254 deciseconds.
current_material = W
current_user = H
H.visible_message(
"<span class='notice'>You can see how [H.name] began to cut [W.name] on \a [src.name].</span>",
"<span class='notice'>You start to produce \the [current_work.name].</span>",
"<span class='notice'>You hear someone begin to cut on \the [src.name].</span>")
icon_state = "primitive_sawmill1"
work_time_amount = round(10000/(W.amount*3+47)) //The efficiency increases with the amount of material. For 1 material we get 20 deciseconds, for 50 material - 254 deciseconds.
work_time_amount = work_time_amount*(0.67/H.getStatCoeff("crafting") + 0.33/H.getStatCoeff("dexterity"))
if (do_after(H, work_time_amount, src.loc))
playsound(loc, 'sound/effects/woodfile.ogg', 100, TRUE)
finish_work()
else
icon_state = "primitive_sawmill"
if (istype(src, /obj/structure/sawmill/large))
icon_state = "sawmill"
else
icon_state = "primitive_sawmill"
//20% - with no penalty, 30% - little mood decreasing, 25% - mood decreasing,
//15% - to lose some material and mood decreasing, 10% to lose all material and great mood decreasing
switch (rand(1,100)) //here are another algorithm because we don't know how much work was really done
Expand Down
31 changes: 11 additions & 20 deletions code/modules/1713/structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,9 @@
opacity = FALSE

/obj/structure/wallframe/attackby(obj/item/W as obj, var/mob/living/human/H)
if(istype(W, /obj/item/stack/material/woodplank))
if(istype(W, /obj/item/stack/material/clay))
var/input
var/display = list("Medieval Window - 4", "Medieval Wall - 6", "Medieval Crossbraced Wall (X) - 6", "Medieval Braced Wall (\\) - 6", "Medieval Braced Wall (/) - 6", "Cancel")
var/display = list("Medieval Window - 4", "Medieval Wall - 6","Cancel")
input = WWinput(H, "What wall would you like to make?", "Building", "Cancel", display)
playsound(src.loc,'sound/items/ratchet.ogg',40) //rip_pack.ogg
if (input == "Cancel")
Expand All @@ -1334,24 +1334,6 @@
new/obj/covers/wood_wall/medieval(src.loc)
qdel(src)
W.amount -= 6
else if(input == "Medieval Crossbraced Wall (X) - 6")
if(W.amount >= 6)
if (do_after(H, 43, src))
new/obj/covers/wood_wall/medieval/x(src.loc)
qdel(src)
W.amount -= 6
else if(input == "Medieval Braced Wall (\\) - 6")
if(W.amount >= 6)
if (do_after(H, 42, src))
new/obj/covers/wood_wall/medieval/y/r(src.loc)
qdel(src)
W.amount -= 6
else if(input == "Medieval Braced Wall (/) - 6")
if(W.amount >= 6)
if (do_after(H, 42, src))
new/obj/covers/wood_wall/medieval/y/l(src.loc)
qdel(src)
W.amount -= 6
else
H << "<span class='notice'>That does not exist!</span>"
else if(istype(W, /obj/item/weapon/paper))
Expand Down Expand Up @@ -1416,6 +1398,15 @@
W.amount -= 2
else
H << "<span class='notice'>That does not exist!</span>"
else if(istype(W, /obj/item/stack/material/woodplank))
playsound(loc, 'sound/effects/woodfile.ogg', 100, TRUE) //rip_pack.ogg
if(W.amount >= 10)
if (do_after(H, 40, src))
new/obj/covers/wood_wall/adjustable(src.loc)
qdel(src)
W.amount -= 10
else
H << "<span class='notice'>You need 10 planks to build the wall!</span>"

/* Bamboo Wall-Frame*/

Expand Down
3 changes: 2 additions & 1 deletion config/crafting/material_recipes_global.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,8 @@ RECIPE: /material/wood/soft/,oil well,/obj/structure/oilwell,40,270,1,1,economy
RECIPE: /material/wood/soft/,oil deposit,/obj/structure/oil_deposits,6,100,1,1,economy & production,105,0,0,8,null
RECIPE: /material/wood/soft/,gunsmithing bench,/obj/structure/gunbench,13,180,1,1,economy & production,118,0,0,8,null
RECIPE: /material/wood/soft/,ethanol distillery,/obj/structure/distillery,15,180,1,1,economy & production,45,0,0,8,null
RECIPE: /material/wood/,primitive saw mill,/obj/structure/sawmill,28,60,1,1,none,15,0,0,8,null
RECIPE: /material/wood/,primitive saw mill,/obj/structure/sawmill,28,60,1,1,economy & production,15,0,0,8,null
RECIPE: /material/wood/soft,large saw mill,/obj/structure/sawmill/large,100,60,1,1,economy & production,45,0,0,8,null


RECIPE: /material/wood/soft/,market stall,/obj/structure/vending/sales/market_stall,25,150,1,1,economy & production,24,0,0,8,null
Expand Down
Binary file added icons/obj/plankage_64.dmi
Binary file not shown.
Binary file modified icons/obj/structures.dmi
Binary file not shown.
Binary file modified icons/obj/windows.dmi
Binary file not shown.
Binary file modified icons/turf/walls.dmi
Binary file not shown.

0 comments on commit 50e7fd5

Please sign in to comment.