-
Notifications
You must be signed in to change notification settings - Fork 223
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
1 parent
b4d74cb
commit 688ef32
Showing
39 changed files
with
941 additions
and
24 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
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
File renamed without changes.
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,8 @@ | ||
// Stub for forging. TODO barrel crafting. | ||
/obj/item/barrel_rim | ||
name = "barrel rim" | ||
desc = "A circular brace used to hold a barrel together." | ||
icon_state = ICON_STATE_WORLD | ||
icon = 'icons/obj/items/barrel_rim.dmi' | ||
material = /decl/material/solid/metal/iron | ||
material_alteration = MAT_FLAG_ALTERATION_ALL |
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,8 @@ | ||
// Stub for forging. TODO shield crafting. | ||
/obj/item/shield_fasteners | ||
name = "shield fasteners" | ||
desc = "A handful of shaped fasteners used to hold a buckler or shield together." | ||
icon_state = ICON_STATE_WORLD | ||
icon = 'icons/obj/items/shield_fasteners.dmi' | ||
material = /decl/material/solid/metal/iron | ||
material_alteration = MAT_FLAG_ALTERATION_ALL |
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
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,82 @@ | ||
/obj/structure/anvil | ||
name = "anvil" | ||
desc = "A heavy block of material used as support for hammering things into shape." | ||
icon = 'icons/obj/structures/anvil.dmi' | ||
icon_state = ICON_STATE_WORLD | ||
anchored = TRUE | ||
density = TRUE | ||
opacity = FALSE | ||
atom_flags = ATOM_FLAG_CLIMBABLE | ||
w_class = ITEM_SIZE_STRUCTURE //_LARGE | ||
material = /decl/material/solid/metal/iron | ||
max_health = 1000 | ||
structure_flags = STRUCTURE_FLAG_SURFACE | ||
material_alteration = MAT_FLAG_ALTERATION_ALL | ||
|
||
/obj/structure/anvil/on_update_icon() | ||
. = ..() | ||
icon_state = initial(icon_state) | ||
switch(get_health_percent()) | ||
if(0 to 0.35) | ||
icon_state = "[icon_state]-damage-heavy" | ||
if(0.35 to 0.65) | ||
icon_state = "[icon_state]-damage-light" | ||
|
||
/obj/structure/anvil/attackby(obj/item/used_item, mob/user, click_params) | ||
|
||
// Put the hammer on the forge. | ||
if(!user.check_intent(I_FLAG_HARM) && istype(used_item, /obj/item/tool/hammer/forge)) | ||
if(user.try_unequip(used_item, get_turf(src))) | ||
auto_align(used_item, click_params) | ||
return TRUE | ||
|
||
// Put the bar onto the anvil (need to do this to avoid repairs in ..()) | ||
if(istype(used_item, /obj/item/stack/material/bar)) | ||
var/obj/item/stack/material/bar/bar = used_item | ||
if(used_item.material != material || current_health >= get_max_health()) | ||
if(bar.get_amount() > 1) | ||
bar = bar.split(1) | ||
if(bar.loc == user) | ||
user.try_unequip(bar, get_turf(src)) | ||
else | ||
bar.dropInto(get_turf(src)) | ||
auto_align(bar, click_params) | ||
return TRUE | ||
|
||
// Place a partially worked billet onto the anvil. | ||
if(istype(used_item, /obj/item/billet)) | ||
if(used_item.loc == user) | ||
user.try_unequip(used_item, get_turf(src)) | ||
else | ||
used_item.dropInto(get_turf(src)) | ||
auto_align(used_item, click_params) | ||
return TRUE | ||
|
||
// Put the bar from tongs onto the anvil. | ||
if(istype(used_item, /obj/item/tongs)) | ||
var/obj/item/tongs/tongs = used_item | ||
if(tongs.holding_bar) | ||
return attackby(tongs.holding_bar, user) | ||
|
||
. = ..() | ||
|
||
// Chipped out of a boulder with a pick. | ||
/obj/structure/anvil/boulder | ||
name_prefix = "crude" | ||
icon = 'icons/obj/structures/anvil_crude.dmi' | ||
desc = "A crude anvil chipped out of a chunk of stone. It probably won't last very long." | ||
material = /decl/material/solid/stone/granite | ||
max_health = 500 | ||
|
||
/obj/structure/anvil/boulder/Initialize(ml, _mat, _reinf_mat) | ||
. = ..() | ||
if(prob(50)) | ||
set_icon('icons/obj/structures/anvil_crude_alt.dmi') | ||
|
||
// Improvised with spaceman materials. | ||
/obj/structure/anvil/improvised | ||
name_prefix = "improvised" | ||
icon = 'icons/obj/structures/anvil_improvised.dmi' | ||
desc = "A anvil roughly improvised out of scrap metal. It probably won't last very long." | ||
material = /decl/material/solid/metal/steel | ||
max_health = 500 |
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,62 @@ | ||
/obj/item/stack/material/bar/get_thermal_mass_coefficient() | ||
return hot_enough_to_forge() ? 0.1 : ..() | ||
|
||
// Also copied from billets. | ||
/obj/item/stack/material/bar/ProcessAtomTemperature() | ||
. = ..() | ||
if(get_amount() == 1 && istype(material) && material.forgable) | ||
// We have no real way to find temperature bounds without a material that has a melting point. | ||
if(!istype(material) || isnull(material.melting_point) || QDELETED(src)) | ||
return | ||
var/temperature_percentage | ||
if(temperature >= material.melting_point) // We should have melted... | ||
temperature_percentage = 1 | ||
else if(temperature <= T20C) // Arbitrary point for the sake of not trying to find a proportional temperature delta with ice | ||
temperature_percentage = 0 | ||
else | ||
temperature_percentage = (material.melting_point - T20C) / (temperature - T20C) | ||
if(temperature_percentage < 0.25) | ||
set_light(0, 0) | ||
else | ||
animate_heat_glow(temperature, scale_sub = round((material.melting_point - T20C) * 0.25) + T20C, scale_div = round(material.melting_point * 0.75), scale_max = material.melting_point, skip_filter = TRUE) | ||
else | ||
set_light(0, 0) | ||
if(istype(loc, /obj/item/tongs)) | ||
loc.update_icon() | ||
|
||
// Copied from billets. | ||
/obj/item/stack/material/bar/proc/hot_enough_to_forge() | ||
if(!istype(material) || isnull(material.melting_point) || !material.forgable) | ||
return FALSE | ||
// Needs to be halfway to melting to count as forgable. | ||
return temperature >= ((material.melting_point - T20C) * 0.5) + T20C | ||
|
||
// Some bar overrides to allow for the raw form, before they become billets. | ||
/obj/item/stack/material/bar/attackby(obj/item/used_item, mob/user) | ||
// Turn this into a billet for step 1 of forging. | ||
if(isturf(loc) && get_amount() == 1) | ||
|
||
// Picking up in tongs. | ||
if(istype(used_item, /obj/item/tongs)) | ||
var/obj/item/tongs/tongs = used_item | ||
if(!tongs.holding_bar) | ||
forceMove(tongs) | ||
tongs.holding_bar = src | ||
tongs.update_icon() | ||
return TRUE | ||
|
||
// Hammering into a billet. | ||
if(istype(used_item, /obj/item/tool/hammer/forge) && (locate(/obj/structure/anvil) in loc) && material?.forgable) | ||
var/obj/item/billet/billet = new(get_turf(src), material?.type) | ||
billet.matter = matter?.Copy() // Avoid creating or losing matter via reshaping. | ||
billet.pixel_x = pixel_x | ||
billet.pixel_y = pixel_y | ||
billet.pixel_w = pixel_w | ||
billet.pixel_z = pixel_z | ||
billet.temperature = temperature | ||
if(paint_color) | ||
billet.paint_color = paint_color | ||
billet.update_icon() | ||
qdel(src) | ||
return billet.attackby(used_item, user) | ||
. = ..() |
Oops, something went wrong.