diff --git a/code/game/objects/items/weapons/tanks/jetpack.dm b/code/game/objects/items/weapons/tanks/jetpack.dm index 72394db2733..21f43073b73 100644 --- a/code/game/objects/items/weapons/tanks/jetpack.dm +++ b/code/game/objects/items/weapons/tanks/jetpack.dm @@ -48,38 +48,38 @@ return if(!on) - turn_on() + turn_on(user) to_chat(user, "You turn the jetpack on.") else - turn_off() + turn_off(user) to_chat(user, "You turn the jetpack off.") for(var/X in actions) var/datum/action/A = X A.UpdateButtonIcon() -/obj/item/tank/jetpack/proc/turn_on() +/obj/item/tank/jetpack/proc/turn_on(mob/user) on = TRUE icon_state = "[initial(icon_state)]-on" ion_trail.start() -/obj/item/tank/jetpack/proc/turn_off() +/obj/item/tank/jetpack/proc/turn_off(mob/user) on = FALSE stabilizers = FALSE icon_state = initial(icon_state) ion_trail.stop() -/obj/item/tank/jetpack/proc/allow_thrust(num, mob/living/user as mob) +/obj/item/tank/jetpack/proc/allow_thrust(num, mob/living/user) if(!on) return 0 if((num < 0.005 || air_contents.total_moles() < num)) - turn_off() + turn_off(user) return 0 var/datum/gas_mixture/removed = air_contents.remove(num) if(removed.total_moles() < 0.005) - turn_off() + turn_off(user) return 0 var/turf/T = get_turf(user) @@ -163,15 +163,65 @@ to_chat(user, "The meter on [src] indicates you are almost out of air!") playsound(user, 'sound/effects/alert.ogg', 50, 1) -/obj/item/tank/jetpack/carbondioxide/mining - name = "mining jetpack" +/obj/item/tank/jetpack/suit + name = "hardsuit jetpack upgrade" + desc = "A modular, compact set of thrusters designed to integrate with a hardsuit. It is fueled by a tank inserted into the suit's storage compartment." icon_state = "jetpack-mining" - item_state = "jetpack-mining" + item_state = "jetpack-black" origin_tech = "materials=4;magnets=4;engineering=5" - desc = "A tank of compressed carbon dioxide for miners to use as propulsion in local space. The compact size allows for easy storage at the cost of capacity." - volume = 40 - throw_range = 7 - w_class = WEIGHT_CLASS_NORMAL //same as syndie harness + w_class = WEIGHT_CLASS_NORMAL + actions_types = list(/datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization) + volume = 1 + slot_flags = null + var/datum/gas_mixture/temp_air_contents + var/obj/item/tank/tank = null + var/mob/living/carbon/human/cur_user + +/obj/item/tank/jetpack/suit/New() + ..() + STOP_PROCESSING(SSobj, src) + temp_air_contents = air_contents + +/obj/item/tank/jetpack/suit/attack_self() + return + +/obj/item/tank/jetpack/suit/cycle(mob/user) + if(!istype(loc, /obj/item/clothing/suit/space/hardsuit)) + to_chat(user, "[src] must be connected to a hardsuit!") + return + + var/mob/living/carbon/human/H = user + if(!istype(H.s_store, /obj/item/tank)) + to_chat(user, "You need a tank in your suit storage!") + return + ..() + +/obj/item/tank/jetpack/suit/turn_on(mob/user) + if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc) || loc.loc != user) + return + var/mob/living/carbon/human/H = user + tank = H.s_store + air_contents = tank.air_contents + START_PROCESSING(SSobj, src) + cur_user = user + ..() + +/obj/item/tank/jetpack/suit/turn_off(mob/user) + tank = null + air_contents = temp_air_contents + STOP_PROCESSING(SSobj, src) + cur_user = null + ..() + +/obj/item/tank/jetpack/suit/process() + if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc)) + turn_off(cur_user) + return + var/mob/living/carbon/human/H = loc.loc + if(!tank || tank != H.s_store) + turn_off(cur_user) + return + ..() /obj/item/tank/jetpack/rig name = "jetpack" @@ -182,7 +232,7 @@ to_chat(usr, "It's a jetpack. If you can see this, report it on the bug tracker.") return 0 -/obj/item/tank/jetpack/rig/allow_thrust(num, mob/living/user as mob) +/obj/item/tank/jetpack/rig/allow_thrust(num, mob/living/user) if(!on) return 0 @@ -191,7 +241,7 @@ var/datum/gas_mixture/removed = holder.air_supply.air_contents.remove(num) if(removed.total_moles() < 0.005) - turn_off() + turn_off(user) return 0 var/turf/T = get_turf(user) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/engineering.dm b/code/game/objects/structures/crates_lockers/closets/secure/engineering.dm index 0cd6e541398..2686b521684 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/engineering.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/engineering.dm @@ -25,6 +25,7 @@ new /obj/item/clothing/glasses/welding/superior(src) new /obj/item/clothing/gloves/color/yellow(src) new /obj/item/clothing/shoes/brown(src) + new /obj/item/tank/jetpack/suit(src) new /obj/item/cartridge/ce(src) new /obj/item/radio/headset/heads/ce(src) new /obj/item/storage/toolbox/mechanical(src) diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index 4c74aba8c93..2edb4704d21 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -93,6 +93,7 @@ var/obj/item/clothing/head/helmet/space/hardsuit/helmet actions_types = list(/datum/action/item_action/toggle_helmet) var/helmettype = /obj/item/clothing/head/helmet/space/hardsuit + var/obj/item/tank/jetpack/suit/jetpack = null hide_tail_by_species = list("Vox" , "Vulpkanin" , "Unathi" , "Tajaran") species_restricted = list("exclude","Diona","Wryn") @@ -112,10 +113,59 @@ "Vulpkanin" = 'icons/obj/clothing/species/vulpkanin/suits.dmi' ) +/obj/item/clothing/suit/space/hardsuit/New() + if(jetpack && ispath(jetpack)) + jetpack = new jetpack(src) + ..() + /obj/item/clothing/suit/space/hardsuit/attack_self(mob/user) user.changeNext_move(CLICK_CD_MELEE) ..() +/obj/item/clothing/suit/space/hardsuit/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/tank/jetpack/suit)) + if(jetpack) + to_chat(user, "[src] already has a jetpack installed.") + return + if(src == user.get_item_by_slot(slot_wear_suit)) //Make sure the player is not wearing the suit before applying the upgrade. + to_chat(user, "You cannot install the upgrade to [src] while wearing it.") + return + + if(user.unEquip(I)) + I.forceMove(src) + jetpack = I + to_chat(user, "You successfully install the jetpack into [src].") + return + else if(isscrewdriver(I)) + if(!jetpack) + to_chat(user, "[src] has no jetpack installed.") + return + if(src == user.get_item_by_slot(slot_wear_suit)) + to_chat(user, "You cannot remove the jetpack from [src] while wearing it.") + return + + jetpack.turn_off(user) + jetpack.forceMove(drop_location()) + jetpack = null + to_chat(user, "You successfully remove the jetpack from [src].") + return + return ..() + +/obj/item/clothing/suit/space/hardsuit/equipped(mob/user, slot) + ..() + if(jetpack) + if(slot == slot_wear_suit) + for(var/X in jetpack.actions) + var/datum/action/A = X + A.Grant(user) + +/obj/item/clothing/suit/space/hardsuit/dropped(mob/user) + ..() + if(jetpack) + for(var/X in jetpack.actions) + var/datum/action/A = X + A.Remove(user) + /obj/item/clothing/suit/space/hardsuit/item_action_slot_check(slot) if(slot == slot_wear_suit) //we only give the mob the ability to toggle the helmet if he's wearing the hardsuit. return 1 @@ -178,6 +228,7 @@ heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS //Uncomment to enable firesuit protection max_heat_protection_temperature = FIRE_IMMUNITY_MAX_TEMP_PROTECT helmettype = /obj/item/clothing/head/helmet/space/hardsuit/engine/elite + jetpack = /obj/item/tank/jetpack/suit //Mining hardsuit /obj/item/clothing/head/helmet/space/hardsuit/mining @@ -291,6 +342,7 @@ armor = list(melee = 40, bullet = 50, laser = 30, energy = 15, bomb = 35, bio = 100, rad = 50) allowed = list(/obj/item/gun, /obj/item/ammo_box,/obj/item/ammo_casing, /obj/item/melee/baton, /obj/item/melee/energy/sword, /obj/item/restraints/handcuffs, /obj/item/tank) helmettype = /obj/item/clothing/head/helmet/space/hardsuit/syndi + jetpack = /obj/item/tank/jetpack/suit /obj/item/clothing/suit/space/hardsuit/syndi/update_icon() icon_state = "hardsuit[on]-[item_color]" @@ -438,6 +490,7 @@ icon_state = "hardsuit-hos" armor = list(melee = 45, bullet = 25, laser = 30, energy = 10, bomb = 25, bio = 100, rad = 50) helmettype = /obj/item/clothing/head/helmet/space/hardsuit/security/hos + jetpack = /obj/item/tank/jetpack/suit sprite_sheets = null //Singuloth armor @@ -522,6 +575,7 @@ allowed = list(/obj/item/gun,/obj/item/ammo_box,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword/saber,/obj/item/restraints/handcuffs,/obj/item/tank) slowdown = 0 helmettype = /obj/item/clothing/head/helmet/space/hardsuit/shielded/syndi + jetpack = /obj/item/tank/jetpack/suit sprite_sheets = list( "Unathi" = 'icons/mob/species/unathi/suit.dmi', "Tajaran" = 'icons/mob/species/tajaran/suit.dmi', diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm index 871eab23d3b..576b3e6c552 100644 --- a/code/modules/clothing/suits/toggles.dm +++ b/code/modules/clothing/suits/toggles.dm @@ -6,7 +6,8 @@ /obj/item/clothing/suit/space/hardsuit/Destroy() if(helmet) helmet.suit = null - qdel(helmet) + QDEL_NULL(helmet) + QDEL_NULL(jetpack) return ..() /obj/item/clothing/head/helmet/space/hardsuit/Destroy() diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index 229b9053ae6..4de84bb70c4 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -37,7 +37,7 @@ new /datum/data/mining_equipment("Lazarus Injector", /obj/item/lazarus_injector, 1000), new /datum/data/mining_equipment("Silver Pickaxe", /obj/item/pickaxe/silver, 1000), new /datum/data/mining_equipment("Mining Conscription Kit", /obj/item/storage/backpack/duffel/mining_conscript, 1500), - new /datum/data/mining_equipment("Jetpack", /obj/item/tank/jetpack/carbondioxide/mining, 2000), + new /datum/data/mining_equipment("Jetpack Upgrade", /obj/item/tank/jetpack/suit, 2000), new /datum/data/mining_equipment("Mining Hardsuit", /obj/item/clothing/suit/space/hardsuit/mining, 2000), new /datum/data/mining_equipment("Diamond Pickaxe", /obj/item/pickaxe/diamond, 2000), new /datum/data/mining_equipment("Super Resonator", /obj/item/resonator/upgraded, 2500), diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 925e979c11d..b15f77cf97a 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -11,10 +11,11 @@ //Do we have a working jetpack? var/obj/item/tank/jetpack/thrust - if(istype(back,/obj/item/tank/jetpack)) + if(istype(back, /obj/item/tank/jetpack)) thrust = back - else if(istype(s_store,/obj/item/tank/jetpack)) - thrust = s_store + else if(istype(wear_suit, /obj/item/clothing/suit/space/hardsuit)) + var/obj/item/clothing/suit/space/hardsuit/C = wear_suit + thrust = C.jetpack else if(istype(back,/obj/item/rig)) var/obj/item/rig/rig = back for(var/obj/item/rig_module/maneuvering_jets/module in rig.installed_modules)