mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Implement better jetpack action button
This commit is contained in:
+11
-13
@@ -30,9 +30,8 @@
|
||||
return
|
||||
Remove(owner)
|
||||
owner = T
|
||||
owner.actions.Add(src)
|
||||
owner.update_action_buttons()
|
||||
return
|
||||
T.actions += src
|
||||
T.update_action_buttons()
|
||||
|
||||
/datum/action/proc/Remove(mob/living/T)
|
||||
if(button)
|
||||
@@ -40,10 +39,9 @@
|
||||
T.client.screen -= button
|
||||
qdel(button)
|
||||
button = null
|
||||
T.actions.Remove(src)
|
||||
T.actions -= src
|
||||
T.update_action_buttons()
|
||||
owner = null
|
||||
return
|
||||
|
||||
/datum/action/proc/Trigger()
|
||||
if(!Checks())
|
||||
@@ -86,7 +84,7 @@
|
||||
current_button.overlays.Cut()
|
||||
if(button_icon && button_icon_state)
|
||||
var/image/img
|
||||
img = image(button_icon,current_button,button_icon_state)
|
||||
img = image(button_icon, current_button, button_icon_state)
|
||||
img.pixel_x = 0
|
||||
img.pixel_y = 0
|
||||
current_button.overlays += img
|
||||
@@ -151,7 +149,7 @@
|
||||
|
||||
/obj/screen/movable/action_button/hide_toggle/UpdateIcon()
|
||||
overlays.Cut()
|
||||
var/image/img = image(icon,src,hidden?"show":"hide")
|
||||
var/image/img = image(icon, src, hidden ? "show" : "hide")
|
||||
overlays += img
|
||||
return
|
||||
|
||||
@@ -171,11 +169,11 @@
|
||||
#define AB_MAX_COLUMNS 10
|
||||
|
||||
/datum/hud/proc/ButtonNumberToScreenCoords(number) // TODO : Make this zero-indexed for readabilty
|
||||
var/row = round((number-1)/AB_MAX_COLUMNS)
|
||||
var/row = round((number - 1)/AB_MAX_COLUMNS)
|
||||
var/col = ((number - 1)%(AB_MAX_COLUMNS)) + 1
|
||||
|
||||
var/coord_col = "+[col-1]"
|
||||
var/coord_col_offset = 4+2*col
|
||||
var/coord_col_offset = 4 + 2 * col
|
||||
|
||||
var/coord_row = "[row ? -row : "+0"]"
|
||||
|
||||
@@ -289,7 +287,7 @@
|
||||
/datum/action/innate/proc/Deactivate()
|
||||
return
|
||||
|
||||
//Preset for action that call specific procs (consider innate)
|
||||
//Preset for action that call specific procs (consider innate).
|
||||
/datum/action/generic
|
||||
check_flags = 0
|
||||
var/procname
|
||||
@@ -298,7 +296,7 @@
|
||||
if(!..())
|
||||
return 0
|
||||
if(target && procname)
|
||||
call(target,procname)(usr)
|
||||
call(target, procname)(usr)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -312,12 +310,12 @@
|
||||
/datum/action/innate/scan_mode/Activate()
|
||||
active = 1
|
||||
owner.research_scanner = 1
|
||||
owner << "<span class='notice'> Research analyzer is now active.</span>"
|
||||
owner << "<span class='notice'>Research analyzer is now active.</span>"
|
||||
|
||||
/datum/action/innate/scan_mode/Deactivate()
|
||||
active = 0
|
||||
owner.research_scanner = 0
|
||||
owner << "<span class='notice'> Research analyzer deactivated.</span>"
|
||||
owner << "<span class='notice'>Research analyzer deactivated.</span>"
|
||||
|
||||
/datum/action/innate/scan_mode/Grant(mob/living/T)
|
||||
..(T)
|
||||
|
||||
@@ -1,69 +1,103 @@
|
||||
/datum/action/item_action/jetpack/cycle
|
||||
name = "Jetpack Mode"
|
||||
|
||||
/datum/action/item_action/jetpack/cycle/Trigger()
|
||||
if(!Checks())
|
||||
return
|
||||
|
||||
var/obj/item/weapon/tank/jetpack/J = target
|
||||
J.cycle(owner)
|
||||
return 1
|
||||
|
||||
/datum/action/item_action/jetpack/cycle/suit
|
||||
name = "Internal Jetpack Mode"
|
||||
|
||||
/datum/action/item_action/jetpack/cycle/suit/New()
|
||||
..()
|
||||
check_flags &= ~AB_CHECK_INSIDE // The jetpack is inside the suit.
|
||||
|
||||
/datum/action/item_action/jetpack/cycle/suit/CheckRemoval(mob/living/user)
|
||||
return !(target.loc in user) // Check that the suit is on the user.
|
||||
|
||||
/datum/action/item_action/jetpack/cycle/suit/IsAvailable()
|
||||
var/mob/living/carbon/human/H = owner
|
||||
if(!H.wear_suit)
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/tank/jetpack
|
||||
name = "jetpack (empty)"
|
||||
desc = "A tank of compressed gas for use as propulsion in zero-gravity areas. Use with caution."
|
||||
icon_state = "jetpack"
|
||||
w_class = 4
|
||||
item_state = "jetpack"
|
||||
w_class = 4
|
||||
distribute_pressure = ONE_ATMOSPHERE * O2STANDARD
|
||||
action_button_name = "Toggle Jetpack"
|
||||
var/datum/effect_system/trail_follow/ion/ion_trail
|
||||
var/gas_type = "o2"
|
||||
var/on = 0
|
||||
var/stabilization_on = 0
|
||||
var/volume_rate = 500 //Needed for borg jetpack transfer
|
||||
var/datum/effect_system/trail_follow/ion/ion_trail
|
||||
var/datum/action/item_action/jetpack/cycle/cycle_action
|
||||
var/cycle_action_type = /datum/action/item_action/jetpack/cycle
|
||||
|
||||
/obj/item/weapon/tank/jetpack/New()
|
||||
..()
|
||||
ion_trail = new /datum/effect_system/trail_follow/ion()
|
||||
air_contents.assert_gas(gas_type)
|
||||
air_contents.gases[gas_type][MOLES] = (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C)
|
||||
|
||||
ion_trail = new
|
||||
ion_trail.set_up(src)
|
||||
|
||||
cycle_action = new cycle_action_type(src)
|
||||
|
||||
/obj/item/weapon/tank/jetpack/verb/toggle_rockets()
|
||||
set name = "Toggle Jetpack Stabilization"
|
||||
set category = "Object"
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
/obj/item/weapon/tank/jetpack/pickup(mob/user)
|
||||
..()
|
||||
cycle_action.Grant(user)
|
||||
|
||||
/obj/item/weapon/tank/jetpack/dropped(mob/user)
|
||||
..()
|
||||
cycle_action.Remove(user)
|
||||
|
||||
/obj/item/weapon/tank/jetpack/proc/cycle(mob/user)
|
||||
if(user.incapacitated())
|
||||
return
|
||||
src.stabilization_on = !( src.stabilization_on )
|
||||
usr << "<span class='notice'>You toggle the stabilization [stabilization_on? "on":"off"].</span>"
|
||||
return
|
||||
|
||||
if(!on && !stabilization_on)
|
||||
turn_on()
|
||||
user << "<span class='notice'>You turn the thrusters on.</span>"
|
||||
else if(on && !stabilization_on)
|
||||
stabilization_on = TRUE
|
||||
user << "<span class='notice'>You turn the stabilizers on.</span>"
|
||||
else if(on && stabilization_on)
|
||||
turn_off()
|
||||
stabilization_on = FALSE
|
||||
user << "<span class='notice'>You turn the thrusters and stabilizers off.</span>"
|
||||
|
||||
/obj/item/weapon/tank/jetpack/verb/toggle()
|
||||
set name = "Toggle Jetpack"
|
||||
set category = "Object"
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
on = !on
|
||||
if(on)
|
||||
icon_state = "[icon_state]-on"
|
||||
// item_state = "[item_state]-on"
|
||||
ion_trail.start()
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
// item_state = initial(item_state)
|
||||
ion_trail.stop()
|
||||
usr << "<span class='notice'>You toggle the jetpack [on? "on":"off"].</span>"
|
||||
return
|
||||
/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
|
||||
icon_state = initial(icon_state)
|
||||
ion_trail.stop()
|
||||
|
||||
/obj/item/weapon/tank/jetpack/proc/allow_thrust(num, mob/living/user)
|
||||
if(!(src.on))
|
||||
return 0
|
||||
if((num < 0.005 || src.air_contents.total_moles() < num))
|
||||
src.ion_trail.stop()
|
||||
return 0
|
||||
if(!on)
|
||||
return
|
||||
if((num < 0.005 || air_contents.total_moles() < num))
|
||||
turn_off()
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/G = src.air_contents.remove(num)
|
||||
var/datum/gas_mixture/removed = air_contents.remove(num)
|
||||
if(removed.total_moles() < 0.005)
|
||||
turn_off()
|
||||
return
|
||||
|
||||
var/allgases = G.total_moles()
|
||||
if(allgases >= 0.005)
|
||||
return 1
|
||||
|
||||
qdel(G)
|
||||
return
|
||||
|
||||
/obj/item/weapon/tank/jetpack/ui_action_click()
|
||||
toggle()
|
||||
var/turf/T = get_turf(user)
|
||||
T.assume_air(removed)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/tank/jetpack/void
|
||||
name = "void jetpack (oxygen)"
|
||||
@@ -71,23 +105,12 @@
|
||||
icon_state = "jetpack-void"
|
||||
item_state = "jetpack-void"
|
||||
|
||||
/obj/item/weapon/tank/jetpack/void/New()
|
||||
..()
|
||||
air_contents.assert_gas("o2")
|
||||
air_contents.gases["o2"][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
|
||||
|
||||
|
||||
/obj/item/weapon/tank/jetpack/oxygen
|
||||
name = "jetpack (oxygen)"
|
||||
desc = "A tank of compressed oxygen for use as propulsion in zero-gravity areas. Use with caution."
|
||||
icon_state = "jetpack"
|
||||
item_state = "jetpack"
|
||||
|
||||
/obj/item/weapon/tank/jetpack/oxygen/New()
|
||||
..()
|
||||
air_contents.assert_gas("o2")
|
||||
air_contents.gases["o2"][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
|
||||
|
||||
/obj/item/weapon/tank/jetpack/oxygen/harness
|
||||
name = "jet harness (oxygen)"
|
||||
desc = "A lightweight tactical harness, used by those who don't want to be weighed down by traditional jetpacks."
|
||||
@@ -108,17 +131,10 @@
|
||||
/obj/item/weapon/tank/jetpack/carbondioxide
|
||||
name = "jetpack (carbon dioxide)"
|
||||
desc = "A tank of compressed carbon dioxide for use as propulsion in zero-gravity areas. Painted black to indicate that it should not be used as a source for internals."
|
||||
distribute_pressure = 0
|
||||
icon_state = "jetpack-black"
|
||||
item_state = "jetpack-black"
|
||||
|
||||
/obj/item/weapon/tank/jetpack/carbondioxide/New()
|
||||
..()
|
||||
ion_trail = new /datum/effect_system/trail_follow/ion()
|
||||
ion_trail.set_up(src)
|
||||
air_contents.assert_gas("co2")
|
||||
air_contents.gases["co2"][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
|
||||
|
||||
distribute_pressure = 0
|
||||
gas_type = "co2"
|
||||
|
||||
/obj/item/weapon/tank/jetpack/suit
|
||||
name = "suit inbuilt jetpack"
|
||||
@@ -126,51 +142,37 @@
|
||||
icon_state = "jetpack-void"
|
||||
item_state = "jetpack-void"
|
||||
var/obj/item/weapon/tank/internals/tank = null
|
||||
action_button_name = "Toggle Jetpack"
|
||||
action_button_internal = 1
|
||||
cycle_action_type = /datum/action/item_action/jetpack/cycle/suit
|
||||
|
||||
/obj/item/weapon/tank/jetpack/suit/New()
|
||||
..()
|
||||
SSobj.processing -= src
|
||||
air_contents = null
|
||||
|
||||
/obj/item/weapon/tank/jetpack/suit/toggle()
|
||||
set name = "Toggle Jetpack"
|
||||
set category = "Object"
|
||||
/obj/item/weapon/tank/jetpack/suit/cycle(mob/user)
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(!istype(H.s_store, /obj/item/weapon/tank/internals))
|
||||
user << "<span class='warning'>You need a tank in your suit storage!</span>"
|
||||
return
|
||||
..()
|
||||
|
||||
if(istype(loc.loc,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = loc.loc
|
||||
/obj/item/weapon/tank/jetpack/suit/turn_on()
|
||||
if(!ishuman(loc.loc))
|
||||
return
|
||||
var/mob/living/carbon/human/H = loc.loc
|
||||
tank = H.s_store
|
||||
air_contents = tank.air_contents
|
||||
SSobj.processing |= src
|
||||
..()
|
||||
|
||||
if(!H.wear_suit)
|
||||
H << "<span class='warning'>You must be wearing the suit to use the inbuilt jetpack!</span>"
|
||||
return
|
||||
if(!istype(H.s_store,/obj/item/weapon/tank/internals))
|
||||
H << "<span class='warning'>You must have a tank in your suit's storage to use the inbuilt jetpack!</span>"
|
||||
return
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
|
||||
on = !on
|
||||
if(on)
|
||||
ion_trail.start()
|
||||
tank = H.s_store
|
||||
air_contents = tank.air_contents
|
||||
SSobj.processing |= src
|
||||
icon_state = "[icon_state]-on"
|
||||
else
|
||||
turn_off()
|
||||
H << "<span class='notice'>You toggle the inbuilt jetpack [on? "on":"off"].</span>"
|
||||
|
||||
/obj/item/weapon/tank/jetpack/suit/proc/turn_off()
|
||||
on = 0
|
||||
SSobj.processing -= src
|
||||
ion_trail.stop()
|
||||
air_contents = null
|
||||
/obj/item/weapon/tank/jetpack/suit/turn_off()
|
||||
tank = null
|
||||
icon_state = initial(icon_state)
|
||||
air_contents = null
|
||||
SSobj.processing -= src
|
||||
..()
|
||||
|
||||
/obj/item/weapon/tank/jetpack/suit/process()
|
||||
if(!istype(loc.loc,/mob/living/carbon/human))
|
||||
if(!ishuman(loc.loc))
|
||||
turn_off()
|
||||
return
|
||||
var/mob/living/carbon/human/H = loc.loc
|
||||
|
||||
@@ -8,15 +8,7 @@
|
||||
back = /obj/item/weapon/tank/jetpack/oxygen
|
||||
mask = /obj/item/clothing/mask/breath
|
||||
|
||||
/datum/outfit/space/post_equip(mob/living/carbon/human/H)
|
||||
var/obj/item/weapon/tank/jetpack/J = H.back
|
||||
J.toggle()
|
||||
J.Topic(null, list("stat" = 1))
|
||||
|
||||
|
||||
/datum/outfit/tournament
|
||||
|
||||
/datum/outfit/tournament/
|
||||
name = "tournament standard red"
|
||||
|
||||
uniform = /obj/item/clothing/under/color/red
|
||||
@@ -27,14 +19,14 @@
|
||||
l_hand = /obj/item/weapon/kitchen/knife
|
||||
r_pocket = /obj/item/weapon/grenade/smokebomb
|
||||
|
||||
|
||||
/datum/outfit/tournament/red
|
||||
/datum/outfit/tournament/green
|
||||
name = "tournament standard green"
|
||||
|
||||
uniform = /obj/item/clothing/under/color/green
|
||||
|
||||
/datum/outfit/tournament/gangster
|
||||
name = "tournament gangster"
|
||||
|
||||
uniform = /obj/item/clothing/under/rank/det
|
||||
suit = /obj/item/clothing/suit/det_suit
|
||||
glasses = /obj/item/clothing/glasses/thermal/monocle
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//Baseline hardsuits
|
||||
|
||||
|
||||
/obj/item/clothing/head/helmet/space/hardsuit
|
||||
name = "hardsuit helmet"
|
||||
desc = "A special helmet designed for work in a hazardous, low-pressure environment. Has radiation shielding."
|
||||
@@ -77,15 +75,15 @@
|
||||
var/helmettype = /obj/item/clothing/head/helmet/space/hardsuit
|
||||
var/obj/item/weapon/tank/jetpack/suit/jetpack = null
|
||||
|
||||
/obj/item/clothing/suit/space/hardsuit/verb/Jetpack()
|
||||
set name = "Toggle Inbuilt Jetpack"
|
||||
set category = "Object"
|
||||
jetpack.toggle()
|
||||
/obj/item/clothing/suit/space/hardsuit/equipped(mob/user, slot)
|
||||
..()
|
||||
if(slot == slot_wear_suit && jetpack)
|
||||
jetpack.cycle_action.Grant(user)
|
||||
|
||||
/obj/item/clothing/suit/space/hardsuit/verb/Jetpack_Rockets()
|
||||
set name = "Toggle Inbuilt Jetpack Stabilization"
|
||||
set category = "Object"
|
||||
jetpack.toggle_rockets()
|
||||
/obj/item/clothing/suit/space/hardsuit/dropped(mob/user)
|
||||
..()
|
||||
if(jetpack)
|
||||
jetpack.cycle_action.Remove(user)
|
||||
|
||||
//Engineering
|
||||
/obj/item/clothing/head/helmet/space/hardsuit/engine
|
||||
|
||||
@@ -92,10 +92,8 @@
|
||||
//Hardsuit toggle code
|
||||
/obj/item/clothing/suit/space/hardsuit/New()
|
||||
MakeHelmet()
|
||||
if(!jetpack)
|
||||
verbs -= /obj/item/clothing/suit/space/hardsuit/verb/Jetpack
|
||||
verbs -= /obj/item/clothing/suit/space/hardsuit/verb/Jetpack_Rockets
|
||||
..()
|
||||
|
||||
/obj/item/clothing/suit/space/hardsuit/Destroy()
|
||||
if(helmet)
|
||||
helmet.suit = null
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
return 1
|
||||
|
||||
/datum/action/item_action/hands_free/activate_pill
|
||||
name = "activate pill"
|
||||
name = "Activate Pill"
|
||||
|
||||
/datum/action/item_action/hands_free/activate_pill/Trigger()
|
||||
if(!..() || CheckRemoval(owner))
|
||||
|
||||
Reference in New Issue
Block a user