-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4593 from MistakeNot4892/feature/gemstones
Adding gemstones.
- Loading branch information
Showing
21 changed files
with
303 additions
and
71 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
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,89 @@ | ||
var/global/list/_available_gemstone_cuts | ||
|
||
/proc/get_available_gemstone_cuts() | ||
if(!global._available_gemstone_cuts) | ||
global._available_gemstone_cuts = list() | ||
for(var/decl/gemstone_cut/cut as anything in decls_repository.get_decls_of_type_unassociated(/decl/gemstone_cut)) | ||
if(cut.can_be_cut) | ||
global._available_gemstone_cuts += cut | ||
return global._available_gemstone_cuts | ||
|
||
/obj/item/gemstone | ||
name = "uncut gemstone" | ||
desc = "A hunk of uncut gemstone." | ||
icon = 'icons/obj/items/gemstones/uncut.dmi' | ||
w_class = ITEM_SIZE_TINY | ||
material = /decl/material/solid/gemstone/diamond | ||
material_alteration = MAT_FLAG_ALTERATION_COLOR // Name and desc are handled manually. | ||
var/decl/gemstone_cut/cut = /decl/gemstone_cut/uncut | ||
var/work_skill = SKILL_CONSTRUCTION | ||
|
||
/obj/item/gemstone/Initialize(ml, material_key) | ||
cut = GET_DECL(cut) | ||
. = ..() | ||
update_from_cut() | ||
|
||
/obj/item/gemstone/proc/update_from_cut() | ||
icon = cut.icon | ||
desc = cut.desc | ||
update_name() | ||
update_icon() | ||
|
||
/obj/item/gemstone/update_name() | ||
SetName("[cut.adjective] [material.solid_name]") | ||
|
||
/obj/item/gemstone/get_single_monetary_worth() | ||
. = ..() * cut.worth_multiplier | ||
|
||
/obj/item/gemstone/attackby(obj/item/used_item, mob/user) | ||
if(IS_HAMMER(used_item) && !user.check_intent(I_FLAG_HARM)) // TOOL_CHISEL when? | ||
if(!cut.can_attempt_cut) | ||
to_chat(user, SPAN_WARNING("\The [src] has already been cut.")) | ||
return TRUE | ||
var/decl/gemstone_cut/desired_cut = input(user, "What cut would you like to attempt?", "Cut Gemstone") as null|anything in get_available_gemstone_cuts() | ||
if(!desired_cut || QDELETED(src) || QDELETED(user) || !CanPhysicallyInteract(user) || !cut.can_attempt_cut) | ||
return TRUE | ||
user.visible_message(SPAN_NOTICE("\The [user] begins carefully cutting \the [src].")) | ||
if(!user.do_skilled(10 SECONDS, work_skill, src, check_holding = TRUE) || !CanPhysicallyInteract(user)) | ||
if(QDELETED(src) || !cut.can_attempt_cut || QDELETED(user)) | ||
return TRUE | ||
to_chat(user, SPAN_DANGER("You were interrupted, botching the cut!")) | ||
cut = GET_DECL(/decl/gemstone_cut/poor) | ||
else | ||
if(QDELETED(src) || !cut.can_attempt_cut || QDELETED(user)) | ||
return TRUE | ||
user.visible_message(SPAN_NOTICE("\The [user] finishes cutting \the [src].")) | ||
if(user.skill_fail_prob(work_skill, 100, SKILL_EXPERT)) | ||
to_chat(user, SPAN_DANGER("You've done a really poor job...")) | ||
cut = GET_DECL(/decl/gemstone_cut/poor) | ||
else | ||
cut = desired_cut | ||
update_from_cut() | ||
return TRUE | ||
. = ..() | ||
|
||
// Subtypes for mapping/spawning etc. | ||
/obj/item/gemstone/poor | ||
name = "poorly-cut diamond" | ||
cut = /decl/gemstone_cut/poor | ||
icon = 'icons/obj/items/gemstones/poor.dmi' | ||
|
||
/obj/item/gemstone/baguette | ||
name = "baguette-cut diamond" | ||
cut = /decl/gemstone_cut/baguette | ||
icon = 'icons/obj/items/gemstones/baguette.dmi' | ||
|
||
/obj/item/gemstone/hexagon | ||
name = "hexagon-cut diamond" | ||
cut = /decl/gemstone_cut/hexagon | ||
icon = 'icons/obj/items/gemstones/hexagon.dmi' | ||
|
||
/obj/item/gemstone/octagon | ||
name = "octagon-cut diamond" | ||
cut = /decl/gemstone_cut/octagon | ||
icon = 'icons/obj/items/gemstones/octagon.dmi' | ||
|
||
/obj/item/gemstone/round | ||
name = "round-cut diamond" | ||
cut = /decl/gemstone_cut/round | ||
icon = 'icons/obj/items/gemstones/round.dmi' |
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,75 @@ | ||
/decl/gemstone_cut | ||
abstract_type = /decl/gemstone_cut | ||
var/worth_multiplier = 1.5 | ||
var/name | ||
var/desc | ||
var/adjective | ||
var/icon | ||
// Can we cut this cut into a new cut? | ||
var/can_attempt_cut = FALSE | ||
// Can we attempt to cut to this cut? | ||
var/can_be_cut = TRUE | ||
|
||
/decl/gemstone_cut/validate() | ||
. = ..() | ||
if(!istext(name)) | ||
. += "invalid or null name" | ||
if(!istext(desc)) | ||
. += "invalid or null desc" | ||
if(!istext(adjective)) | ||
. += "invalid or null adjective" | ||
if(icon) | ||
if(!check_state_in_icon(ICON_STATE_WORLD, icon)) | ||
. += "missing world state from '[icon]'" | ||
if(!check_state_in_icon(ICON_STATE_INV, icon)) | ||
. += "missing inventory state from '[icon]'" | ||
var/check_state = "[ICON_STATE_WORLD]-set" | ||
if(!check_state_in_icon(check_state, icon)) | ||
. += "missing state '[check_state]' from '[icon]'" | ||
check_state = "[ICON_STATE_INV]-set" | ||
if(!check_state_in_icon(check_state, icon)) | ||
. += "missing state '[check_state]' from '[icon]'" | ||
else | ||
. += "null or unset icon" | ||
|
||
// Subtypes below. | ||
/decl/gemstone_cut/uncut | ||
name = "uncut" | ||
adjective = "uncut" | ||
desc = "A rough, uncut gemstone." | ||
icon = 'icons/obj/items/gemstones/uncut.dmi' | ||
can_attempt_cut = TRUE | ||
can_be_cut = FALSE | ||
worth_multiplier = 1 | ||
|
||
/decl/gemstone_cut/poor | ||
name = "poorly-cut" | ||
adjective = "poorly-cut" | ||
desc = "A poorly-cut and uneven gemstone." | ||
icon = 'icons/obj/items/gemstones/poor.dmi' | ||
worth_multiplier = 0.5 | ||
can_be_cut = FALSE | ||
|
||
/decl/gemstone_cut/baguette | ||
name = "baguette" | ||
adjective = "baguette-cut" | ||
desc = "A square-cut gemstone." | ||
icon = 'icons/obj/items/gemstones/baguette.dmi' | ||
|
||
/decl/gemstone_cut/hexagon | ||
name = "hexagon" | ||
adjective = "hexagon-cut" | ||
desc = "A hexagon-cut gemstone." | ||
icon = 'icons/obj/items/gemstones/hexagon.dmi' | ||
|
||
/decl/gemstone_cut/octagon | ||
name = "octagon" | ||
adjective = "octagon-cut" | ||
desc = "A octagon-cut gemstone." | ||
icon = 'icons/obj/items/gemstones/octagon.dmi' | ||
|
||
/decl/gemstone_cut/round | ||
name = "round" | ||
adjective = "round-cut" | ||
desc = "A round-cut gemstone." | ||
icon = 'icons/obj/items/gemstones/round.dmi' |
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
Oops, something went wrong.