Skip to content

Commit

Permalink
Merge branch 'master' of github.com:goonstation/goonstation
Browse files Browse the repository at this point in the history
  • Loading branch information
pali6 committed Oct 28, 2023
2 parents ff9dee5 + 0a46a10 commit f3a3bef
Show file tree
Hide file tree
Showing 16 changed files with 101 additions and 159 deletions.
7 changes: 5 additions & 2 deletions _std/defines/component_defines/component_defines_special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/// Triggers on destruction of a drone beacon
#define COMSIG_DRONE_BEACON_DESTROYED "drone_beacon_destroyed"

// ---- fullauto signals ----
// ---- gun signals ----

/// Mouse down while shooting full auto
#define COMSIG_FULLAUTO_MOUSEDOWN "fullauto_mousedown"
Expand All @@ -32,7 +32,10 @@
#define COMSIG_FULLAUTO_MOUSEMOVE "fullauto_mousemove"
/// Gun projectile changed while in fullauto mode
#define COMSIG_GUN_PROJECTILE_CHANGED "gun_proj_changed"

/// before ...gun/shoot() - return truthy to cancel shoot() - (target, start, shooter, POX, POY, is_dual_wield, called_target)
#define COMSIG_GUN_TRY_SHOOT "gun_shooty"
/// before ...gun/shoot_point_blank() - return truthy to cancel shoot_point_blank() - (target, user, second_shot)
#define COMSIG_GUN_TRY_POINTBLANK "gun_pointblank"
// ---- small cell stuff ----

// ---- signals ----
Expand Down
2 changes: 1 addition & 1 deletion code/WorkInProgress/HaineWhatever.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ TYPEINFO(/obj/item/gun/bling_blaster)
user.visible_message("<span class='success'><b>[user]</b> blasts some bling at [target]!</span>")

shoot_point_blank(atom/target, mob/user, second_shot)
shoot(get_turf(target), get_turf(user), user, 0, 0)
Shoot(get_turf(target), get_turf(user), user, 0, 0)

attackby(var/obj/item/currency/spacecash/C, mob/user)
if (!istype(C))
Expand Down
5 changes: 5 additions & 0 deletions code/WorkInProgress/actuallyKeelinsStuff.dm
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ Returns:
desc = "someone drew something here"
var/list/arteests = list()

/datum/gunTarget
var/params = null
var/target = null
var/user = 0

/obj/item/permmarker
name = "Permanent Marker"
icon = 'icons/obj/items/items.dmi'
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/fullauto.dm
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ TYPEINFO(/datum/component/holdertargeting/fullauto)

while(!stopping)
if(G.canshoot(L))
G.shoot(target ? target : get_step(L, NORTH), get_turf(L), L, called_target = target)
G.Shoot(target ? target : get_step(L, NORTH), get_turf(L), L, called_target = target)
G.suppress_fire_msg = 1
else
end_shootloop(L)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/smartgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ TYPEINFO(/datum/component/holdertargeting/smartgun)
G.suppress_fire_msg = 1
for(var/atom/A as anything in local_targets)
for(var/i in 1 to local_targets[A])
G.shoot(get_turf(A), get_turf(user), user, called_target = A)
G.Shoot(get_turf(A), get_turf(user), user, called_target = A)
sleep(1 DECI SECOND)

G.suppress_fire_msg = initial(G.suppress_fire_msg)
else
if(!ON_COOLDOWN(G, "shoot_delay", G.shoot_delay))
G.shoot(mouse_target, get_turf(user), user, called_target = mouse_target)
G.Shoot(mouse_target, get_turf(user), user, called_target = mouse_target)
shooting = 0

tracked_targets = list()
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/smartgun_homing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
var/datum/projectile/bullet/homing/homing_projectile = G.current_projectile
homing_projectile.targets = list()
homing_projectile.targets.Add(A)
G.shoot(mouse_target, get_turf(user), user)
G.Shoot(mouse_target, get_turf(user), user)
sleep(G.current_projectile.shot_delay)

G.suppress_fire_msg = initial(G.suppress_fire_msg)
Expand All @@ -22,7 +22,7 @@
if (istype(G.current_projectile, /datum/projectile/bullet/homing))
var/datum/projectile/bullet/homing/homing_projectile = G.current_projectile
homing_projectile.targets = list()
G.shoot(mouse_target, get_turf(user), user)
G.Shoot(mouse_target, get_turf(user), user)
shooting = 0

tracked_targets = list()
Expand Down
67 changes: 53 additions & 14 deletions code/datums/components/windup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ TYPEINFO(/datum/component/holdertargeting/windup)
var/duration
var/interrupt = FALSE
var/datum/action/bar/icon/windup/winder
var/intercept_shoot = TRUE

var/list/atom/movable/screen/fullautoAimHUD/hudSquares = list()
var/client/aimer
Expand Down Expand Up @@ -43,6 +44,8 @@ TYPEINFO(/datum/component/holdertargeting/windup)

RegisterSignal(G, COMSIG_ITEM_SWAP_TO, PROC_REF(init_aim_mode))
RegisterSignal(G, COMSIG_ITEM_SWAP_AWAY, PROC_REF(end_aim_mode))
RegisterSignal(G, COMSIG_GUN_TRY_SHOOT, PROC_REF(forced_shoot))
RegisterSignal(G, COMSIG_GUN_TRY_POINTBLANK, PROC_REF(try_pointblank))
if(ismob(G.loc))
on_pickup(null, G.loc)

Expand Down Expand Up @@ -75,7 +78,7 @@ TYPEINFO(/datum/component/holdertargeting/windup)


/datum/component/holdertargeting/windup/proc/init_aim_mode(datum/source, mob/user)
RegisterSignal(user, COMSIG_FULLAUTO_MOUSEDOWN, PROC_REF(begin_shootloop))
RegisterSignal(user, COMSIG_FULLAUTO_MOUSEDOWN, PROC_REF(on_mousedown))
if(user.client)
aimer = user.client
for(var/x in 1 to (istext(aimer.view) ? WIDE_TILE_WIDTH : SQUARE_TILE_WIDTH))
Expand Down Expand Up @@ -112,9 +115,10 @@ TYPEINFO(/datum/component/holdertargeting/windup)
if(T && T != get_turf(parent))
src.target = T

/datum/component/holdertargeting/windup/proc/begin_shootloop(mob/living/user, object, location, control, params)
/datum/component/holdertargeting/windup/proc/on_mousedown(mob/living/user, object, location, control, params)
src.retarget(user, object, location, control, params)
interrupt = FALSE

if(ishuman(user))
var/mob/living/carbon/human/H = user
if ((aimer.check_key(KEY_THROW)) || H.in_throw_mode)
Expand All @@ -129,6 +133,8 @@ TYPEINFO(/datum/component/holdertargeting/windup)
RegisterSignal(user, COMSIG_FULLAUTO_MOUSEDRAG, PROC_REF(retarget))
RegisterSignal(user, COMSIG_MOB_MOUSEUP, PROC_REF(end_shootloop))
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(moveRetarget))

//add aiming squares to center of screen
for(var/x in ((istext(aimer.view) ? WIDE_TILE_WIDTH : SQUARE_TILE_WIDTH)+1)/2 - 1 to ((istext(aimer.view) ? WIDE_TILE_WIDTH : SQUARE_TILE_WIDTH)+1)/2 + 1)
for(var/y in 7 to 9)
aimer.screen += hudSquares["[x],[y]"]
Expand All @@ -138,18 +144,17 @@ TYPEINFO(/datum/component/holdertargeting/windup)
/datum/component/holdertargeting/windup/proc/do_windup(mob/living/L)
set waitfor = 0
var/obj/item/gun/G = parent
winder = new(G, duration)
winder = new/datum/action/bar/icon/windup/infinite(G, duration, src)
actions.start(winder, L)

/datum/component/holdertargeting/windup/proc/end_shootloop(mob/living/user, object, location, control, params)
if(winder)
if(!interrupt && TIME > winder.started + winder.duration)
if(!interrupt && TIME > winder.started + winder.duration) //if windup has passed full duration
if(params)
var/list/paramlist = params2list(params)
winder.pox = text2num(paramlist["vis-x"] || paramlist["icon-x"]) - 16
winder.poy = text2num(paramlist["vis-x"] || paramlist["icon-y"]) - 16
winder.target_turf = target
winder.user_turf = get_turf(user)
winder.target = src.target
winder.onEnd() //crime, but we don't want to wait for the preocess
else
winder.interrupt(INTERRUPT_ALWAYS)
Expand All @@ -161,38 +166,72 @@ TYPEINFO(/datum/component/holdertargeting/windup)
UnregisterSignal(user, COMSIG_MOB_MOUSEUP)
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)
target = null

//clear aiming squares around center of screen
if(aimer)
for(var/x in ((istext(aimer.view) ? WIDE_TILE_WIDTH : SQUARE_TILE_WIDTH)+1)/2 - 1 to ((istext(aimer.view) ? WIDE_TILE_WIDTH : SQUARE_TILE_WIDTH)+1)/2 + 1)
for(var/y in 7 to 9)
aimer.screen -= hudSquares["[x],[y]"]



//try_shoot - return 1 prevents normal shooting behaviour
/datum/component/holdertargeting/windup/proc/forced_shoot(source, atom/target, atom/start, shooter)
. = 0
if(QDELETED(winder) || winder.state == ACTIONSTATE_DELETE)
. = 1

if(.)
var/obj/item/gun/G = parent
winder = new/datum/action/bar/icon/windup(G, duration)
winder.target = target
actions.start(winder, shooter)


/datum/component/holdertargeting/windup/proc/try_pointblank(obj/source, atom/target, user, second_shot)
. = 0
if(QDELETED(winder) || winder.state == ACTIONSTATE_DELETE)
. = 1

if(.)
var/obj/item/gun/G = parent
winder = new/datum/action/bar/icon/windup(G, duration, TRUE)
winder.target = target
actions.start(winder, user)

/datum/action/bar/icon/windup
duration = 1 SECOND
interrupt_flags = INTERRUPT_ACT | INTERRUPT_STUNNED
interrupt_flags = INTERRUPT_ACT | INTERRUPT_STUNNED | INTERRUPT_ACTION
id = "guncharge"
icon = 'icons/obj/items/tools/screwdriver.dmi'
icon_state = "screwdriver"
var/obj/item/gun/ownerGun
var/time
var/mob/user
var/pox = 0
var/poy = 0
var/user_turf
var/target_turf
var/target
var/do_point_blank = FALSE
resumable = FALSE


New(_gun, _time)
New(_gun, _time, _comp, _do_point_blank = FALSE)
ownerGun = _gun
icon = ownerGun.icon
icon_state = ownerGun.icon_state
duration = _time
do_point_blank = _do_point_blank
..()

onEnd()
if(BOUNDS_DIST(owner, target) <= 1 && do_point_blank)
ownerGun.ShootPointBlank(target, owner)
else
ownerGun.Shoot(get_turf(target), get_turf(ownerGun), owner, pox, poy)
..()

//will not end on its own, so that we can hold a charge
/datum/action/bar/icon/windup/infinite
onStart()
. = ..()
state = ACTIONSTATE_INFINITE

onEnd()
..()
ownerGun.shoot(target_turf, user_turf, owner, pox, poy)
2 changes: 1 addition & 1 deletion code/mob/living/carbon/human/npc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@
jumpy?.ability.handleCast(target)
else
var/obj/item/gun/W = src.r_hand
W.shoot(get_turf(carbon_target), get_turf(src), src, 0, 0, called_target = carbon_target)
W.Shoot(carbon_target, get_turf(src), src, 0, 0, called_target = carbon_target)
if(src.bioHolder.HasEffect("coprolalia") && prob(10))
switch(pick(1,2))
if(1)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mechanics/MechanicMadness.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2925,7 +2925,7 @@ ADMIN_INTERACT_PROCS(/obj/item/mechanics/trigger/button, proc/press)
if(Gun.canshoot(null))
var/atom/target = getTarget()
if(target)
Gun.shoot(get_turf(target), get_turf(src), src, called_target = target)
Gun.Shoot(get_turf(target), get_turf(src), src, called_target = target)
else
src.visible_message("<span class='game say'><span class='name'>[src]</span> beeps, \"The [Gun.name] has no [istype(Gun, /obj/item/gun/energy) ? "charge" : "ammo"] remaining.\"</span>")
playsound(src.loc, 'sound/machines/buzz-two.ogg', 50, 0)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/robotics/bot/guardbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1197,9 +1197,9 @@
var/burst = shotcount // TODO: Make rapidfire exist, then work.
while(burst > 0 && target)
if((BOUNDS_DIST(target_turf, my_turf) == 0))
budgun.shoot_point_blank(target, src)
budgun.ShootPointBlank(target, src)
else
budgun.shoot(target_turf, my_turf, src, called_target = target)
budgun.Shoot(target_turf, my_turf, src, called_target = target)
burst--
if (burst)
sleep(5) // please dont fuck anything up
Expand Down
2 changes: 1 addition & 1 deletion code/modules/tutorials/blob_tutorial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ proc/AddBlobSteps(var/datum/tutorial_base/regional/blob/T)
L.lit = 1

proc/sprayAt(var/turf/T)
L.shoot(T, src.loc, src, called_target = T)
L.Shoot(T, src.loc, src, called_target = T)

disposing()
..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/tutorials/flock_tutorial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
src.set_dir(dir)
gun.ammo.amount_left = 2
var/turf/target = get_step(src, dir)
gun.shoot(target, src.loc, src, called_target = target)
gun.Shoot(target, src.loc, src, called_target = target)
sleep(1.5 SECONDS)

/mob/living/carbon/human/bad_immortal
Expand Down
2 changes: 1 addition & 1 deletion code/obj/grille.dm
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
return
else if (istype(W, /obj/item/gun))
var/obj/item/gun/G = W
G.shoot_point_blank(src, user)
G.ShootPointBlank(src, user)
return
// electrocution check

Expand Down
2 changes: 1 addition & 1 deletion code/obj/item/grab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@
src.shot = TRUE
if (src.affecting && src.assailant && isitem(src.loc))
var/obj/item/gun/G = src.loc
G.shoot_point_blank(src.affecting,src.assailant,1) //don't shoot an offhand gun
G.ShootPointBlank(src.affecting,src.assailant,1) //don't shoot an offhand gun

qdel(src)

Expand Down
Loading

0 comments on commit f3a3bef

Please sign in to comment.