mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Removed targeting.
This commit is contained in:
@@ -88,9 +88,6 @@
|
||||
return
|
||||
throw_mode_off()
|
||||
|
||||
if(!istype(A, /obj/item/weapon/gun) && !isturf(A) && !istype(A, /obj/screen))
|
||||
last_target_click = world.time
|
||||
|
||||
var/obj/item/W = get_active_hand()
|
||||
|
||||
if(W == A) // Handle attack_self
|
||||
|
||||
@@ -310,7 +310,7 @@ datum/hud/New(mob/owner)
|
||||
else
|
||||
src.client.screen -= src.healths
|
||||
src.client.screen -= src.internals
|
||||
src.client.screen -= src.gun_setting_icon
|
||||
//src.client.screen -= src.gun_setting_icon
|
||||
|
||||
//These ones are not a part of 'adding', 'other' or 'hotkeybuttons' but we want them gone.
|
||||
src.client.screen -= src.zone_sel //zone_sel is a mob variable for some reason.
|
||||
@@ -327,8 +327,8 @@ datum/hud/New(mob/owner)
|
||||
src.client.screen |= src.healths
|
||||
if(src.internals)
|
||||
src.client.screen |= src.internals
|
||||
if(src.gun_setting_icon)
|
||||
src.client.screen |= src.gun_setting_icon
|
||||
//if(src.gun_setting_icon)
|
||||
// src.client.screen |= src.gun_setting_icon
|
||||
|
||||
src.hud_used.action_intent.screen_loc = ui_acti //Restore intent selection to the original position
|
||||
src.client.screen += src.zone_sel //This one is a special snowflake
|
||||
|
||||
@@ -337,6 +337,7 @@
|
||||
mymob.zone_sel.overlays += image('icons/mob/zone_sel.dmi', "[mymob.zone_sel.selecting]")
|
||||
hud_elements |= mymob.zone_sel
|
||||
|
||||
/*
|
||||
//Handle the gun settings buttons
|
||||
mymob.gun_setting_icon = new /obj/screen/gun/mode(null)
|
||||
mymob.gun_setting_icon.icon = ui_style
|
||||
@@ -363,7 +364,7 @@
|
||||
mymob.radio_use_icon.icon = ui_style
|
||||
mymob.radio_use_icon.color = ui_color
|
||||
mymob.radio_use_icon.alpha = ui_alpha
|
||||
|
||||
*/
|
||||
|
||||
mymob.client.screen = null
|
||||
|
||||
|
||||
@@ -250,11 +250,13 @@
|
||||
mymob.zone_sel.overlays.Cut()
|
||||
mymob.zone_sel.overlays += image('icons/mob/zone_sel.dmi', "[mymob.zone_sel.selecting]")
|
||||
|
||||
/*
|
||||
//Handle the gun settings buttons
|
||||
mymob.gun_setting_icon = new /obj/screen/gun/mode(null)
|
||||
if (mymob.client)
|
||||
if (mymob.client.gun_mode) // If in aim mode, correct the sprite
|
||||
mymob.gun_setting_icon.set_dir(2)
|
||||
|
||||
for(var/obj/item/weapon/gun/G in mymob) // If targeting someone, display other buttons
|
||||
if (G.aim_targets)
|
||||
mymob.item_use_icon = new /obj/screen/gun/item(null)
|
||||
@@ -273,10 +275,11 @@
|
||||
mymob.gun_run_icon.set_dir(1)
|
||||
src.adding += mymob.gun_run_icon
|
||||
src.adding += mymob.gun_move_icon
|
||||
*/
|
||||
|
||||
mymob.client.screen = null
|
||||
|
||||
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.pressure, mymob.toxin, mymob.bodytemp, mymob.internals, mymob.fire, mymob.healths, mymob.pullin, mymob.blind, mymob.flash, mymob.gun_setting_icon) //, mymob.hands, mymob.rest, mymob.sleep, mymob.mach )
|
||||
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.pressure, mymob.toxin, mymob.bodytemp, mymob.internals, mymob.fire, mymob.healths, mymob.pullin, mymob.blind, mymob.flash) //, mymob.gun_setting_icon) //, mymob.hands, mymob.rest, mymob.sleep, mymob.mach )
|
||||
mymob.client.screen += src.adding + src.other
|
||||
|
||||
return
|
||||
|
||||
@@ -151,6 +151,7 @@ var/obj/screen/robot_inventory
|
||||
mymob.zone_sel.overlays.Cut()
|
||||
mymob.zone_sel.overlays += image('icons/mob/zone_sel.dmi', "[mymob.zone_sel.selecting]")
|
||||
|
||||
/*
|
||||
//Handle the gun settings buttons
|
||||
mymob.gun_setting_icon = new /obj/screen/gun/mode(null)
|
||||
if (mymob.client)
|
||||
@@ -174,10 +175,11 @@ var/obj/screen/robot_inventory
|
||||
mymob.gun_run_icon.set_dir(1)
|
||||
src.adding += mymob.gun_run_icon
|
||||
src.adding += mymob.gun_move_icon
|
||||
*/
|
||||
|
||||
mymob.client.screen = null
|
||||
|
||||
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.fire, mymob.hands, mymob.healths, mymob:cells, mymob.pullin, mymob.blind, mymob.flash, mymob.gun_setting_icon, robot_inventory) //, mymob.rest, mymob.sleep, mymob.mach )
|
||||
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.fire, mymob.hands, mymob.healths, mymob:cells, mymob.pullin, mymob.blind, mymob.flash, robot_inventory) //, mymob.gun_setting_icon, mymob.rest, mymob.sleep, mymob.mach )
|
||||
mymob.client.screen += src.adding + src.other
|
||||
|
||||
return
|
||||
|
||||
@@ -95,38 +95,6 @@
|
||||
usr.ClickOn(master)
|
||||
return 1
|
||||
|
||||
/obj/screen/gun
|
||||
name = "gun"
|
||||
icon = 'icons/mob/screen1.dmi'
|
||||
master = null
|
||||
dir = 2
|
||||
|
||||
move
|
||||
name = "Allow Walking"
|
||||
icon_state = "no_walk0"
|
||||
screen_loc = ui_gun2
|
||||
|
||||
run
|
||||
name = "Allow Running"
|
||||
icon_state = "no_run0"
|
||||
screen_loc = ui_gun3
|
||||
|
||||
item
|
||||
name = "Allow Item Use"
|
||||
icon_state = "no_item0"
|
||||
screen_loc = ui_gun1
|
||||
|
||||
mode
|
||||
name = "Toggle Gun Mode"
|
||||
icon_state = "gun0"
|
||||
screen_loc = ui_gun_select
|
||||
//dir = 1
|
||||
|
||||
radio
|
||||
name = "Allow Radio Use"
|
||||
icon_state = "no_radio0"
|
||||
screen_loc = ui_gun4
|
||||
|
||||
/obj/screen/zone_sel
|
||||
name = "damage zone"
|
||||
icon_state = "zone_sel"
|
||||
@@ -432,6 +400,7 @@
|
||||
if(istype(usr, /mob/living/silicon/robot))
|
||||
usr:toggle_module(3)
|
||||
|
||||
/*
|
||||
if("Allow Walking", "Disallow Walking")
|
||||
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
|
||||
return
|
||||
@@ -470,7 +439,7 @@
|
||||
return
|
||||
usr.client.AllowTargetRadio()
|
||||
gun_click_time = world.time
|
||||
|
||||
*/
|
||||
else
|
||||
return 0
|
||||
return 1
|
||||
|
||||
@@ -949,7 +949,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
/obj/item/device/pda/proc/create_message(var/mob/living/U = usr, var/obj/item/device/pda/P, var/tap = 1)
|
||||
if(tap)
|
||||
U.visible_message("<span class='notice'>\The [U] taps on \his PDA's screen.</span>")
|
||||
U.last_target_click = world.time
|
||||
//U.last_target_click = world.time
|
||||
var/t = input(U, "Please enter message", P.name, null) as text
|
||||
t = sanitize(t)
|
||||
//t = readd_quotes(t)
|
||||
|
||||
@@ -278,7 +278,7 @@ var/global/list/default_medbay_channels = list(
|
||||
if(wires.IsIndexCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
|
||||
return 0
|
||||
|
||||
M.last_target_radio = world.time // For the projectile targeting system
|
||||
//M.last_target_radio = world.time // For the projectile targeting system
|
||||
|
||||
if(!radio_connection)
|
||||
set_frequency(frequency)
|
||||
|
||||
@@ -35,11 +35,13 @@
|
||||
//update UI
|
||||
var/list/icons = usr.hud_used.adding + usr.hud_used.other + usr.hud_used.hotkeybuttons
|
||||
icons.Add(usr.zone_sel)
|
||||
/*
|
||||
icons.Add(usr.gun_setting_icon)
|
||||
icons.Add(usr.item_use_icon)
|
||||
icons.Add(usr.gun_move_icon)
|
||||
icons.Add(usr.gun_run_icon)
|
||||
icons.Add(usr.radio_use_icon)
|
||||
*/
|
||||
|
||||
var/icon/ic = all_ui_styles[UI_style_new]
|
||||
|
||||
|
||||
@@ -851,7 +851,6 @@
|
||||
return 0
|
||||
|
||||
// AIs are a bit slower than regular and ignore move intent.
|
||||
wearer.last_move_intent = world.time + ai_controlled_move_delay
|
||||
wearer_move_delay = world.time + ai_controlled_move_delay
|
||||
|
||||
var/tickcomp = 0
|
||||
|
||||
@@ -429,17 +429,6 @@ var/global/list/damage_icon_parts = list()
|
||||
overlays_standing[MUTATIONS_LAYER] = null
|
||||
if(update_icons) update_icons()
|
||||
|
||||
//Call when target overlay should be added/removed
|
||||
/mob/living/carbon/human/update_targeted(var/update_icons=1)
|
||||
if (targeted_by && target_locked)
|
||||
overlays_standing[TARGETED_LAYER] = target_locked
|
||||
else if (!targeted_by && target_locked)
|
||||
qdel(target_locked)
|
||||
if (!targeted_by)
|
||||
overlays_standing[TARGETED_LAYER] = null
|
||||
if(update_icons) update_icons()
|
||||
|
||||
|
||||
/* --------------------------------------- */
|
||||
//For legacy support.
|
||||
/mob/living/carbon/human/regenerate_icons()
|
||||
|
||||
@@ -703,14 +703,6 @@
|
||||
icon_state = module_sprites[icontype]
|
||||
return
|
||||
|
||||
//Call when target overlay should be added/removed
|
||||
/mob/living/silicon/robot/update_targeted()
|
||||
if(!targeted_by && target_locked)
|
||||
qdel(target_locked)
|
||||
updateicon()
|
||||
if (targeted_by && target_locked)
|
||||
overlays += target_locked
|
||||
|
||||
/mob/living/silicon/robot/proc/installed_modules()
|
||||
if(weapon_lock)
|
||||
src << "\red Weapon lock active, unable to use modules! Count:[weaponlock_time]"
|
||||
|
||||
@@ -37,10 +37,10 @@
|
||||
pressure = null
|
||||
damageoverlay = null
|
||||
pain = null
|
||||
item_use_icon = null
|
||||
gun_move_icon = null
|
||||
gun_run_icon = null
|
||||
gun_setting_icon = null
|
||||
//item_use_icon = null
|
||||
//gun_move_icon = null
|
||||
//gun_run_icon = null
|
||||
//gun_setting_icon = null
|
||||
spell_masters = null
|
||||
zone_sel = null
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@
|
||||
return 0
|
||||
|
||||
move_delay = world.time//set move delay
|
||||
mob.last_move_intent = world.time + 10
|
||||
|
||||
switch(mob.m_intent)
|
||||
if("run")
|
||||
if(mob.drowsyness > 0)
|
||||
|
||||
@@ -123,17 +123,20 @@
|
||||
/obj/item/weapon/gun/afterattack(atom/A, mob/living/user, adjacent, params)
|
||||
if(adjacent) return //A is adjacent, is the user, or is on the user's person
|
||||
|
||||
//decide whether to aim or shoot normally
|
||||
var/aiming = 0
|
||||
/*
|
||||
if(user && user.client && !(A in aim_targets))
|
||||
if(user.client.gun_mode)
|
||||
aiming = PreFire(A,user,params) //They're using the new gun system, locate what they're aiming at.
|
||||
return
|
||||
*/
|
||||
|
||||
if (!aiming)
|
||||
if(user && user.a_intent == I_HELP) //regardless of what happens, refuse to shoot if help intent is on
|
||||
user << "\red You refrain from firing your [src] as your intent is set to help."
|
||||
else
|
||||
Fire(A,user,params) //Otherwise, fire normally.
|
||||
if(user && user.a_intent == I_HELP) //regardless of what happens, refuse to shoot if help intent is on
|
||||
user << "<span class='warning'>You refrain from firing your [src] as your intent is set to help.</span>"
|
||||
else
|
||||
Fire(A,user,params) //Otherwise, fire normally.
|
||||
|
||||
/obj/item/weapon/gun/proc/PreFire(atom/A as mob|obj|turf|area, mob/living/user as mob|obj, params)
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/attack(atom/A, mob/living/user, def_zone)
|
||||
if (A == user && user.zone_sel.selecting == "mouth" && !mouthshoot)
|
||||
|
||||
@@ -1,407 +0,0 @@
|
||||
/obj/item/weapon/gun/verb/toggle_firerate()
|
||||
set name = "Toggle Continue Aiming"
|
||||
set category = "Object"
|
||||
|
||||
keep_aim = !keep_aim
|
||||
|
||||
if (keep_aim)
|
||||
loc << "You will now continue firing when your target moves."
|
||||
else
|
||||
loc << "You will now only fire once, then lower your aim, when your target moves."
|
||||
|
||||
/obj/item/weapon/gun/verb/lower_aim()
|
||||
set name = "Lower Aim"
|
||||
set category = "Object"
|
||||
if(aim_targets)
|
||||
stop_aim()
|
||||
usr.visible_message("<span class='notice'> \The [usr] lowers \the [src]...</span>")
|
||||
|
||||
//Removing the lock and the buttons.
|
||||
/obj/item/weapon/gun/dropped(mob/user as mob)
|
||||
stop_aim()
|
||||
if(user && user.client)
|
||||
user.client.remove_gun_icons()
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/gun/equipped(var/mob/user, var/slot)
|
||||
if (slot != slot_l_hand && slot != slot_r_hand)
|
||||
stop_aim()
|
||||
if (user.client)
|
||||
user.client.remove_gun_icons()
|
||||
return ..()
|
||||
|
||||
//Removes lock from all targets
|
||||
/obj/item/weapon/gun/proc/stop_aim()
|
||||
if(aim_targets)
|
||||
for(var/mob/living/M in aim_targets)
|
||||
if(M)
|
||||
M.NotTargeted(src) //Untargeting people.
|
||||
aim_targets = null
|
||||
|
||||
//Compute how to fire.....
|
||||
//Return 1 if a target was found, 0 otherwise.
|
||||
/obj/item/weapon/gun/proc/PreFire(atom/A as mob|obj|turf|area, mob/living/user as mob|obj, params)
|
||||
//Lets not spam it.
|
||||
if(lock_time > world.time - 2) return
|
||||
|
||||
user.set_dir(get_cardinal_dir(src, A))
|
||||
if(isliving(A) && !(A in aim_targets))
|
||||
Aim(A) //Clicked a mob, aim at them
|
||||
return 1
|
||||
|
||||
//Didn't click someone, check if there is anyone along that guntrace
|
||||
var/mob/living/M = GunTrace(usr.x,usr.y,A.x,A.y,usr.z,usr) //Find dat mob.
|
||||
if(isliving(M) && (M in view(user)) && !(M in aim_targets))
|
||||
Aim(M) //Aha! Aim at them!
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
//Aiming at the target mob.
|
||||
/obj/item/weapon/gun/proc/Aim(var/mob/living/M)
|
||||
if(!aim_targets || !(M in aim_targets))
|
||||
admin_attack_log(usr, M, "Pointed a [src] at [M]", "Had a [src] aimed at them, by [usr]", "aims a gun ([src]) (MODE: [src.mode_name]) at")
|
||||
lock_time = world.time
|
||||
if(aim_targets && !multi_aim) //If they're targeting someone and they have a non multi_aim weapon.
|
||||
for(var/mob/living/L in aim_targets)
|
||||
if(L)
|
||||
L.NotTargeted(src)
|
||||
aim_targets = null
|
||||
usr.visible_message("<span class='danger'><b>[usr] turns \the [src] on [M]!</b></span>")
|
||||
else
|
||||
usr.visible_message("<span class='danger'><b>[usr] aims \a [src] at [M]!</b></span>")
|
||||
M.Targeted(src)
|
||||
|
||||
//HE MOVED, SHOOT HIM!
|
||||
/obj/item/weapon/gun/proc/TargetActed(var/mob/living/T)
|
||||
var/mob/living/M = loc
|
||||
if(M == T) return
|
||||
if(!istype(M)) return
|
||||
if(src != M.get_active_hand())
|
||||
stop_aim()
|
||||
return
|
||||
|
||||
//reflex firing is disabled when help intent is set
|
||||
if (M.a_intent == I_HELP)
|
||||
M << "<span class='danger'>You refrain from firing your [src] as your intent is set to help.</span>"
|
||||
return
|
||||
|
||||
M.last_move_intent = world.time
|
||||
var/firing_check = can_hit(T,usr) //0 if it cannot hit them, 1 if it is capable of hitting, and 2 if a special check is preventing it from firing.
|
||||
if(firing_check > 0)
|
||||
if(firing_check == 1)
|
||||
Fire(T,usr, reflex = 1)
|
||||
else if(!told_cant_shoot)
|
||||
M << "<span class='danger'>They can't be hit from here!</span>"
|
||||
told_cant_shoot = 1
|
||||
spawn(30)
|
||||
told_cant_shoot = 0
|
||||
|
||||
usr.set_dir(get_cardinal_dir(src, T))
|
||||
|
||||
if (!keep_aim) // If keep_aim is set to lower aim after one shot, untarget the target
|
||||
T.NotTargeted(src)
|
||||
|
||||
//Yay, math!
|
||||
|
||||
#define SIGN(X) ((X<0)?-1:1)
|
||||
|
||||
/proc/GunTrace(X1,Y1,X2,Y2,Z=1,exc_obj,PX1=16,PY1=16,PX2=16,PY2=16)
|
||||
//bluh << "Tracin' [X1],[Y1] to [X2],[Y2] on floor [Z]."
|
||||
var/turf/T
|
||||
var/mob/living/M
|
||||
if(X1==X2)
|
||||
if(Y1==Y2) return 0 //Light cannot be blocked on same tile
|
||||
else
|
||||
var/s = SIGN(Y2-Y1)
|
||||
Y1+=s
|
||||
while(1)
|
||||
T = locate(X1,Y1,Z)
|
||||
if(!T) return 0
|
||||
M = locate() in T
|
||||
if(M) return M
|
||||
M = locate() in orange(1,T)-exc_obj
|
||||
if(M) return M
|
||||
Y1+=s
|
||||
else
|
||||
var
|
||||
m=(32*(Y2-Y1)+(PY2-PY1))/(32*(X2-X1)+(PX2-PX1))
|
||||
b=(Y1+PY1/32-0.015625)-m*(X1+PX1/32-0.015625) //In tiles
|
||||
signX = SIGN(X2-X1)
|
||||
signY = SIGN(Y2-Y1)
|
||||
if(X1<X2) b+=m
|
||||
while(1)
|
||||
var/xvert = round(m*X1+b-Y1)
|
||||
if(xvert) Y1+=signY //Line exits tile vertically
|
||||
else X1+=signX //Line exits tile horizontally
|
||||
T = locate(X1,Y1,Z)
|
||||
if(!T) return 0
|
||||
M = locate() in T
|
||||
if(M) return M
|
||||
M = locate() in orange(1,T)-exc_obj
|
||||
if(M) return M
|
||||
return 0
|
||||
|
||||
|
||||
//Targeting management procs
|
||||
/mob/var
|
||||
list/targeted_by
|
||||
target_time = -100
|
||||
last_move_intent = -100
|
||||
last_target_click = -5
|
||||
target_locked = null
|
||||
last_target_radio = -5;
|
||||
|
||||
/mob/living/proc/Targeted(var/obj/item/weapon/gun/I) //Self explanitory.
|
||||
if(!I.aim_targets)
|
||||
I.aim_targets = list(src)
|
||||
else if(I.multi_aim && I.aim_targets.len < 5) //multi_aim weapon, they can hold down a room.
|
||||
I.aim_targets += src
|
||||
else if(I.aim_targets.len >= 5)
|
||||
if(ismob(I.loc))
|
||||
I.loc << "You can only target 5 people at once!"
|
||||
return
|
||||
else
|
||||
return
|
||||
for(var/mob/living/K in viewers(usr))
|
||||
K << 'sound/weapons/TargetOn.ogg'
|
||||
|
||||
if(!targeted_by) targeted_by = list()
|
||||
targeted_by += I
|
||||
I.lock_time = world.time + 20 //Target has 2 second to realize they're targeted and stop (or target the opponent).
|
||||
src << "((<span class='danger'><b>Your character is being targeted. They have 2 seconds to stop any click or move actions.</b></span> While targeted, they may \
|
||||
drag and drop items in or into the map, speak, and click on interface buttons. Clicking on the map objects (floors and walls are fine), their items \
|
||||
(other than a weapon to de-target), moving, or talking into a radio will result in being fired upon. <span class='danger'>The aggressor may also fire manually, \
|
||||
so try not to get on their bad side.</span>))"
|
||||
|
||||
if(targeted_by.len == 1)
|
||||
spawn(0)
|
||||
target_locked = image("icon" = 'icons/effects/Targeted.dmi', "icon_state" = "locking")
|
||||
overlays += target_locked
|
||||
spawn(0)
|
||||
sleep(20)
|
||||
if(target_locked)
|
||||
target_locked = image("icon" = 'icons/effects/Targeted.dmi', "icon_state" = "locked")
|
||||
update_targeted()
|
||||
|
||||
//Adding the buttons to the controller person
|
||||
var/mob/living/T = I.loc
|
||||
if(T)
|
||||
if(T.client)
|
||||
T.client.add_gun_icons()
|
||||
else
|
||||
I.lower_aim()
|
||||
return
|
||||
if(iscarbon(src) && m_intent == "run" && T.client.target_can_move == 1 && T.client.target_can_run == 0)
|
||||
src << "<span class='danger'>Your move intent is now set to walk, as your targeter permits it.</span>" //Self explanitory.
|
||||
set_m_intent("walk")
|
||||
|
||||
//Processing the aiming. Should be probably in separate object with process() but lasy.
|
||||
while(targeted_by && T.client)
|
||||
if(last_move_intent > I.lock_time + 10 && !T.client.target_can_move) //If target moved when not allowed to
|
||||
I.TargetActed(src)
|
||||
if(I.last_moved_mob == src) //If they were the last ones to move, give them more of a grace period, so that an automatic weapon can hold down a room better.
|
||||
I.lock_time = world.time + 5
|
||||
I.lock_time = world.time + 5
|
||||
I.last_moved_mob = src
|
||||
else if(last_move_intent > I.lock_time + 10 && !T.client.target_can_run && m_intent == "run") //If the target ran while targeted
|
||||
I.TargetActed(src)
|
||||
if(I.last_moved_mob == src) //If they were the last ones to move, give them more of a grace period, so that an automatic weapon can hold down a room better.
|
||||
I.lock_time = world.time + 5
|
||||
I.lock_time = world.time + 5
|
||||
I.last_moved_mob = src
|
||||
if(last_target_click > I.lock_time + 10 && !T.client.target_can_click) //If the target clicked the map to pick something up/shoot/etc
|
||||
I.TargetActed(src)
|
||||
if(I.last_moved_mob == src) //If they were the last ones to move, give them more of a grace period, so that an automatic weapon can hold down a room better.
|
||||
I.lock_time = world.time + 5
|
||||
I.lock_time = world.time + 5
|
||||
I.last_moved_mob = src
|
||||
if(last_target_radio > I.lock_time + 10 && !T.client.target_can_radio)
|
||||
I.TargetActed(src)
|
||||
if(I.last_moved_mob == src) //If they were the last ones to move, give them more of a grace period, so that an automatic weapon can hold down a room better.
|
||||
I.lock_time = world.time + 5
|
||||
I.lock_time = world.time + 5
|
||||
I.last_moved_mob = src
|
||||
sleep(1)
|
||||
|
||||
/mob/living/proc/NotTargeted(var/obj/item/weapon/gun/I)
|
||||
if(!I.silenced)
|
||||
for(var/mob/living/M in viewers(src))
|
||||
M << 'sound/weapons/TargetOff.ogg'
|
||||
targeted_by -= I
|
||||
I.aim_targets.Remove(src) //De-target them
|
||||
if(!I.aim_targets.len)
|
||||
I.aim_targets = null
|
||||
var/mob/living/T = I.loc //Remove the targeting icons
|
||||
if(T && ismob(T) && !I.aim_targets && T.client)
|
||||
T.client.remove_gun_icons()
|
||||
if(!targeted_by.len)
|
||||
qdel(target_locked) //Remove the overlay
|
||||
targeted_by.Cut()
|
||||
spawn(1) update_targeted()
|
||||
|
||||
/mob/living/Move()
|
||||
. = ..()
|
||||
for(var/obj/item/weapon/gun/G in targeted_by) //Handle moving out of the gunner's view.
|
||||
var/mob/living/M = G.loc
|
||||
if(!(M in view(src)))
|
||||
NotTargeted(G)
|
||||
for(var/obj/item/weapon/gun/G in src) //Handle the gunner loosing sight of their target/s
|
||||
if(G.aim_targets)
|
||||
for(var/mob/living/M in G.aim_targets)
|
||||
if(M && !(M in view(src)))
|
||||
M.NotTargeted(G)
|
||||
|
||||
//If you move out of range, it isn't going to still stay locked on you any more.
|
||||
/client/var
|
||||
target_can_move = 0
|
||||
target_can_run = 0
|
||||
target_can_click = 0
|
||||
target_can_radio = 0
|
||||
gun_mode = 0
|
||||
|
||||
//These are called by the on-screen buttons, adjusting what the victim can and cannot do.
|
||||
/client/proc/add_gun_icons()
|
||||
if(!usr) return 1 // This can runtime if someone manages to throw a gun out of their hand before the proc is called.
|
||||
screen += usr.item_use_icon
|
||||
screen += usr.gun_move_icon
|
||||
screen += usr.radio_use_icon
|
||||
if (target_can_move)
|
||||
screen += usr.gun_run_icon
|
||||
|
||||
|
||||
|
||||
/client/proc/remove_gun_icons()
|
||||
if(!usr) return 1 // Runtime prevention on N00k agents spawning with SMG
|
||||
screen -= usr.item_use_icon
|
||||
screen -= usr.gun_move_icon
|
||||
screen -= usr.radio_use_icon
|
||||
if (target_can_move)
|
||||
screen -= usr.gun_run_icon
|
||||
|
||||
/client/verb/ToggleGunMode()
|
||||
set name = "Toggle Gun Mode"
|
||||
set hidden = 1
|
||||
gun_mode = !gun_mode
|
||||
if(gun_mode)
|
||||
usr << "You will now take people captive."
|
||||
else
|
||||
usr << "You will now shoot where you target."
|
||||
for(var/obj/item/weapon/gun/G in usr)
|
||||
G.stop_aim()
|
||||
remove_gun_icons()
|
||||
if(usr.gun_setting_icon)
|
||||
usr.gun_setting_icon.icon_state = "gun[gun_mode]"
|
||||
|
||||
|
||||
/client/verb/AllowTargetMove()
|
||||
set hidden=1
|
||||
|
||||
//Changing client's permissions
|
||||
target_can_move = !target_can_move
|
||||
if(target_can_move)
|
||||
usr << "Target may now walk."
|
||||
//usr.gun_run_icon = new /obj/screen/gun/run(null) //adding icon for running permission
|
||||
screen += usr.gun_run_icon
|
||||
else
|
||||
usr << "Target may no longer move."
|
||||
target_can_run = 0
|
||||
qdel(usr.gun_run_icon) //no need for icon for running permission
|
||||
|
||||
//Updating walking permission button
|
||||
if(usr.gun_move_icon)
|
||||
usr.gun_move_icon.icon_state = "no_walk[target_can_move]"
|
||||
usr.gun_move_icon.name = "[target_can_move ? "Disallow" : "Allow"] Walking"
|
||||
|
||||
//Handling change for all the guns on client
|
||||
for(var/obj/item/weapon/gun/G in usr)
|
||||
G.lock_time = world.time + 5
|
||||
if(G.aim_targets)
|
||||
for(var/mob/living/M in G.aim_targets)
|
||||
if(target_can_move)
|
||||
M << "Your character may now <b>walk</b> at the discretion of their targeter."
|
||||
if(!target_can_run)
|
||||
M << "<span class='danger'>Your move intent is now set to walk, as your targeter permits it.</span>"
|
||||
M.set_m_intent("walk")
|
||||
else
|
||||
M << "<span class='danger'><b>Your character will now be shot if they move.</b></span>"
|
||||
|
||||
/mob/living/proc/set_m_intent(var/intent)
|
||||
if (intent != "walk" && intent != "run")
|
||||
return 0
|
||||
m_intent = intent
|
||||
if(hud_used)
|
||||
if (hud_used.move_intent)
|
||||
hud_used.move_intent.icon_state = intent == "walk" ? "walking" : "running"
|
||||
|
||||
client/verb/AllowTargetRun()
|
||||
set hidden=1
|
||||
|
||||
//Changing client's permissions
|
||||
target_can_run = !target_can_run
|
||||
if(target_can_run)
|
||||
usr << "Target may now run."
|
||||
else
|
||||
usr << "Target may no longer run."
|
||||
|
||||
//Updating running permission button
|
||||
if(usr.gun_run_icon)
|
||||
usr.gun_run_icon.icon_state = "no_run[target_can_run]"
|
||||
usr.gun_run_icon.name = "[target_can_run ? "Disallow" : "Allow"] Running"
|
||||
|
||||
//Handling change for all the guns on client
|
||||
for(var/obj/item/weapon/gun/G in src)
|
||||
G.lock_time = world.time + 5
|
||||
if(G.aim_targets)
|
||||
for(var/mob/living/M in G.aim_targets)
|
||||
if(target_can_run)
|
||||
M << "Your character may now <b>run</b> at the discretion of their targeter."
|
||||
else
|
||||
M << "<span class='danger'><b>Your character will now be shot if they run.</b></span>"
|
||||
|
||||
/client/verb/AllowTargetClick()
|
||||
set hidden=1
|
||||
|
||||
//Changing client's permissions
|
||||
target_can_click = !target_can_click
|
||||
if(target_can_click)
|
||||
usr << "Target may now use items."
|
||||
else
|
||||
usr << "Target may no longer use items."
|
||||
|
||||
if(usr.item_use_icon)
|
||||
usr.item_use_icon.icon_state = "no_item[target_can_click]"
|
||||
usr.item_use_icon.name = "[target_can_click ? "Disallow" : "Allow"] Item Use"
|
||||
|
||||
//Handling change for all the guns on client
|
||||
for(var/obj/item/weapon/gun/G in src)
|
||||
G.lock_time = world.time + 5
|
||||
if(G.aim_targets)
|
||||
for(var/mob/living/M in G.aim_targets)
|
||||
if(target_can_click)
|
||||
M << "Your character may now <b>use items</b> at the discretion of their targeter."
|
||||
else
|
||||
M << "<span class='danger'><b>Your character will now be shot if they use items.</b></span>"
|
||||
|
||||
/client/verb/AllowTargetRadio()
|
||||
set hidden=1
|
||||
|
||||
target_can_radio = !target_can_radio
|
||||
if(target_can_radio)
|
||||
usr << "Target may now use radio."
|
||||
else
|
||||
usr << "Target may no longer use radio."
|
||||
|
||||
if(usr.radio_use_icon)
|
||||
usr.radio_use_icon.icon_state = "no_radio[target_can_radio]"
|
||||
usr.radio_use_icon.name = "[target_can_radio ? "Disallow" : "Allow"] Radio Use"
|
||||
|
||||
//Handling change for all the guns on client
|
||||
for(var/obj/item/weapon/gun/G in src)
|
||||
G.lock_time = world.time + 5
|
||||
if(G.aim_targets)
|
||||
for(var/mob/living/M in G.aim_targets)
|
||||
if(target_can_radio)
|
||||
M << "Your character may now <b>use the radio</b> at the discretion of their targeter."
|
||||
else
|
||||
M << "<span class='danger'><b>Your character will now be shot if they use the radio.</b></span>"
|
||||
@@ -1610,7 +1610,6 @@
|
||||
#include "code\modules\projectiles\effects.dm"
|
||||
#include "code\modules\projectiles\gun.dm"
|
||||
#include "code\modules\projectiles\projectile.dm"
|
||||
#include "code\modules\projectiles\targeting.dm"
|
||||
#include "code\modules\projectiles\ammunition\boxes.dm"
|
||||
#include "code\modules\projectiles\ammunition\bullets.dm"
|
||||
#include "code\modules\projectiles\guns\alien.dm"
|
||||
|
||||
Reference in New Issue
Block a user