Skip to content

Commit

Permalink
Gun skins (#470)
Browse files Browse the repository at this point in the history
* skinnss

* honk

* meh

* fix i guess

* AAAAAAA

* premium

---------

Co-authored-by: Helg2 <[email protected]>
  • Loading branch information
homexp13 and Helg2 authored Oct 18, 2024
1 parent 26b8fd3 commit cba5903
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 11 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@
#define COMSIG_OBJ_HIDE "obj_hide"
#define COMSIG_OBJ_ATTACK_ALIEN "obj_attack_alien" //from obj/attack_alien(): (/mob/living/carbon/xenomorph)
#define COMPONENT_NO_ATTACK_ALIEN (1<<0)
/// from /obj/obj_reskin: (mob/user, skin)
#define COMSIG_OBJ_RESKIN "obj_reskin"

#define COMSIG_MACHINERY_POWERED "machinery_powered" /// from /obj/machinery/proc/powered: ()
#define COMPONENT_POWERED (1<<0)
Expand Down
3 changes: 3 additions & 0 deletions code/datums/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ GLOBAL_PROTECT(exp_specialmap)
else
equip_role_outfit(job)

if(SSdiscord.get_boosty_tier(player.ckey) >= BOOSTY_TIER_2)
equip_to_slot_or_del(new /obj/item/facepaint/premium, SLOT_IN_BACKPACK)

if((job.job_flags & JOB_FLAG_ALLOWS_PREFS_GEAR) && player)
equip_preference_gear(player)

Expand Down
8 changes: 8 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ GLOBAL_DATUM_INIT(welding_sparks_prepdoor, /mutable_appearance, mutable_appearan
var/current_variant
///Current hair concealing option selected.
var/current_hair_concealment
/// Has the item been reskinned?
var/current_skin
///List of options to reskin.
var/list/unique_reskin

/obj/item/Initialize(mapload)

Expand Down Expand Up @@ -253,6 +257,10 @@ GLOBAL_DATUM_INIT(welding_sparks_prepdoor, /mutable_appearance, mutable_appearan
/obj/item/attackby(obj/item/I, mob/user, params)
. = ..()

if(istype(I, /obj/item/facepaint/premium) && unique_reskin && !current_skin)
reskin_obj(I, user)
return

if(istype(I, /obj/item/facepaint) && colorable_allowed != NONE)
color_item(I, user)
return
Expand Down
6 changes: 6 additions & 0 deletions code/game/objects/items/cosmetics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
colour = "full"
icon_state = "full_camo"

/obj/item/facepaint/premium
name = "Premium customization kit"
desc = "A kit designed for customizing weapon. Comes with rainbow paint!"
colour = "rainbow"
icon_state = "rainbow_camo"
uses = 1

/obj/item/facepaint/attack(mob/M as mob, mob/user as mob)
if(!ismob(M)) return
Expand Down
52 changes: 52 additions & 0 deletions code/game/objects/items_reskin.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Reskins object based on a user's choice
*
* Arguments:
* * user The mob choosing a reskin option
*/
/obj/item/proc/reskin_obj(obj/item/facepaint/paint, mob/user)
if(!LAZYLEN(unique_reskin))
return

var/list/items = list()
for(var/reskin_option in unique_reskin)
var/image/item_image = image(icon = src.icon, icon_state = unique_reskin[reskin_option])
items += list("[reskin_option]" = item_image)
sort_list(items)

var/pick = show_radial_menu(user, src, items, custom_check = CALLBACK(src, PROC_REF(check_reskin_menu), user), radius = 38, require_near = TRUE)
if(!pick)
return
if(!unique_reskin[pick])
return
current_skin = unique_reskin[pick]
icon_state = unique_reskin[pick]
//this may not be the right way to do it but..
if(base_icon_state)
base_icon_state = unique_reskin[pick]
to_chat(user, "[src] is now skinned as '[pick].'")
SEND_SIGNAL(src, COMSIG_OBJ_RESKIN, user, pick)
//correctly display item in hands
update_icon()
if(paint)
user.temporarilyRemoveItemFromInventory(paint)
user.update_inv_l_hand(0)
user.update_inv_r_hand()
qdel(paint)

/**
* Checks if we are allowed to interact with a radial menu for reskins
*
* Arguments:
* * user The mob interacting with the menu
*/
/obj/item/proc/check_reskin_menu(mob/user)
if(QDELETED(src))
return FALSE
if(current_skin)
return FALSE
if(!istype(user))
return FALSE
if(user.incapacitated())
return FALSE
return TRUE
3 changes: 2 additions & 1 deletion code/game/objects/machinery/vending/marine_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,8 @@
/obj/item/toy/deck/kotahi = -1,
/obj/item/deployable_floodlight = -1,
/obj/item/fulton_extraction_pack = -1,
),
/obj/item/facepaint/premium = -1,
)
)

/obj/machinery/vending/cigarette
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/login.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
mind_initialize() //updates the mind (or creates and initializes one if one doesn't exist)
mind.active = 1 //indicates that the mind is currently synced with a client

INVOKE_ASYNC(SSdiscord, TYPE_PROC_REF(/datum/controller/subsystem/discord, get_boosty_tier), ckey)

var/turf/T = get_turf(src)
if (isturf(T))
update_z(T.z)
Expand Down
19 changes: 10 additions & 9 deletions code/modules/projectiles/gun_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -518,16 +518,17 @@

/obj/item/weapon/gun/update_icon_state()
. = ..()
var/real_icon = current_skin ? current_skin : base_gun_icon
if(CHECK_BITFIELD(reciever_flags, AMMO_RECIEVER_TOGGLES_OPEN) && !CHECK_BITFIELD(reciever_flags, AMMO_RECIEVER_CLOSED))
icon_state = !greyscale_config ? base_gun_icon + "_o" : GUN_ICONSTATE_OPEN
icon_state = !greyscale_config ? real_icon + "_o" : GUN_ICONSTATE_OPEN
else if(CHECK_BITFIELD(reciever_flags, AMMO_RECIEVER_REQUIRES_UNIQUE_ACTION) && !in_chamber && length(chamber_items))
icon_state = !greyscale_config ? base_gun_icon + "_u" : GUN_ICONSTATE_UNRACKED
icon_state = !greyscale_config ? real_icon + "_u" : GUN_ICONSTATE_UNRACKED
else if((!length(chamber_items) && max_chamber_items) || (!rounds && !max_chamber_items))
icon_state = !greyscale_config ? base_gun_icon + "_e" : GUN_ICONSTATE_UNLOADED
icon_state = !greyscale_config ? real_icon + "_e" : GUN_ICONSTATE_UNLOADED
else if(current_chamber_position <= length(chamber_items) && chamber_items[current_chamber_position] && chamber_items[current_chamber_position].loc != src)
icon_state = base_gun_icon + "_l"
icon_state = real_icon + "_l"
else
icon_state = !greyscale_config ? base_gun_icon : GUN_ICONSTATE_LOADED
icon_state = !greyscale_config ? real_icon : GUN_ICONSTATE_LOADED

/obj/item/weapon/gun/color_item(obj/item/facepaint/paint, mob/user)
. = ..()
Expand Down Expand Up @@ -559,14 +560,14 @@

/obj/item/weapon/gun/update_item_state()
var/current_state = item_state
var/real_icon = current_skin ? current_skin : initial(icon_state)
if(flags_gun_features & GUN_SHOWS_AMMO_REMAINING) //shows different ammo levels
var/remaining_rounds = (rounds <= 0) ? 0 : CEILING((rounds / max((length(chamber_items) ? max_rounds : max_shells ? max_shells : 1), 1)) * 100, 25)
item_state = "[initial(icon_state)]_[remaining_rounds][flags_item & WIELDED ? "_w" : ""]"
item_state = "[real_icon]_[remaining_rounds][flags_item & WIELDED ? "_w" : ""]"
else if(flags_gun_features & GUN_SHOWS_LOADED) //shows loaded or unloaded
item_state = "[initial(icon_state)]_[rounds ? 100 : 0][flags_item & WIELDED ? "_w" : ""]"
item_state = "[real_icon]_[rounds ? 100 : 0][flags_item & WIELDED ? "_w" : ""]"
else
item_state = "[base_gun_icon][flags_item & WIELDED ? "_w" : ""]"
return
item_state = "[current_skin ? current_skin : base_gun_icon][flags_item & WIELDED ? "_w" : ""]"

if(current_state != item_state && ishuman(gun_user))
var/mob/living/carbon/human/human_user = gun_user
Expand Down
3 changes: 3 additions & 0 deletions code/modules/projectiles/guns/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@
fire_sound = 'sound/weapons/guns/fire/Laser Rifle Standard.ogg'
icon_state = "ter"
item_state = "ter"
unique_reskin = list(
"Red" = "ter_red",
)
max_shots = 60
ammo_datum_type = /datum/ammo/energy/lasgun/marine
rounds_per_shot = 10
Expand Down
3 changes: 3 additions & 0 deletions code/modules/projectiles/guns/rifles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,9 @@
icon = 'icons/Marine/gun64.dmi'
icon_state = "type71"
item_state = "type71"
unique_reskin = list(
"Wood" = "type71_wood",
)
muzzleflash_iconstate = "muzzle_flash_medium"
caliber = CALIBER_762X39 //codex
max_shells = 42 //codex
Expand Down
4 changes: 4 additions & 0 deletions code/modules/projectiles/guns/shotguns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ RU TGMC EDIT */
icon = 'icons/Marine/gun64.dmi'
icon_state = "leicrepeater"
item_state = "leicrepeater"
unique_reskin = list(
"Raven repeater" = "raven_repeater",
"Red" = "leicrepeater_red",
)
fire_sound = 'sound/weapons/guns/fire/tgmc/kinetic/gun_repeater.ogg'
dry_fire_sound = 'sound/weapons/guns/fire/sniper_empty.ogg'
reload_sound = 'sound/weapons/guns/interact/mosin_reload.ogg'
Expand Down
5 changes: 4 additions & 1 deletion code/modules/projectiles/guns/specialist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,14 @@ Note that this means that snipers will have a slowdown of 3, due to the scope
slot_l_hand_str = 'icons/mob/items_lefthand_64.dmi',
slot_r_hand_str = 'icons/mob/items_righthand_64.dmi',
)

unique_reskin = list(
"Red" = "svd_red",
)
inhand_x_dimension = 64
inhand_y_dimension = 32
icon_state = "svd"
item_state = "svd"

max_shells = 10 //codex
caliber = CALIBER_762X54 //codex
fire_sound = "svd_fire"
Expand Down
Binary file modified icons/Marine/gun64.dmi
Binary file not shown.
Binary file modified icons/mob/human_face.dmi
Binary file not shown.
Binary file modified icons/mob/items_lefthand_1.dmi
Binary file not shown.
Binary file modified icons/mob/items_lefthand_64.dmi
Binary file not shown.
Binary file modified icons/mob/items_righthand_1.dmi
Binary file not shown.
Binary file modified icons/mob/items_righthand_64.dmi
Binary file not shown.
Binary file modified icons/obj/items/cosmetics.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions tgmc.dme
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@
#include "code\game\objects\empulse.dm"
#include "code\game\objects\explosion_recursive.dm"
#include "code\game\objects\items.dm"
#include "code\game\objects\items_reskin.dm"
#include "code\game\objects\machinery.dm"
#include "code\game\objects\obj_defense.dm"
#include "code\game\objects\objs.dm"
Expand Down

0 comments on commit cba5903

Please sign in to comment.