-
-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arbitrary gun attachment system (#6826)
does not currently support projectile modification, that's coming later Includes adding support for attaching maglights to certain guns
- Loading branch information
Showing
35 changed files
with
982 additions
and
99 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
6 changes: 5 additions & 1 deletion
6
code/__DEFINES/dcs/signals/signals_mob/signals_mob_mobility.dm
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,52 @@ | ||
//* This file is explicitly licensed under the MIT license. *// | ||
//* Copyright (c) 2024 Citadel Station Developers *// | ||
|
||
//* gun attachment slot *// | ||
|
||
/** | ||
* * align_x is center pixel (or the left pixel of the 2-wide center, if center is 2 wide) | ||
* * align_y is topmost pixel extending out of gun | ||
*/ | ||
#define GUN_ATTACHMENT_SLOT_GRIP "grip" | ||
/** | ||
* * align_x is leftmost pixel of the part extending out of gun | ||
* * align_y is center pixel (or the bottom pixel of center, if center is 2 wide) | ||
*/ | ||
#define GUN_ATTACHMNET_SLOT_MUZZLE "muzzle" | ||
/** | ||
* * align_x is center pixel (or the left pixel of the 2-wide center, if center is 2 wide) | ||
* * align_y is bottom pixel extending out of gun | ||
*/ | ||
#define GUN_ATTACHMENT_SLOT_RAIL "rail" | ||
/** | ||
* * align_x is leftmost pixel of the part extending out of gun | ||
* * align_y is center pixel (or the bottom pixel of center, if center is 2 wide) | ||
* * this means that for many sidebarrel's, the align_x is actually right of the actual attachment because | ||
* it'll be aligned to the pixel right of the muzzle, not to the interior of the gun! | ||
*/ | ||
#define GUN_ATTACHMENT_SLOT_SIDEBARREL "sidebarrel" | ||
/** | ||
* * align_x is rightmost pixel extending left from the gun | ||
* * align_y is top pixel of the area that actually attaches to the gun | ||
*/ | ||
#define GUN_ATTACHMENT_SLOT_STOCK "stock" | ||
/** | ||
* * align_x is center pixel (or the left pixel of the 2-wide center, if center is 2 wide) | ||
* * align_y is topmost pixel extending out of gun | ||
*/ | ||
#define GUN_ATTACHMENT_SLOT_UNDERBARREL "underbarrel" | ||
|
||
// todo: DEFINE_ENUM | ||
|
||
//* gun attachment types *// | ||
|
||
/// flashlight | ||
#define GUN_ATTACHMENT_TYPE_FLASHLIGHT (1<<0) | ||
/// targeting laser | ||
#define GUN_ATTACHMENT_TYPE_AIM_LASER (1<<1) | ||
/// scope | ||
#define GUN_ATTACHMENT_TYPE_SCOPE (1<<2) | ||
/// magharness, lanyard, etc | ||
#define GUN_ATTACHMENT_TYPE_HARNESS (1<<3) | ||
|
||
// todo: DEFINE_BITFIELD |
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
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
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,25 @@ | ||
//* This file is explicitly licensed under the MIT license. *// | ||
//* Copyright (c) 2024 Citadel Station Developers *// | ||
|
||
/datum/action/attachment_action | ||
target_type = /obj/item/gun_attachment | ||
button_icon_state = null | ||
|
||
/// automatically set button_additional_overlay to the item, if button_icon_state is null | ||
var/render_attachment_as_button = TRUE | ||
|
||
/datum/action/attachment_action/pre_render_hook() | ||
if(render_attachment_as_button && isnull(button_icon_state)) | ||
button_additional_only = TRUE | ||
var/image/generated = new | ||
generated.appearance = target | ||
// i hope you are not doing custom layers and planes for icons, right gamers?? | ||
generated.layer = FLOAT_LAYER | ||
generated.plane = FLOAT_PLANE | ||
button_additional_overlay = generated | ||
return ..() | ||
|
||
/datum/action/attachment_action/calculate_availability() | ||
var/obj/item/item = target | ||
var/mob/worn = item.worn_mob() | ||
return worn? (worn.mobility_flags & check_mobility_flags? 1 : 0) : 1 |
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.