-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: More knives for martial art & shields penetration (#4220)
- Loading branch information
1 parent
96c9ed9
commit 69a9fe8
Showing
15 changed files
with
195 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Sharpening component | ||
* | ||
* Makes an item sharpenable with a whetstone | ||
* | ||
*/ | ||
/datum/component/sharpening | ||
dupe_mode = COMPONENT_DUPE_UNIQUE | ||
var/damage_increase | ||
|
||
/datum/component/sharpening/Initialize(damage_increase = 0) | ||
if(!isitem(parent)) | ||
return COMPONENT_INCOMPATIBLE | ||
src.damage_increase = damage_increase | ||
|
||
/datum/component/sharpening/RegisterWithParent() | ||
RegisterSignal(parent, COMSIG_ITEM_SHARPEN_ACT, PROC_REF(on_sharpen)) | ||
|
||
/datum/component/sharpening/UnregisterFromParent() | ||
UnregisterSignal(parent, list(COMSIG_ITEM_SHARPEN_ACT)) | ||
|
||
/datum/component/sharpening/proc/on_sharpen(obj/item/item, amount, max_amount) | ||
SIGNAL_HANDLER | ||
|
||
if(!item || HAS_TRAIT(item, TRAIT_WIELDED)) | ||
return COMPONENT_BLOCK_SHARPEN_BLOCKED | ||
|
||
if(amount <= damage_increase) | ||
return COMPONENT_BLOCK_SHARPEN_ALREADY | ||
// Already sharpened items can only be sharpened with the best whetstone on the difference between them | ||
amount -= damage_increase | ||
|
||
var/force = item.force | ||
var/datum/component/two_handed/TH_component = item.GetComponent(/datum/component/two_handed) | ||
if(TH_component) | ||
force = TH_component.force_wielded | ||
|
||
var/obj/item/clothing/gloves/color/black/razorgloves/razorgloves = item | ||
if(istype(razorgloves)) | ||
force = razorgloves.razor_damage_high | ||
|
||
if(force >= max_amount || item.throwforce >= max_amount || item.flags & NOSHARPENING) | ||
return COMPONENT_BLOCK_SHARPEN_MAXED | ||
|
||
damage_increase = min(damage_increase + amount, (max_amount - force)) | ||
item.sharpen_act(damage_increase) | ||
|
||
return COMPONENT_BLOCK_SHARPEN_APPLIED |
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
Oops, something went wrong.