Merge pull request #2502 from comma/gunmode

Aiming Mode
This commit is contained in:
Christian Bielert
2013-03-09 00:13:19 -08:00
33 changed files with 1168 additions and 428 deletions

View File

@@ -1,7 +1,7 @@
// All mobs should have custom emote, really..
mob/proc/custom_emote(var/m_type=1,var/message = null)
if(!emote_allowed && usr == src)
if(!use_me && usr == src)
usr << "You are unable to emote."
return

View File

@@ -9,6 +9,7 @@
var/ghost_name = "Unknown"
var/creating_blob = 0
faction = "blob"
use_me = 0 //Blobs can't emote
New()

View File

@@ -3,7 +3,8 @@
#define X_SUIT_LAYER 2
#define X_L_HAND_LAYER 3
#define X_R_HAND_LAYER 4
#define X_TOTAL_LAYERS 4
#define TARGETED_LAYER 5
#define X_TOTAL_LAYERS 5
/////////////////////////////////
/mob/living/carbon/alien/humanoid
@@ -132,10 +133,22 @@
overlays_standing[X_L_HAND_LAYER] = null
if(update_icons) update_icons()
//Call when target overlay should be added/removed
/mob/living/carbon/alien/humanoid/update_targeted(var/update_icons=1)
if (targeted_by && target_locked)
overlays_lying[TARGETED_LAYER] = target_locked
overlays_standing[TARGETED_LAYER] = target_locked
else if (!targeted_by && target_locked)
del(target_locked)
if (!targeted_by)
overlays_lying[TARGETED_LAYER] = null
overlays_standing[TARGETED_LAYER] = null
if(update_icons) update_icons()
//Xeno Overlays Indexes//////////
#undef X_HEAD_LAYER
#undef X_SUIT_LAYER
#undef X_L_HAND_LAYER
#undef X_R_HAND_LAYER
#undef TARGETED_LAYER
#undef X_TOTAL_LAYERS

View File

@@ -5,6 +5,7 @@
var/timeofhostdeath = 0
var/emp_damage = 0//Handles a type of MMI damage
var/alert = null
use_me = 0 //Can't use the me verb, it's a freaking immobile brain
New()
var/datum/reagents/R = new/datum/reagents(1000)
@@ -48,6 +49,8 @@
/mob/living/carbon/brain/update_canmove()
if(in_contents_of(/obj/mecha)) canmove = 1
if(in_contents_of(/obj/mecha))
canmove = 1
use_me = 1 //If it can move, let it emote
else canmove = 0
return canmove

View File

@@ -485,9 +485,30 @@
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.dir = 2
for(var/obj/item/weapon/gun/G in mymob) // If targeting someone, display other buttons
if (G.target)
mymob.item_use_icon = new /obj/screen/gun/item(null)
if (mymob.client.target_can_click)
mymob.item_use_icon.dir = 1
src.adding += mymob.item_use_icon
mymob.gun_move_icon = new /obj/screen/gun/move(null)
if (mymob.client.target_can_move)
mymob.gun_move_icon.dir = 1
mymob.gun_run_icon = new /obj/screen/gun/run(null)
if (mymob.client.target_can_run)
mymob.gun_run_icon.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.nutrition_icon, mymob.pullin, mymob.blind, mymob.flash, mymob.damageoverlay) //, 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.nutrition_icon, mymob.pullin, mymob.blind, mymob.flash, mymob.damageoverlay, mymob.gun_setting_icon) //, mymob.hands, mymob.rest, mymob.sleep) //, mymob.mach )
mymob.client.screen += src.adding + src.hotkeybuttons
inventory_shown = 0;

View File

@@ -64,6 +64,7 @@ There are several things that need to be remembered:
update_body() //Handles updating your mob's icon to reflect their gender/race/complexion etc
update_hair() //Handles updating your hair overlay (used to be update_face, but mouth and
...eyes were merged into update_body)
update_targeted() // Updates the target overlay when someone points a gun at you
> All of these procs update our overlays_lying and overlays_standing, and then call update_icons() by default.
If you wish to update several overlays at once, you can set the argument to 0 to disable the update and call
@@ -117,7 +118,8 @@ Please contact me on #coderbus IRC. ~Carn x
#define L_HAND_LAYER 19
#define R_HAND_LAYER 20
#define TAIL_LAYER 21 //bs12 specific. this hack is probably gonna come back to haunt me
#define TOTAL_LAYERS 21
#define TARGETED_LAYER 22 //BS12: Layer for the target overlay from weapon targeting system
#define TOTAL_LAYERS 22
//////////////////////////////////
/mob/living/carbon/human
@@ -130,7 +132,6 @@ Please contact me on #coderbus IRC. ~Carn x
//this proc is messy as I was forced to include some old laggy cloaking code to it so that I don't break cloakers
//I'll work on removing that stuff by rewriting some of the cloaking stuff at a later date.
/mob/living/carbon/human/update_icons()
lying_prev = lying //so we don't update overlays for lying/standing unless our stance changes again
update_hud() //TODO: remove the need for this
overlays.Cut()
@@ -472,6 +473,19 @@ proc/get_damage_icon_part(damage_state, body_part)
update_hair(0)
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_lying[TARGETED_LAYER] = target_locked
overlays_standing[TARGETED_LAYER] = target_locked
else if (!targeted_by && target_locked)
del(target_locked)
if (!targeted_by)
overlays_lying[TARGETED_LAYER] = null
overlays_standing[TARGETED_LAYER] = null
if(update_icons) update_icons()
/* --------------------------------------- */
//For legacy support.
/mob/living/carbon/human/regenerate_icons()
@@ -858,4 +872,5 @@ proc/get_damage_icon_part(damage_state, body_part)
#undef L_HAND_LAYER
#undef R_HAND_LAYER
#undef TAIL_LAYER
#undef TOTAL_LAYERS
#undef TARGETED_LAYER
#undef TOTAL_LAYERS

View File

@@ -220,9 +220,29 @@
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.dir = 2
for(var/obj/item/weapon/gun/G in mymob) // If targeting someone, display other buttons
if (G.target)
mymob.item_use_icon = new /obj/screen/gun/item(null)
if (mymob.client.target_can_click)
mymob.item_use_icon.dir = 1
src.adding += mymob.item_use_icon
mymob.gun_move_icon = new /obj/screen/gun/move(null)
if (mymob.client.target_can_move)
mymob.gun_move_icon.dir = 1
mymob.gun_run_icon = new /obj/screen/gun/run(null)
if (mymob.client.target_can_run)
mymob.gun_run_icon.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.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

View File

@@ -4,7 +4,8 @@
#define M_HANDCUFF_LAYER 3
#define M_L_HAND_LAYER 4
#define M_R_HAND_LAYER 5
#define M_TOTAL_LAYERS 5
#define TARGETED_LAYER 6
#define M_TOTAL_LAYERS 6
/////////////////////////////////
/mob/living/carbon/monkey
@@ -101,11 +102,24 @@
if (client)
client.screen |= contents
//Call when target overlay should be added/removed
/mob/living/carbon/monkey/update_targeted(var/update_icons=1)
if (targeted_by && target_locked)
overlays_lying[TARGETED_LAYER] = target_locked
overlays_standing[TARGETED_LAYER] = target_locked
else if (!targeted_by && target_locked)
del(target_locked)
if (!targeted_by)
overlays_lying[TARGETED_LAYER] = null
overlays_standing[TARGETED_LAYER] = null
if(update_icons) update_icons()
//Monkey Overlays Indexes////////
#undef M_MASK_LAYER
#undef M_BACK_LAYER
#undef M_HANDCUFF_LAYER
#undef M_L_HAND_LAYER
#undef M_R_HAND_LAYER
#undef TARGETED_LAYER
#undef M_TOTAL_LAYERS

View File

@@ -143,9 +143,29 @@
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.dir = 2
for(var/obj/item/weapon/gun/G in mymob) // If targeting someone, display other buttons
if (G.target)
mymob.item_use_icon = new /obj/screen/gun/item(null)
if (mymob.client.target_can_click)
mymob.item_use_icon.dir = 1
src.adding += mymob.item_use_icon
mymob.gun_move_icon = new /obj/screen/gun/move(null)
if (mymob.client.target_can_move)
mymob.gun_move_icon.dir = 1
mymob.gun_run_icon = new /obj/screen/gun/run(null)
if (mymob.client.target_can_run)
mymob.gun_run_icon.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.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, mymob.gun_setting_icon) //, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += src.adding + src.other
return

View File

@@ -1,7 +1,7 @@
/mob/living/silicon/robot
name = "Cyborg"
real_name = "Cyborg"
icon = 'icons/mob/robots.dmi'//
icon = 'icons/mob/robots.dmi'
icon_state = "robot"
maxHealth = 300
health = 300
@@ -806,7 +806,13 @@
overlays += "ov-openpanel -c"
return
//Call when target overlay should be added/removed
/mob/living/silicon/robot/update_targeted()
if(!targeted_by && target_locked)
del(target_locked)
updateicon()
if (targeted_by && target_locked)
overlays += target_locked
/mob/living/silicon/robot/proc/installed_modules()
if(weapon_lock)

View File

@@ -27,7 +27,7 @@
regenerate_icons()
/mob/living/simple_animal/corgi/show_inv(mob/user as mob)
/*
/* If you're turning this back on, scroll down and uncomment target_updated
user.set_machine(src)
if(user.stat) return
@@ -404,7 +404,6 @@
return
/mob/living/simple_animal/corgi/puppy
name = "\improper corgi puppy"
real_name = "corgi"

View File

@@ -456,4 +456,12 @@
var/obj/machinery/bot/B = target_mob
if(B.health > 0)
return (0)
return (1)
return (1)
//Call when target overlay should be added/removed
/mob/living/simple_animal/update_targeted()
if(!targeted_by && target_locked)
del(target_locked)
overlays = null
if (targeted_by && target_locked)
overlays += target_locked

View File

@@ -27,6 +27,10 @@
var/obj/screen/pressure = null
var/obj/screen/damageoverlay = null
var/obj/screen/pain = null
var/obj/screen/gun/item/item_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
/*A bunch of this stuff really needs to go under their own defines instead of being globally attached to mob.
A variable should only be globally attached to turfs/objects/whatever, when it is in fact needed as such.
@@ -36,6 +40,7 @@
*/
var/obj/screen/zone_sel/zone_sel = null
var/use_me = 1 //Allows all mobs to use the me verb by default, will have to manually specify they cannot
var/damageoverlaytemp = 0
var/computer_id = null
var/lastattacker = null
@@ -210,4 +215,4 @@
var/has_limbs = 1 //Whether this mob have any limbs he can move with
var/can_stand = 1 //Whether this mob have ability to stand
var/immune_to_ssd = 0
var/immune_to_ssd = 0

View File

@@ -280,7 +280,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)

View File

@@ -24,7 +24,7 @@
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
if(ishuman(src) || isrobot(src))
if(use_me)
usr.emote("me",1,message)
else
usr.emote(message)

View File

@@ -5,6 +5,7 @@
unacidable = 1
var/id = 0.0
var/obj/master
var/gun_click_time = -100 //I'm lazy.
/obj/screen/text
icon = null
@@ -72,6 +73,33 @@
var/selecting = "chest"
screen_loc = ui_zonesel
/obj/screen/gun
name = "gun"
icon = '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
/obj/screen/zone_sel/MouseDown(location, control,params)
// Changes because of 4.0
@@ -460,6 +488,64 @@
usr:inv3.icon_state = "inv3"
usr:module_active = null
if("Allow Walking")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.equipped(),/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("Disallow Walking")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.equipped(),/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(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.equipped(),/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("Disallow Running")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.equipped(),/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.equipped(),/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(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return
if(!istype(usr.equipped(),/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("Toggle Gun Mode")
usr.client.ToggleGunMode()
else
DblClick()
return

View File

@@ -63,3 +63,6 @@
/mob/proc/update_inv_ears()
return
/mob/proc/update_targeted()
return