Merge pull request #8739 from hockeygoalie5/autofire-radio

Adds a radio use toggle to reflex fire
This commit is contained in:
PsiOmegaDelta
2015-04-04 08:52:05 +02:00
9 changed files with 77 additions and 45 deletions
+1
View File
@@ -66,6 +66,7 @@
#define ui_gun2 "14:28, 4:7"
#define ui_gun3 "13:26,4:7"
#define ui_gun_select "14:28,3:7"
#define ui_gun4 "12:24,3:7"
//Upper-middle right (damage indicators)
#define ui_toxin "14:28,13:27"
+3
View File
@@ -356,6 +356,9 @@
//mymob.gun_run_icon.color = ui_color
mymob.gun_run_icon.alpha = ui_alpha
mymob.radio_use_icon = new /obj/screen/gun/radio(null)
mymob.radio_use_icon.alpha = ui_alpha
if (mymob.client)
if (mymob.client.gun_mode) // If in aim mode, correct the sprite
mymob.gun_setting_icon.set_dir(2)
+4
View File
@@ -231,6 +231,10 @@
if (mymob.client.target_can_click)
mymob.item_use_icon.set_dir(1)
src.adding += mymob.item_use_icon
mymob.radio_use_icon = new /obj/screen/gun/radio(null)
if (mymob.client.target_can_radio)
mymob.radio_use_icon.set_dir(1)
src.adding += mymob.radio_use_icon
mymob.gun_move_icon = new /obj/screen/gun/move(null)
if (mymob.client.target_can_move)
mymob.gun_move_icon.set_dir(1)
+4
View File
@@ -162,6 +162,10 @@ var/obj/screen/robot_inventory
if (mymob.client.target_can_click)
mymob.item_use_icon.set_dir(1)
src.adding += mymob.item_use_icon
mymob.radio_use_icon = new /obj/screen/gun/radio(null)
if (mymob.client.target_can_radio)
mymob.radio_use_icon.set_dir(1)
src.adding += mymob.radio_use_icon
mymob.gun_move_icon = new /obj/screen/gun/move(null)
if (mymob.client.target_can_move)
mymob.gun_move_icon.set_dir(1)
+17 -31
View File
@@ -122,6 +122,11 @@
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"
@@ -427,7 +432,7 @@
if(istype(usr, /mob/living/silicon/robot))
usr:toggle_module(3)
if("Allow Walking")
if("Allow Walking", "Disallow Walking")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
@@ -436,16 +441,7 @@
usr.client.AllowTargetMove()
gun_click_time = world.time
if("Disallow Walking")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!"
return
usr.client.AllowTargetMove()
gun_click_time = world.time
if("Allow Running")
if("Allow Running", "Disallow Running")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
@@ -454,26 +450,7 @@
usr.client.AllowTargetRun()
gun_click_time = world.time
if("Disallow Running")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!"
return
usr.client.AllowTargetRun()
gun_click_time = world.time
if("Allow Item Use")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!"
return
usr.client.AllowTargetClick()
gun_click_time = world.time
if("Disallow Item Use")
if("Allow Item Use", "Disallow Item Use")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
@@ -485,6 +462,15 @@
if("Toggle Gun Mode")
usr.client.ToggleGunMode()
if("Allow Radio Use", "Disallow Radio Use")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!"
return
usr.client.AllowTargetRadio()
gun_click_time = world.time
else
return 0
return 1
@@ -202,7 +202,7 @@
if(wires.IsIndexCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
return 0
M.last_target_click = world.time
M.last_target_radio = world.time // For the projectile targeting system
/* Quick introduction:
This new radio system uses a very robust FTL signaling technology unoriginally
+1
View File
@@ -29,6 +29,7 @@
var/obj/screen/damageoverlay = null
var/obj/screen/pain = null
var/obj/screen/gun/item/item_use_icon = null
var/obj/screen/gun/radio/radio_use_icon = null
var/obj/screen/gun/move/gun_move_icon = null
var/obj/screen/gun/run/gun_run_icon = null
var/obj/screen/gun/mode/gun_setting_icon = null
+46 -13
View File
@@ -14,7 +14,7 @@
set category = "Object"
if(aim_targets)
stop_aim()
usr.visible_message("\blue \The [usr] lowers \the [src]...")
usr.visible_message("<span class='notice'> \The [usr] lowers \the [src]...</span>")
//Clicking gun will still lower aim for guns that don't overwrite this
/obj/item/weapon/gun/attack_self()
@@ -70,9 +70,9 @@
if(L)
L.NotTargeted(src)
del(aim_targets)
usr.visible_message("\red <b>[usr] turns \the [src] on [M]!</b>")
usr.visible_message("<span class='danger'><b>[usr] turns \the [src] on [M]!</b></span>")
else
usr.visible_message("\red <b>[usr] aims \a [src] at [M]!</b>")
usr.visible_message("<span class='danger'><b>[usr] aims \a [src] at [M]!</b></span>")
M.Targeted(src)
//HE MOVED, SHOOT HIM!
@@ -86,7 +86,7 @@
//reflex firing is disabled when help intent is set
if (M.a_intent == I_HELP)
M << "\red You refrain from firing your [src] as your intent is set to 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
@@ -95,7 +95,7 @@
if(firing_check == 1)
Fire(T,usr, reflex = 1)
else if(!told_cant_shoot)
M << "\red They can't be hit from here!"
M << "<span class='danger'>They can't be hit from here!</span>"
told_cant_shoot = 1
spawn(30)
told_cant_shoot = 0
@@ -153,6 +153,7 @@
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)
@@ -171,10 +172,10 @@
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 << "((\red <b>Your character is being targeted. They have 2 seconds to stop any click or move actions.</b> \black While targeted, they may \
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), or moving will result in being fired upon. \red The aggressor may also fire manually, \
so try not to get on their bad side.\black ))"
(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)
@@ -195,7 +196,7 @@
I.lower_aim()
return
if(m_intent == "run" && T.client.target_can_move == 1 && T.client.target_can_run == 0)
src << "\red Your move intent is now set to walk, as your targeter permits it." //Self explanitory.
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.
@@ -218,6 +219,12 @@
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)
@@ -253,12 +260,14 @@
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()
screen += usr.item_use_icon
screen += usr.gun_move_icon
screen += usr.radio_use_icon
if (target_can_move)
screen += usr.gun_run_icon
@@ -268,6 +277,7 @@
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
@@ -313,10 +323,10 @@
if(target_can_move)
M << "Your character may now <b>walk</b> at the discretion of their targeter."
if(!target_can_run)
M << "\red Your move intent is now set to walk, as your targeter permits it."
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 << "\red <b>Your character will now be shot if they move.</b>"
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")
@@ -349,7 +359,7 @@ client/verb/AllowTargetRun()
if(target_can_run)
M << "Your character may now <b>run</b> at the discretion of their targeter."
else
M << "\red <b>Your character will now be shot if they run.</b>"
M << "<span class='danger'><b>Your character will now be shot if they run.</b></span>"
/client/verb/AllowTargetClick()
set hidden=1
@@ -373,4 +383,27 @@ client/verb/AllowTargetRun()
if(target_can_click)
M << "Your character may now <b>use items</b> at the discretion of their targeter."
else
M << "\red <b>Your character will now be shot if they use items.</b>"
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>"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB