Merge pull request #5095 from tigercat2000/ACTION_BUTTONS

Action Button Update
This commit is contained in:
Fox McCloud
2016-07-19 23:40:51 -04:00
committed by GitHub
97 changed files with 1237 additions and 1022 deletions
@@ -8,7 +8,7 @@
flags = CONDUCT
slot_flags = SLOT_BELT
materials = list(MAT_METAL=50, MAT_GLASS=20)
action_button_name = "Flashlight"
actions_types = list(/datum/action/item_action/toggle_light)
var/on = 0
var/brightness_on = 4 //luminosity when on
@@ -36,6 +36,9 @@
return 0
on = !on
update_brightness(user)
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
return 1
@@ -254,7 +254,8 @@
cyborg = R
icon_state = "selfrepair_off"
action_button_name = "Toggle Self-Repair"
var/datum/action/A = new /datum/action/item_action/toggle(src)
A.Grant(R)
return 1
/obj/item/borg/upgrade/selfrepair/Destroy()
@@ -276,6 +277,9 @@
/obj/item/borg/upgrade/selfrepair/update_icon()
if(cyborg)
icon_state = "selfrepair_[on ? "on" : "off"]"
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
else
icon_state = "cyborg_upgrade5"
@@ -9,7 +9,7 @@
w_class = 4
slot_flags = SLOT_BACK
slowdown = 1
action_button_name = "Equip/Unequip TED Gun"
actions_types = list(/datum/action/item_action/equip_unequip_TED_Gun)
var/obj/item/weapon/gun/energy/chrono_gun/PA = null
var/list/erased_minds = list() //a collection of minds from the dead
@@ -17,6 +17,7 @@
erased_minds += M
/obj/item/weapon/chrono_eraser/dropped()
..()
if(PA)
qdel(PA)
@@ -24,15 +25,19 @@
dropped()
return ..()
/obj/item/weapon/chrono_eraser/ui_action_click()
var/mob/living/carbon/user = src.loc
if(iscarbon(user) && (user.back == src))
if(PA)
qdel(PA)
else
PA = new(src)
user.put_in_hands(PA)
/obj/item/weapon/chrono_eraser/ui_action_click(mob/user)
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.back == src)
if(PA)
qdel(PA)
else
PA = new(src)
user.put_in_hands(PA)
/obj/item/weapon/chrono_eraser/item_action_slot_check(slot, mob/user)
if(slot == slot_back)
return 1
/obj/item/weapon/gun/energy/chrono_gun
+14 -14
View File
@@ -11,7 +11,7 @@
throwforce = 6
w_class = 4
origin_tech = "biotech=4"
action_button_name = "Toggle Paddles"
actions_types = list(/datum/action/item_action/toggle_paddles)
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/back.dmi'
@@ -75,11 +75,7 @@
update_icon()
/obj/item/weapon/defibrillator/ui_action_click()
if(usr.get_item_by_slot(slot_back) == src)
toggle_paddles()
else
to_chat(usr, "<span class='warning'>Put the defibrillator on your back first!</span>")
return
toggle_paddles()
/obj/item/weapon/defibrillator/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/stock_parts/cell))
@@ -148,16 +144,23 @@
remove_paddles(user)
update_icon()
return
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/weapon/defibrillator/proc/make_paddles()
return new /obj/item/weapon/twohanded/shockpaddles(src)
/obj/item/weapon/defibrillator/equipped(mob/user, slot)
..()
if(slot != slot_back)
remove_paddles(user)
update_icon()
/obj/item/weapon/defibrillator/item_action_slot_check(slot, mob/user)
if(slot == slot_back)
return 1
/obj/item/weapon/defibrillator/proc/remove_paddles(mob/user)
var/mob/living/carbon/human/M = user
if(paddles in get_both_hands(M))
@@ -211,12 +214,9 @@
slot_flags = SLOT_BELT
origin_tech = "biotech=4"
/obj/item/weapon/defibrillator/compact/ui_action_click()
if(usr.get_item_by_slot(slot_belt) == src)
toggle_paddles()
else
to_chat(usr, "<span class='warning'>Strap the defibrillator's belt on first!</span>")
return
/obj/item/weapon/defibrillator/compact/item_action_slot_check(slot, mob/user)
if(slot == slot_belt)
return 1
/obj/item/weapon/defibrillator/compact/loaded/New()
..()
@@ -285,7 +285,7 @@
/obj/item/weapon/twohanded/shockpaddles/dropped(mob/user as mob)
if(user)
var/obj/item/weapon/twohanded/O = user.get_inactive_hand()
var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_hand()
if(istype(O))
O.unwield()
to_chat(user, "<span class='notice'>The paddles snap back into the main unit.</span>")
@@ -2,9 +2,9 @@
name = "implant"
icon = 'icons/obj/implants.dmi'
icon_state = "generic" //Shows up as the action button icon
action_button_custom_type = /datum/action/item_action/hands_free
origin_tech = "materials=2;biotech=3;programming=2"
actions_types = list(/datum/action/item_action/hands_free/activate)
var/activated = 1 //1 for implant types that can be activated, 0 for ones that are "always on" like mindshield implants
var/implanted = null
var/mob/living/imp_in = null
@@ -41,11 +41,13 @@
return 0
if(activated)
action_button_name = "Activate [src.name]"
src.loc = source
imp_in = source
implanted = 1
if(activated)
for(var/X in actions)
var/datum/action/A = X
A.Grant(source)
if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
@@ -60,6 +62,10 @@
imp_in = null
implanted = 0
for(var/X in actions)
var/datum/action/A = X
A.Grant(source)
if(istype(source, /mob/living/carbon/human))
var/mob/living/carbon/human/H = source
H.sec_hud_set_implants()
@@ -76,6 +82,6 @@
return "No information available"
/obj/item/weapon/implant/dropped(mob/user)
..()
. = 1
qdel(src)
return .
@@ -8,12 +8,13 @@
/obj/item/weapon/implant/freedom/activate()
if(uses == 0) return 0
if(uses != -1) uses--
uses--
to_chat(imp_in, "You feel a faint click.")
if(iscarbon(imp_in))
var/mob/living/carbon/C_imp_in = imp_in
C_imp_in.uncuff()
if(!uses)
qdel(src)
/obj/item/weapon/implant/freedom/get_data()
@@ -33,7 +33,6 @@
return dat
/obj/item/weapon/implant/adrenalin/activate()
if(uses < 1) return 0
uses--
to_chat(imp_in, "<span class='notice'>You feel a sudden surge of energy!</span>")
imp_in.SetStunned(0)
@@ -46,6 +45,8 @@
imp_in.reagents.add_reagent("synaptizine", 10)
imp_in.reagents.add_reagent("omnizine", 10)
imp_in.reagents.add_reagent("stimulative_agent", 10)
if(!uses)
qdel(src)
/obj/item/weapon/implant/emp
@@ -56,9 +57,10 @@
uses = 2
/obj/item/weapon/implant/emp/activate()
if(src.uses < 1) return 0
src.uses--
uses--
empulse(imp_in, 3, 5)
if(!uses)
qdel(src)
/obj/item/weapon/implant/cortical
name = "cortical stack"
@@ -217,6 +217,7 @@
spark_system.attach(src)
/obj/item/weapon/melee/energy/blade/dropped()
..()
qdel(src)
/obj/item/weapon/melee/energy/blade/attack_self(mob/user)
@@ -373,9 +373,6 @@
handle_item_insertion(W)
return 1
/obj/item/weapon/storage/dropped(mob/user as mob)
return
/obj/item/weapon/storage/attack_hand(mob/user as mob)
playsound(src.loc, "rustle", 50, 1, -5)
@@ -8,72 +8,86 @@
item_state = "jetpack"
distribute_pressure = ONE_ATMOSPHERE*O2STANDARD
var/datum/effect/system/ion_trail_follow/ion_trail
var/on = 0.0
var/stabilization_on = 0
actions_types = list(/datum/action/item_action/set_internals, /datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization)
var/on = 0
var/stabilizers = 0
var/volume_rate = 500 //Needed for borg jetpack transfer
action_button_name = "Toggle Jetpack"
/obj/item/weapon/tank/jetpack/New()
..()
src.ion_trail = new /datum/effect/system/ion_trail_follow()
src.ion_trail.set_up(src)
return
ion_trail = new /datum/effect/system/ion_trail_follow()
ion_trail.set_up(src)
/obj/item/weapon/tank/jetpack/Destroy()
qdel(ion_trail)
ion_trail = null
return ..()
/obj/item/weapon/tank/jetpack/ui_action_click(mob/user, actiontype)
if(actiontype == /datum/action/item_action/toggle_jetpack)
cycle(user)
else if(actiontype == /datum/action/item_action/jetpack_stabilization)
toggle_stabilization(user)
else
toggle_internals(user)
/obj/item/weapon/tank/jetpack/proc/toggle_stabilization(mob/user)
if(on)
stabilizers = !stabilizers
to_chat(user, "<span class='notice'>You turn [src]'s stabilization [stabilizers ? "on" : "off"].</span>")
/obj/item/weapon/tank/jetpack/examine(mob/user)
if(!..(user, 0))
return
if(air_contents.oxygen < 10)
to_chat(user, text("\red <B>The meter on the [src.name] indicates you are almost out of air!</B>"))
to_chat(user, "<span class='danger'>The meter on [src] indicates you are almost out of air!</span>")
playsound(user, 'sound/effects/alert.ogg', 50, 1)
/obj/item/weapon/tank/jetpack/verb/toggle_rockets()
set name = "Toggle Jetpack Stabilization"
set category = "Object"
src.stabilization_on = !( src.stabilization_on )
to_chat(usr, "You toggle the stabilization [stabilization_on? "on":"off"].")
return
/obj/item/weapon/tank/jetpack/proc/cycle(mob/user)
if(user.incapacitated())
return
/obj/item/weapon/tank/jetpack/verb/toggle()
set name = "Toggle Jetpack"
set category = "Object"
on = !on
if(on)
icon_state = "[icon_state]-on"
// item_state = "[item_state]-on"
ion_trail.start()
if(!on)
turn_on()
to_chat(user, "<span class='notice'>You turn the jetpack on.</span>")
else
icon_state = initial(icon_state)
// item_state = initial(item_state)
ion_trail.stop()
return
turn_off()
to_chat(user, "<span class='notice'>You turn the jetpack off.</span>")
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/weapon/tank/jetpack/proc/turn_on()
on = TRUE
icon_state = "[initial(icon_state)]-on"
ion_trail.start()
/obj/item/weapon/tank/jetpack/proc/turn_off()
on = FALSE
stabilizers = FALSE
icon_state = initial(icon_state)
ion_trail.stop()
/obj/item/weapon/tank/jetpack/proc/allow_thrust(num, mob/living/user as mob)
if(!(src.on))
if(!on)
return 0
if((num < 0.005 || src.air_contents.total_moles() < num))
src.ion_trail.stop()
if((num < 0.005 || air_contents.total_moles() < num))
turn_off()
return 0
var/datum/gas_mixture/G = src.air_contents.remove(num)
var/allgases = G.carbon_dioxide + G.nitrogen + G.oxygen + G.toxins //fuck trace gases -Pete
if(allgases >= 0.005)
. = 1
qdel(G)
/obj/item/weapon/tank/jetpack/ui_action_click()
toggle()
var/datum/gas_mixture/removed = air_contents.remove(num)
if(removed.total_moles() < 0.005)
turn_off()
return 0
var/turf/T = get_turf(user)
T.assume_air(removed)
return 1
/obj/item/weapon/tank/jetpack/void
name = "Void Jetpack (Oxygen)"
@@ -124,8 +138,8 @@
/obj/item/weapon/tank/jetpack/carbondioxide/New()
..()
src.ion_trail = new /datum/effect/system/ion_trail_follow()
src.ion_trail.set_up(src)
ion_trail = new /datum/effect/system/ion_trail_follow()
ion_trail.set_up(src)
air_contents.carbon_dioxide = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
/obj/item/weapon/tank/jetpack/carbondioxide/examine(mob/user)
@@ -133,35 +147,32 @@
return
if(air_contents.carbon_dioxide < 10)
to_chat(user, text("\red <B>The meter on the [src.name] indicates you are almost out of air!</B>"))
to_chat(user, "<span class='danger'>The meter on [src] indicates you are almost out of air!</span>")
playsound(user, 'sound/effects/alert.ogg', 50, 1)
/obj/item/weapon/tank/jetpack/rig
name = "jetpack"
var/obj/item/weapon/rig/holder
actions_types = list(/datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization)
/obj/item/weapon/tank/jetpack/rig/examine()
to_chat(usr, "It's a jetpack. If you can see this, report it on the bug tracker.")
return 0
/obj/item/weapon/tank/jetpack/rig/allow_thrust(num, mob/living/user as mob)
if(!(src.on))
if(!on)
return 0
if(!istype(holder) || !holder.air_supply)
return 0
var/obj/item/weapon/tank/pressure_vessel = holder.air_supply
if((num < 0.005 || pressure_vessel.air_contents.total_moles() < num))
src.ion_trail.stop()
var/datum/gas_mixture/removed = holder.air_supply.air_contents.remove(num)
if(removed.total_moles() < 0.005)
turn_off()
return 0
var/datum/gas_mixture/G = pressure_vessel.air_contents.remove(num)
var/turf/T = get_turf(user)
T.assume_air(removed)
var/allgases = G.carbon_dioxide + G.nitrogen + G.oxygen + G.toxins
if(allgases >= 0.005)
. = 1
qdel(G)
return 1
+64 -53
View File
@@ -16,6 +16,7 @@
throw_speed = 1
throw_range = 4
actions_types = list(/datum/action/item_action/set_internals)
var/datum/gas_mixture/air_contents = null
var/distribute_pressure = ONE_ATMOSPHERE
var/integrity = 3
@@ -24,9 +25,9 @@
/obj/item/weapon/tank/New()
..()
src.air_contents = new /datum/gas_mixture()
src.air_contents.volume = volume //liters
src.air_contents.temperature = T20C
air_contents = new /datum/gas_mixture()
air_contents.volume = volume //liters
air_contents.temperature = T20C
processing_objects.Add(src)
return
@@ -39,16 +40,52 @@
return ..()
/obj/item/weapon/tank/ui_action_click(mob/user)
toggle_internals(user)
/obj/item/weapon/tank/proc/toggle_internals(mob/user)
var/mob/living/carbon/C = user
if(!istype(C))
return 0
if(C.internal == src)
to_chat(C, "<span class='notice'>You close \the [src] valve.</span>")
C.internal = null
C.update_internals_hud_icon(0)
else
var/can_open_valve = 0
if(C.wear_mask && C.wear_mask.flags & AIRTIGHT)
can_open_valve = 1
else if(ishuman(C))
var/mob/living/carbon/human/H = C
if(H.head && H.head.flags & AIRTIGHT)
can_open_valve = 1
if(can_open_valve)
if(C.internal)
to_chat(C, "<span class='notice'>You switch your internals to [src].</span>")
else
to_chat(C, "<span class='notice'>You open \the [src] valve.</span>")
C.internal = src
C.update_internals_hud_icon(1)
else
to_chat(C, "<span class='notice'>You are not wearing a suitable mask or helmet.</span>")
return 0
C.update_action_buttons_icon()
/obj/item/weapon/tank/examine(mob/user)
var/obj/icon = src
if(istype(src.loc, /obj/item/assembly))
icon = src.loc
if(istype(loc, /obj/item/assembly))
icon = loc
if(!in_range(src, user))
if(icon == src)
to_chat(user, "\blue It's \a [bicon(icon)][src]! If you want any more information you'll need to get closer.")
return
var/celsius_temperature = src.air_contents.temperature-T0C
var/celsius_temperature = air_contents.temperature-T0C
var/descriptive
if(celsius_temperature < 20)
@@ -70,11 +107,11 @@
/obj/item/weapon/tank/blob_act()
if(prob(50))
var/turf/location = src.loc
var/turf/location = loc
if(!( istype(location, /turf) ))
qdel(src)
if(src.air_contents)
if(air_contents)
location.assume_air(air_contents)
qdel(src)
@@ -82,9 +119,9 @@
/obj/item/weapon/tank/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
..()
src.add_fingerprint(user)
if(istype(src.loc, /obj/item/assembly))
icon = src.loc
add_fingerprint(user)
if(istype(loc, /obj/item/assembly))
icon = loc
if((istype(W, /obj/item/device/analyzer)) && get_dist(user, src) <= 1)
atmosanalyzer_scan(air_contents, user)
@@ -93,7 +130,7 @@
bomb_assemble(W,user)
/obj/item/weapon/tank/attack_self(mob/user as mob)
if(!(src.air_contents))
if(!(air_contents))
return
ui_interact(user)
@@ -142,49 +179,23 @@
ui.set_auto_update(1)
/obj/item/weapon/tank/Topic(href, href_list)
..()
if(usr.stat|| usr.restrained())
return 0
if(src.loc != usr)
return 0
if(..())
return 1
if(href_list["dist_p"])
if(href_list["dist_p"] == "reset")
src.distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
else if(href_list["dist_p"] == "max")
src.distribute_pressure = TANK_MAX_RELEASE_PRESSURE
distribute_pressure = TANK_MAX_RELEASE_PRESSURE
else
var/cp = text2num(href_list["dist_p"])
src.distribute_pressure += cp
src.distribute_pressure = min(max(round(src.distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
distribute_pressure += cp
distribute_pressure = min(max(round(distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
if(href_list["stat"])
if(istype(loc,/mob/living/carbon))
var/mob/living/carbon/location = loc
if(location.internal == src)
location.internal = null
location.internals.icon_state = "internal0"
to_chat(usr, "\blue You close the tank release valve.")
if(location.internals)
location.internals.icon_state = "internal0"
else
toggle_internals(usr)
var/can_open_valve
if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
can_open_valve = 1
else if(istype(location,/mob/living/carbon/human))
var/mob/living/carbon/human/H = location
if(H.head && (H.head.flags & AIRTIGHT))
can_open_valve = 1
if(can_open_valve)
location.internal = src
to_chat(usr, "\blue You open \the [src] valve.")
if(location.internals)
location.internals.icon_state = "internal1"
else
to_chat(usr, "\blue You need something to connect to \the [src].")
src.add_fingerprint(usr)
add_fingerprint(usr)
return 1
@@ -226,9 +237,9 @@
var/pressure = air_contents.return_pressure()
if(pressure > TANK_FRAGMENT_PRESSURE)
if(!istype(src.loc,/obj/item/device/transfer_valve))
message_admins("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
log_game("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast] at [x], [y], [z]")
if(!istype(loc,/obj/item/device/transfer_valve))
message_admins("Explosive tank rupture! last key to touch the tank was [fingerprintslast] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
log_game("Explosive tank rupture! last key to touch the tank was [fingerprintslast] at [x], [y], [z]")
// to_chat(world, "\blue[x],[y] tank is exploding: [pressure] kPa")
//Give the gas a chance to build up more pressure through reacting
air_contents.react()
@@ -241,8 +252,8 @@
// to_chat(world, "\blue Exploding Pressure: [pressure] kPa, intensity: [range]")
explosion(epicenter, round(range*0.25), round(range*0.5), round(range), round(range*1.5))
if(istype(src.loc,/obj/item/device/transfer_valve))
qdel(src.loc)
if(istype(loc,/obj/item/device/transfer_valve))
qdel(loc)
else
qdel(src)
@@ -253,7 +264,7 @@
if(!T)
return
T.assume_air(air_contents)
playsound(src.loc, 'sound/effects/spray.ogg', 10, 1, -3)
playsound(loc, 'sound/effects/spray.ogg', 10, 1, -3)
qdel(src)
else
integrity--
@@ -8,7 +8,7 @@
w_class = 4
slot_flags = SLOT_BACK
slowdown = 1
action_button_name = "Toggle Mister"
actions_types = list(/datum/action/item_action/toggle_mister)
var/obj/item/weapon/noz
var/on = 0
@@ -22,6 +22,10 @@
/obj/item/weapon/watertank/ui_action_click()
toggle_mister()
/obj/item/weapon/watertank/item_action_slot_check(slot, mob/user)
if(slot == slot_back)
return 1
/obj/item/weapon/watertank/verb/toggle_mister()
set name = "Toggle Mister"
set category = "Object"
@@ -52,6 +56,7 @@
return new /obj/item/weapon/reagent_containers/spray/mister(src)
/obj/item/weapon/watertank/equipped(mob/user, slot)
..()
if(slot != slot_back)
remove_noz()
@@ -75,8 +80,8 @@
..()
/obj/item/weapon/watertank/MouseDrop(obj/over_object)
if(ishuman(src.loc))
var/mob/living/carbon/human/H = src.loc
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
switch(over_object.name)
if("r_hand")
if(H.r_hand)
@@ -125,6 +130,7 @@
return
/obj/item/weapon/reagent_containers/spray/mister/dropped(mob/user as mob)
..()
to_chat(user, "<span class='notice'>The mister snaps back onto the watertank.</span>")
tank.on = 0
loc = tank
@@ -198,6 +204,7 @@
return new /obj/item/weapon/extinguisher/mini/nozzle(src)
/obj/item/weapon/watertank/atmos/dropped(mob/user as mob)
..()
icon_state = "waterbackpackatmos"
if(istype(noz, /obj/item/weapon/extinguisher/mini/nozzle))
var/obj/item/weapon/extinguisher/mini/nozzle/N = noz
@@ -255,6 +262,7 @@
return
/obj/item/weapon/extinguisher/mini/nozzle/dropped(mob/user as mob)
..()
to_chat(user, "<span class='notice'>The nozzle snaps back onto the tank!</span>")
tank.on = 0
loc = tank
+2 -1
View File
@@ -90,12 +90,13 @@
return ..()
/obj/item/weapon/twohanded/dropped(mob/user)
..()
//handles unwielding a twohanded weapon when dropped as well as clearing up the offhand
if(user)
var/obj/item/weapon/twohanded/O = user.get_inactive_hand()
if(istype(O))
O.unwield(user)
return unwield(user)
return unwield(user)
/obj/item/weapon/twohanded/update_icon()
return