Skip to content

Commit

Permalink
More twearking
Browse files Browse the repository at this point in the history
  • Loading branch information
Superlagg committed Jun 24, 2023
1 parent 3eddd21 commit 4d31c40
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 163 deletions.
27 changes: 18 additions & 9 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,16 @@ GLOBAL_LIST_INIT(main_body_parts, list(

/// Bullet Recoil defines
#define BULLET_RECOIL_BASE (2)
#define BULLET_RECOIL_PISTOL_SMALL (BULLET_RECOIL_BASE * 0.5)
#define BULLET_RECOIL_PISTOL_SMALL (BULLET_RECOIL_BASE * 1)
#define BULLET_RECOIL_PISTOL_MEDIUM (BULLET_RECOIL_BASE * 1)
#define BULLET_RECOIL_PISTOL_LARGE (BULLET_RECOIL_BASE * 2)
#define BULLET_RECOIL_RIFLE_SMALL (BULLET_RECOIL_BASE * 1.5)
#define BULLET_RECOIL_RIFLE_MEDIUM (BULLET_RECOIL_BASE * 3)
#define BULLET_RECOIL_RIFLE_LARGE (BULLET_RECOIL_BASE * 25)
#define BULLET_RECOIL_SHOTGUN (BULLET_RECOIL_BASE * 2)
#define BULLET_RECOIL_GAUSS (BULLET_RECOIL_BASE * 25)
#define BULLET_RECOIL_LASER (BULLET_RECOIL_BASE * 5)
#define BULLET_RECOIL_LASER (BULLET_RECOIL_BASE * 1)
#define BULLET_RECOIL_HEAVY_LASER (BULLET_RECOIL_BASE * 3)
#define BULLET_RECOIL_PLASMA (BULLET_RECOIL_BASE * 5)


Expand Down Expand Up @@ -1137,20 +1138,28 @@ GLOBAL_LIST_INIT(main_body_parts, list(

/////////////////////////////////// 1HANDED , 2HANDED, MOVE RECOIL MULT
#define HANDGUN_RECOIL(x,y) list(1 * x, 0.9 * y, SCOOT_FACTOR(0) , SPRAY_FACTOR(1.2) ) // Mobile, but not spammable
#define AUTOPISTOL_RECOIL(x,y) list(2 * x, 1 * y, SCOOT_FACTOR(0.5) , SPRAY_FACTOR(1) ) // negative numbers actually decrease your output spread while moving!
#define SMG_RECOIL(x,y) list(1.2 * x, 1 * y, SCOOT_FACTOR(0) , SPRAY_FACTOR(0.75)) // made for spraying
#define CARBINE_RECOIL(x,y) list(2 * x, 0.8 * y, SCOOT_FACTOR(0.5) , SPRAY_FACTOR(1) )
#define AUTOCARBINE_RECOIL(x,y) list(3 * x, 0.9 * y, SCOOT_FACTOR(1) , SPRAY_FACTOR(1) )
#define AUTOPISTOL_RECOIL(x,y) list(1.3 * x, 1 * y, SCOOT_FACTOR(0.5) , SPRAY_FACTOR(1) ) // negative numbers actually decrease your output spread while moving!
#define SMG_RECOIL(x,y) list(1 * x, 1 * y, SCOOT_FACTOR(-1) , SPRAY_FACTOR(0.75)) // made for spraying
#define CARBINE_RECOIL(x,y) list(2 * x, 0.8 * y, SCOOT_FACTOR(0.3) , SPRAY_FACTOR(1) )
#define AUTOCARBINE_RECOIL(x,y) list(3 * x, 0.9 * y, SCOOT_FACTOR(0.5) , SPRAY_FACTOR(1) )
#define SHOTGUN_RECOIL(x,y) list(2 * x, 0.5 * y, SCOOT_FACTOR(0) , SPRAY_FACTOR(2) )
#define RIFLE_RECOIL(x,y) list(5 * x, 0.5 * y, SCOOT_FACTOR(2) , SPRAY_FACTOR(2) )
#define AUTORIFLE_RECOIL(x,y) list(5 * x, 0.7 * y, SCOOT_FACTOR(1) , SPRAY_FACTOR(1) )
#define AUTORIFLE_RECOIL(x,y) list(5 * x, 0.7 * y, SCOOT_FACTOR(0.5) , SPRAY_FACTOR(1) )
#define AUTOSHOTGUN_RECOIL(x,y) list(10 * x, 1 * y, SCOOT_FACTOR(-2) , SPRAY_FACTOR(1) )
#define LMG_RECOIL(x,y) list(5 * x, 0.5 * y, SCOOT_FACTOR(10) , SPRAY_FACTOR(-0.3)) // Everyone grab a negev, we rushin B
#define HMG_RECOIL(x,y) list(10 * x, 0.3 * y, SCOOT_FACTOR(20) , SPRAY_FACTOR(-0.5))

#define LASER_HANDGUN_RECOIL_RARE(x,y) list(0.2 * x, 0.1 * y, SCOOT_FACTOR(0) , SPRAY_FACTOR(1.2) ) // Mobile, but not spammable
#define LASER_HANDGUN_RECOIL(x,y) list(1 * x, 1 * y, SCOOT_FACTOR(0) , SPRAY_FACTOR(1.2) ) // Mobile, but not spammable
#define LASER_SMG_RECOIL(x,y) list(1.5 * x, 1 * y, SCOOT_FACTOR(-1) , SPRAY_FACTOR(0.75)) // made for spraying
#define LASER_CARBINE_RECOIL(x,y) list(2 * x, 0.8 * y, SCOOT_FACTOR(0.5) , SPRAY_FACTOR(1) )
#define LASER_RIFLE_RECOIL(x,y) list(2 * x, 0.2 * y, SCOOT_FACTOR(0.5) , SPRAY_FACTOR(1) )
#define LASER_AUTORIFLE_RECOIL(x,y) list(4 * x, 0.5 * y, SCOOT_FACTOR(0.5) , SPRAY_FACTOR(1) )

/// If you dont shoot for this long, your recoil is decreased by an exponential rate
#define RECOIL_SHOOT_TIME 1 SECONDS
#define RECOIL_SHOOT_TIME 0.8 SECONDS
/// If you dont move for this long, your next step won't increase recoil (and your recoil will decrease by an exponential rate)
#define RECOIL_SCOOCH_TIME 1 SECONDS
#define RECOIL_SCOOCH_TIME 0.8 SECONDS
// The number of free tiles you can move in Scoochmode
#define RECOIL_SCOOCH_TILES 2

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SUBSYSTEM_DEF(atoms)
rates += batch_rate
batch_start = REALTIMEOFDAY
this_batch = 0
to_chat(world, span_boldannounce("Init'd [shorten_number(atoms_did, 2)]/[shorten_number(all_atoms, 2)] ([round(batch_percent)]%) atoms in [DisplayTimeText(start_timery - REALTIMEOFDAY)]. \nProjected time left at [shorten_number(batch_rate, 1)]/sec: [DisplayTimeText(batch_time_left)]!"))
to_chat(world, span_boldannounce("Init'd [shorten_number(atoms_did, 2)]/[shorten_number(all_atoms, 2)] ([round(batch_percent)]%) atoms in [DisplayTimeText(REALTIMEOFDAY - start_timery)]. \nProjected time left at [shorten_number(batch_rate, 1)]/sec: [DisplayTimeText(batch_time_left)]!"))
#endif
CHECK_TICK
#ifdef PRINT_ATOM_STATS
Expand Down
28 changes: 16 additions & 12 deletions code/controllers/subsystem/gunreticle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ SUBSYSTEM_DEF(reticle)
. = ..()

/datum/controller/subsystem/reticle/proc/build_reticle_icons()
for(var/offset in 0 to MAX_ACCURACY_OFFSET)
for(var/offset in 0 to SSrecoil.recoil_max_spread*2)
var/true_offset = offset - SSrecoil.recoil_max_spread // -SSrecoil.recoil_max_spread to SSrecoil.recoil_max_spread
var/apparent_offset = max(true_offset, 0) // The negatives just get color differences
var/icon/base = icon('modular_coyote/eris/icons/96x96.dmi')
var/icon/scaled = icon('modular_coyote/eris/icons/standard_grayscale.dmi') //Default cursor, cut into pieces according to their direction
base.Blend(scaled, ICON_OVERLAY, x = 32, y = 32)
Expand All @@ -19,26 +21,28 @@ SUBSYSTEM_DEF(reticle)
var/pixel_y
var/pixel_x
if(dir & NORTH)
pixel_y = CLAMP(offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE)
pixel_y = CLAMP(apparent_offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE)
if(dir & SOUTH)
pixel_y = CLAMP(-offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE)
pixel_y = CLAMP(-apparent_offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE)
if(dir & EAST)
pixel_x = CLAMP(offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE)
pixel_x = CLAMP(apparent_offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE)
if(dir & WEST)
pixel_x = CLAMP(-offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE)
pixel_x = CLAMP(-apparent_offset, -MAX_RETICLE_SIZE, MAX_RETICLE_SIZE)
base.Blend(overlay, ICON_OVERLAY, x=32+pixel_x, y=32+pixel_y)
var/spread_color = gradient("#0000FF", "#FFFF00", (offset/MAX_ACCURACY_OFFSET))
var/spread_color = gradient("#00FF00", "#0000FF", "#FFFF00", (offset/(SSrecoil.recoil_max_spread*2)))
base.Blend(spread_color, ICON_MULTIPLY)
reticle_icons["reticle-[offset]"] = base
reticle_icons["reticle-[round(true_offset)]"] = base
SSassets.transport.register_asset("reticle-[offset]", base)

/datum/controller/subsystem/reticle/proc/find_cursor_icon(offset)
offset = CLAMP(offset, 0, MAX_ACCURACY_OFFSET)
var/my_cursor = LAZYACCESS(reticle_icons, "reticle-[offset]")
if(!my_cursor)
return LAZYACCESS(reticle_icons, "reticle-0")
return LAZYACCESS(reticle_icons, "reticle-[offset]")

/datum/controller/subsystem/reticle/proc/send_all_cursor_icons(client/C)
for(var/icon/reticle in reticle_icons)
C << reticle
for(var/reticle in reticle_icons)
C << LAZYACCESS(reticle_icons, reticle)

/mob/living/proc/update_cursor(obj/item/gun/G)
if(!client)
Expand All @@ -53,8 +57,8 @@ SUBSYSTEM_DEF(reticle)
remove_cursor()
return
//client.mouse_pointer_icon = initial(client.mouse_pointer_icon)
var/recoil = SSrecoil.get_offset(src, G, TRUE)
var/offset = clamp(CEILING(recoil, 1), 0, MAX_ACCURACY_OFFSET)
var/recoil = SSrecoil.get_offset(src, FALSE, TRUE)
var/offset = clamp(round(recoil, 1), -MAX_ACCURACY_OFFSET, MAX_ACCURACY_OFFSET)
var/icon/base = SSreticle.find_cursor_icon(offset)
ASSERT(isicon(base))
client.mouse_pointer_icon = base
Expand Down
Loading

0 comments on commit 4d31c40

Please sign in to comment.