Merge pull request #6175 from Allfd/RigPort

Ports MarsM0nd's RIG suit fixes.
This commit is contained in:
Fox McCloud
2017-01-26 07:33:15 -05:00
committed by GitHub
19 changed files with 231 additions and 34 deletions
+2 -2
View File
@@ -92,7 +92,7 @@ var/global/list/breach_burn_descriptors = list(
if(!breaches)
breaches = list()
if(damage > 25) return //We don't need to keep tracking it when it's at 250% pressure loss, really.
if(damage >= 25) return //We don't need to keep tracking it when it's at 250% pressure loss, really.
if(!loc) return
var/turf/T = get_turf(src)
@@ -125,7 +125,7 @@ var/global/list/breach_burn_descriptors = list(
var/datum/breach/B = new()
breaches += B
B.class = min(amount,5)
B.class = min(amount,(5 - max(damage - 20,0))) //We cap the check at 25, this line could overshoot without the calculation if it gets enough dammage in one shot.
B.damtype = damtype
B.update_descriptor()
@@ -119,7 +119,7 @@
gun.attack_self(holder.wearer)
return 1
gun.process_fire(target,holder.wearer)
gun.afterattack(target,holder.wearer)
return 1
/obj/item/rig_module/mounted/egun
@@ -0,0 +1,50 @@
/obj/item/rig_module/handheld
name = "mounted device"
desc = "Some kind of hardsuit extension."
usable = 0
selectable = 0
toggleable = 1
disruptive = 0
activate_string = "Deploy"
deactivate_string = "Retract"
var/device_type
var/obj/item/device
/obj/item/rig_module/handheld/activate()
if(!..())
return
if(!holder.wearer.put_in_hands(device))
to_chat(holder.wearer, "<span class='notice'>You need a free hand to hold \the [device].</span>")
active = 0
return
to_chat(holder.wearer, "<span class='notice'>You deploy \the [device].</span>")
/obj/item/rig_module/handheld/deactivate()
if(!..())
return
if(ismob(device.loc)) //Better check for the holder, instead of assuming the rigwearer has it.
var/mob/M = device.loc //Helps in case the code fails to keep the module in one place, this should still return it.
M.unEquip(device, 1)
device.loc = src
to_chat(holder.wearer, "<span class='notice'>You retract \the [device].</span>")
/obj/item/rig_module/handheld/New()
..()
if(device_type)
device = new device_type(src)
device.flags |= NODROP //We don't want to drop it while it's active/inhand.
activate_string += " [device]"
deactivate_string += " [device]"
/obj/item/rig_module/handheld/horn
name = "mounted bikehorn"
desc = "For tactical honking"
interface_name = "mounted bikehorn"
interface_desc = "Honks"
device_type = /obj/item/weapon/bikehorn
@@ -94,7 +94,9 @@
*/
/obj/item/rig_module/device/New()
..()
if(device_type) device = new device_type(src)
if(device_type)
device = new device_type(src)
device.flags |= ABSTRACT //Abstract in the sense that it's not an item that stands alone, but rather is just there to let the module act like it.
/obj/item/rig_module/device/engage(atom/target)
if(!..() || !device)
@@ -417,13 +419,15 @@
interface_desc = "Leave your mark."
engage_string = "Toggle stamp type"
usable = 1
var/iastamp
var/deniedstamp
var/obj/iastamp //Theese were just vars, but any device would need to be an object
var/obj/deniedstamp //Stops assigning non-objects to theese vars, which probably would break quite a bit.
/obj/item/rig_module/device/stamp/New()
..()
iastamp = new /obj/item/weapon/stamp/law(src)
deniedstamp = new /obj/item/weapon/stamp/denied(src)
iastamp.flags |= ABSTRACT
deniedstamp.flags |= ABSTRACT
device = iastamp
/obj/item/rig_module/device/stamp/engage(atom/target)
@@ -488,4 +492,4 @@
W.update_icon()
/obj/item/rig_module/welding_tank/proc/get_fuel()
return reagents.get_reagent_amount("fuel")
return reagents.get_reagent_amount("fuel")
+63 -13
View File
@@ -42,7 +42,7 @@
//Component/device holders.
var/obj/item/weapon/tank/air_supply // Air tank, if any.
var/obj/item/clothing/shoes/boots = null // Deployable boots, if any.
var/obj/item/clothing/shoes/magboots/boots = null // Deployable boots, if any.
var/obj/item/clothing/suit/space/new_rig/chest // Deployable chestpiece, if any.
var/obj/item/clothing/head/helmet/space/new_rig/helmet = null // Deployable helmet, if any.
var/obj/item/clothing/gloves/rig/gloves = null // Deployable gauntlets, if any.
@@ -76,6 +76,7 @@
var/airtight = 1 //If set, will adjust AIRTIGHT and STOPSPRESSUREDMAGE flags on components. Otherwise it should leave them untouched.
var/emp_protection = 0
var/has_emergency_release = 1 //Allows suit to be removed from outside.
// Wiring! How exciting.
var/datum/wires/rig/wires
@@ -126,14 +127,17 @@
if(helm_type)
helmet = new helm_type(src)
verbs |= /obj/item/weapon/rig/proc/toggle_helmet
helmet.item_color="[initial(icon_state)]_sealed" //For the lightswitching to know the correct string to manipulate
if(boot_type)
boots = new boot_type(src)
verbs |= /obj/item/weapon/rig/proc/toggle_boots
boots.magboot_state="[initial(icon_state)]_sealed" //For the magboot (de)activation to know the correct string to manipulate
if(chest_type)
chest = new chest_type(src)
if(allowed)
chest.allowed = allowed
chest.slowdown = offline_slowdown
chest.holder = src
verbs |= /obj/item/weapon/rig/proc/toggle_chest
for(var/obj/item/piece in list(gloves,helmet,boots,chest))
@@ -183,6 +187,10 @@
/obj/item/weapon/rig/proc/reset()
offline = 2
flags &= ~NODROP
if(helmet && helmet.on)
helmet.toggle_light(wearer)
if(boots && boots.magpulse)
boots.attack_self(wearer)
for(var/obj/item/piece in list(helmet,boots,gloves,chest))
if(!piece) continue
piece.icon_state = "[initial(icon_state)]"
@@ -254,6 +262,7 @@
switch(msg_type)
if("boots")
to_chat(wearer, "<font color='blue'>\The [correct_piece] seal around your feet.</font>")
correct_piece.icon_state = "[initial(icon_state)]_sealed0" //Solution to not need a sprite for off, on, and unused magboots.
if(user != wearer)
to_chat(user, "<span class='notice'>\The [correct_piece] has been sealed.</span>")
wearer.update_inv_shoes()
@@ -269,6 +278,7 @@
wearer.update_inv_wear_suit()
if("helmet")
to_chat(wearer, "<font color='blue'>\The [correct_piece] hisses closed.</font>")
correct_piece.icon_state = "[initial(icon_state)]_sealed0" //Solution to not need a sprite for off, on, and unused helmet light.
if(user != wearer)
to_chat(user, "<span class='notice'>\The [correct_piece] has been sealed.</span>")
wearer.update_inv_head()
@@ -383,10 +393,14 @@
sealing = FALSE
if(failed_to_seal)
for(var/obj/item/piece in list(helmet, boots, gloves, chest))
for(var/obj/item/piece in list(gloves, chest))
if(!piece)
continue
piece.icon_state = "[initial(icon_state)]_sealed"
if(helmet)
helmet.icon_state = "[initial(icon_state)]_sealed[helmet.on]"
if(boots)
boots.icon_state = "[initial(icon_state)]_sealed[boots.magpulse]"
if(airtight)
update_component_sealed()
update_icon(1)
@@ -406,6 +420,10 @@
update_icon(1)
/obj/item/weapon/rig/proc/update_component_sealed()
if(istype(boots) && !(flags & NODROP) && boots.magpulse) //If we have (active) boots and unsealed the suit, we deactivate the magboots.
boots.attack_self(wearer)
if(istype(helmet) && !(flags & NODROP) && helmet.on) //If we have an (active) headlamp and unsealed the suit, we deactivate the headlamp.
helmet.toggle_light(wearer)
for(var/obj/item/piece in list(helmet,boots,gloves,chest))
if(!(flags & NODROP))
piece.flags &= ~STOPSPRESSUREDMAGE
@@ -695,6 +713,8 @@
M.visible_message("<font color='blue'><b>[M] struggles into \the [src].</b></font>", "<font color='blue'><b>You struggle into \the [src].</b></font>")
wearer = M
wearer.wearing_rig = src
if(has_emergency_release)
M.verbs |= /obj/item/weapon/rig/proc/emergency_release
update_icon()
/obj/item/weapon/rig/proc/toggle_piece(var/piece, var/mob/living/user, var/deploy_mode, var/force)
@@ -705,15 +725,15 @@
if(isliving(uneq_piece.loc))
var/mob/living/L = uneq_piece.loc
L.unEquip(uneq_piece, 1)
uneq_piece.flags &= ~NODROP
uneq_piece.forceMove(src)
return 0
if(sealing || !cell || !cell.charge)
return 0
if(user == wearer && user.incapacitated()) // If the user isn't wearing the suit it's probably an AI.
return 0
if(!(deploy_mode == ONLY_RETRACT && force)) //This should be the case while stripping, stripping does trigger the if statement below.
if(user == wearer && user.incapacitated()) // If the user isn't wearing the suit it's probably an AI.
return 0
var/obj/item/check_slot
var/equip_to
@@ -752,7 +772,6 @@
if(to_strip)
to_strip.unEquip(use_obj, 1)
use_obj.flags &= ~NODROP
use_obj.forceMove(src)
if(wearer)
to_chat(wearer, "<span class='notice'>Your [use_obj] [use_obj.gender == PLURAL ? "retract" : "retracts"] swiftly.")
@@ -762,13 +781,11 @@
to_chat(wearer, "<span class='danger'>You are unable to deploy \the [piece] as \the [check_slot] [check_slot.gender == PLURAL ? "are" : "is"] in the way.</span>")
return
use_obj.forceMove(wearer)
use_obj.flags &= ~NODROP
if(!wearer.equip_to_slot_if_possible(use_obj, equip_to, 0, 1))
use_obj.forceMove(src)
else
if(wearer)
to_chat(wearer, "<span class='notice'>Your [use_obj.name] [use_obj.gender == PLURAL ? "deploy" : "deploys"] swiftly.</span>")
use_obj.flags |= NODROP
if(piece == "helmet" && helmet)
helmet.update_light(wearer)
@@ -777,17 +794,17 @@
if(!wearer || !user)
return 0
if(flags & NODROP)
if(wearer.head && wearer.head != helmet)
if(flags & NODROP) //We need to check if we have the part, the person is wearing something in the parts slot, and if yes, are they the same.
if(helmet && wearer.head && wearer.head != helmet)
to_chat(user, "<span class='danger'>\The [wearer.head] is blocking \the [src] from deploying!</span>")
return 0
if(wearer.gloves && wearer.gloves != gloves)
if(gloves && wearer.gloves && wearer.gloves != gloves)
to_chat(user, "<span class='danger'>\The [wearer.gloves] is preventing \the [src] from deploying!</span>")
return 0
if(wearer.shoes && wearer.shoes != boots)
if(boots && wearer.shoes && wearer.shoes != boots)
to_chat(user, "<span class='danger'>\The [wearer.shoes] is preventing \the [src] from deploying!</span>")
return 0
if(wearer.wear_suit && wearer.wear_suit != chest)
if(chest && wearer.wear_suit && wearer.wear_suit != chest)
to_chat(user, "<span class='danger'>\The [wearer.wear_suit] is preventing \the [src] from deploying!</span>")
return 0
@@ -797,6 +814,7 @@
/obj/item/weapon/rig/dropped(var/mob/user)
..()
user.verbs -= /obj/item/weapon/rig/proc/emergency_release
for(var/piece in list("helmet","gauntlets","chest","boots"))
toggle_piece(piece, user, ONLY_RETRACT, 1)
if(wearer)
@@ -996,6 +1014,38 @@
else
return null
/obj/item/weapon/rig/proc/emergency_release()
set name = "Suit Emergency Release"
set desc = "Activate the suits emergency release system."
set category = "Object"
set src in oview(1)
var/obj/item/weapon/rig/T = get_rig()
return T.do_emergency_release(usr)
/obj/item/weapon/rig/proc/do_emergency_release(var/mob/living/user)
if(!can_touch(user, wearer) || !has_emergency_release)
return can_touch(user,wearer)
usr.visible_message("<span class='warning'>[user] starts activating \the [src] emergency seals release!</span>")
if(!do_after(user,240, target = wearer))
to_chat(user, "<span class='notice'>You need to focus on activating the emergency release.</span>")
return 0
usr.visible_message("<span class='warning'>[user] activated \the [src] emergency seals release!</span>")
malfunctioning += 1
malfunction_delay = 30
unseal(user)
return 1
/obj/item/weapon/rig/proc/can_touch(var/mob/user, var/mob/wearer)
if(!user)
return 0
if(!wearer.Adjacent(user))
return 0
if(user.restrained())
to_chat(user, "<span class='notice'>You need your hands free for this.</span>")
return 0
if(user.stat || user.paralysis || user.sleeping || user.lying || user.weakened)
return 0
return 1
#undef ONLY_DEPLOY
#undef ONLY_RETRACT
#undef SEAL_DELAY
@@ -0,0 +1,21 @@
/obj/item/clothing/suit/space/new_rig/calc_breach_damage()
..()
holder.update_armor() //New dammage, new armormultiplikator.
return damage
/obj/item/weapon/rig/proc/update_armor()
var/multi = 1 //Multiplicative modification to the armor, maybe add an additive later on
if(chest)
multi *= (100 - chest.damage) / 100 //If we have some breaches, lower the armor value.
//TODO check for other armor mods, likely modules, which need to be coded.
for(var/obj/item/piece in list(gloves, helmet, boots, chest))
if(!istype(piece)) //Do we have the piece
continue
if(islist(armor)) //Did we even give them some armor, if this is the case, the list should be initialized from New()
var/list/L = armor
for(var/armortype in L)
piece.armor[armortype] = L[armortype]*multi
//Perfect place to also add something like shield modules, or any other hit_reaction modules check.
@@ -141,7 +141,7 @@
if(user.r_hand && user.l_hand)
cell.forceMove(get_turf(user))
else
cell.forceMove(user.put_in_hands(cell))
user.put_in_hands(cell)
cell = null
else
to_chat(user, "There is nothing loaded in that mount.")
@@ -4,7 +4,7 @@
/obj/item/clothing/head/helmet/space/new_rig
name = "helmet"
flags = HEADCOVERSEYES | BLOCKHAIR | HEADCOVERSMOUTH | THICKMATERIAL
flags = HEADCOVERSEYES | BLOCKHAIR | HEADCOVERSMOUTH | THICKMATERIAL | NODROP
flags_inv = HIDEEARS|HIDEEYES|HIDEFACE|HIDEMASK
body_parts_covered = HEAD
heat_protection = HEAD
@@ -12,11 +12,12 @@
var/brightness_on = 4
var/on = 0
sprite_sheets = list(
"Tajara" = 'icons/mob/species/tajaran/helmet.dmi',
"Tajaran" = 'icons/mob/species/tajaran/helmet.dmi',
"Skrell" = 'icons/mob/species/skrell/helmet.dmi',
"Unathi" = 'icons/mob/species/unathi/helmet.dmi'
)
species_restricted = null
actions_types = list(/datum/action/item_action/toggle_helmet_light)
flash_protect = 2
@@ -28,13 +29,17 @@
toggle_light(user)
/obj/item/clothing/head/helmet/space/new_rig/proc/toggle_light(mob/user)
on = !on
icon_state = "rig[on]-[item_color]"
if(flags & AIRTIGHT) //Could also check for STOPSPRESSUREDMAGE, but one is enough, both get toggled when the seal gets toggled.
if(on)
set_light(brightness_on)
on = !on
icon_state = "[item_color][on]"
if(on)
set_light(brightness_on)
else
set_light(0)
else
set_light(0)
to_chat(user, "<span class='warning'>You cannot turn the light on while the suit isn't sealed.</span>")
if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
@@ -42,7 +47,7 @@
/obj/item/clothing/gloves/rig
name = "gauntlets"
flags = THICKMATERIAL
flags = THICKMATERIAL | NODROP
body_parts_covered = HANDS
heat_protection = HANDS
cold_protection = HANDS
@@ -51,12 +56,19 @@
/obj/item/clothing/shoes/magboots/rig
name = "boots"
flags = NODROP
body_parts_covered = FEET
cold_protection = FEET
heat_protection = FEET
species_restricted = null
gender = PLURAL
/obj/item/clothing/shoes/magboots/rig/attack_self(mob/user)
if(flags & AIRTIGHT) //Could also check for STOPSPRESSUREDMAGE, but one is enough, both get toggled when the seal gets toggled.
..(user)
else
to_chat(user, "<span class='warning'>You cannot activate mag-pulse traction system while the suit is not sealed.</span>")
/obj/item/clothing/suit/space/new_rig
name = "chestpiece"
allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank)
@@ -64,14 +76,14 @@
heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS
cold_protection = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS
flags_inv = HIDEJUMPSUIT|HIDETAIL
flags = STOPSPRESSUREDMAGE | THICKMATERIAL | AIRTIGHT
flags = STOPSPRESSUREDMAGE | THICKMATERIAL | AIRTIGHT | NODROP
slowdown = 0
//will reach 10 breach damage after 25 laser carbine blasts, 3 revolver hits, or ~1 PTR hit. Completely immune to smg or sts hits.
breach_threshold = 38
breach_threshold = 20
resilience = 0.2
can_breach = 1
var/obj/item/weapon/rig/holder
sprite_sheets = list(
"Tajara" = 'icons/mob/species/tajaran/suit.dmi',
"Tajaran" = 'icons/mob/species/tajaran/suit.dmi',
"Unathi" = 'icons/mob/species/unathi/suit.dmi'
)
@@ -112,7 +112,7 @@
name = "stealth suit control module"
suit_type = "stealth"
desc = "A highly advanced and expensive suit designed for covert operations."
icon_state = "stealth_rig"
icon_state = "ninja_rig" //supposed to be "stealth_rig", but as it currently only has a semi-copied ninja rig sprite, we can just use them directly.
req_access = list(access_syndicate)
+58
View File
@@ -0,0 +1,58 @@
//Procedures in this file: Unsealing a Rig.
/datum/surgery/rigsuit
name = "Rig Unsealing"
steps = list(/datum/surgery_step/rigsuit)
possible_locs = list("chest")
/datum/surgery/rigsuit/can_start(mob/user, mob/living/carbon/target)
if(ishuman(target))
var/mob/living/carbon/human/H = target
var/obj/item/backitem = H.get_item_by_slot(slot_back)
if(istype(backitem,/obj/item/weapon/rig)) //Check if we have a rig to operate on
if(backitem.flags&NODROP) //Check if the rig is sealed, if not, we don't need to operate
return 1
return 0
//Bay12 removal
/datum/surgery_step/rigsuit
name="Cut Seals"
allowed_tools = list(
/obj/item/weapon/weldingtool = 80,
/obj/item/weapon/circular_saw = 60,
/obj/item/weapon/gun/energy/plasmacutter = 100
)
can_infect = 0
blood_level = 0
time = 50
/datum/surgery_step/hardsuit/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if(!istype(target))
return 0
if(istype(tool,/obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/welder = tool
if(!welder.isOn() || !welder.remove_fuel(1,user))
return 0
return (target_zone == "chest") && istype(target.back, /obj/item/weapon/rig) && (target.back.flags&NODROP)
/datum/surgery_step/rigsuit/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
user.visible_message("[user] starts cutting through the support systems of [target]'s [target.back] with \the [tool]." , \
"You start cutting through the support systems of [target]'s [target.back] with \the [tool].")
..()
/datum/surgery_step/rigsuit/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/weapon/rig/rig = target.back
if(!istype(rig))
return
rig.reset()
user.visible_message("<span class='notice'>[user] has cut through the support systems of [target]'s [rig] with \the [tool].</span>", \
"<span class='notice'>You have cut through the support systems of [target]'s [rig] with \the [tool].</span>")
return 1
/datum/surgery_step/rigsuit/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
user.visible_message("<span class='danger'>[user]'s [tool] can't quite seem to get through the metal...</span>", \
"<span class='danger'>Your [tool] can't quite seem to get through the metal. It's weakening, though - try again.</span>")
return 0