mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
New Mecha Stuff (#26316)
* New Mecha Stuff * Turns out istypeinlist is bad * barrycatches * designs
This commit is contained in:
@@ -158,7 +158,14 @@
|
||||
if(usr.incapacitated())
|
||||
return 1
|
||||
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
|
||||
return 1
|
||||
if(istype(master,/obj/item/weapon/storage)) //should always be true, but sanity
|
||||
var/obj/item/weapon/storage/S = master
|
||||
if(!S.distance_interact(usr))
|
||||
return 1
|
||||
//else... continue onward to master.attackby
|
||||
else
|
||||
//master isn't storage, exit
|
||||
return 1
|
||||
if(master)
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if(I)
|
||||
|
||||
@@ -3075,6 +3075,7 @@ var/global/num_vending_terminals = 1
|
||||
/obj/item/key/security/spare = 1,
|
||||
/obj/item/weapon/depocket_wand = 4,
|
||||
/obj/item/weapon/ram_kit = 1,
|
||||
/obj/item/weapon/mech_expansion_kit = 3,
|
||||
)
|
||||
prices = list(
|
||||
/obj/item/clothing/suit/storage/trader = 100,
|
||||
@@ -3106,6 +3107,7 @@ var/global/num_vending_terminals = 1
|
||||
/obj/item/key/security/spare = 10,
|
||||
/obj/item/weapon/depocket_wand = 50,
|
||||
/obj/item/weapon/ram_kit = 100,
|
||||
/obj/item/weapon/mech_expansion_kit = 50
|
||||
)
|
||||
|
||||
/obj/machinery/vending/trader/New()
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
var/range = MELEE //bitflags
|
||||
reliability = 1000
|
||||
var/salvageable = 1
|
||||
var/is_activateable = 1
|
||||
var/is_activateable = FALSE
|
||||
var/spell/mech/linked_spell //Default action is to make the make it the active equipment
|
||||
|
||||
|
||||
|
||||
60
code/game/mecha/equipment/passive/passive.dm
Normal file
60
code/game/mecha/equipment/passive/passive.dm
Normal file
@@ -0,0 +1,60 @@
|
||||
//Tools that you don't need to activate
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/passive/rack
|
||||
name = "\improper Exosuit-Mounted Rack"
|
||||
desc = "A locking storage rack for the outside of an exosuit. (Can be attached to: Any exosuit)"
|
||||
icon_state = "mecha_rack"
|
||||
origin_tech = Tc_MATERIALS + "=3;" + Tc_MAGNETS + "=3;"
|
||||
is_activateable = FALSE
|
||||
var/obj/item/weapon/storage/mechrack/rack
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/passive/rack/New()
|
||||
..()
|
||||
rack = new(src)
|
||||
rack.mech_part = src
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/passive/rack/Destroy()
|
||||
rack.empty_contents_to(chassis)
|
||||
qdel(rack)
|
||||
rack = null
|
||||
..()
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/passive/rack/detach(atom/moveto=null)
|
||||
rack.empty_contents_to(chassis)
|
||||
..()
|
||||
|
||||
/obj/item/weapon/storage/mechrack
|
||||
name = "exosuit storage rack"
|
||||
desc = "A large rack for an exosuit."
|
||||
icon = 'icons/mecha/mecha_equipment.dmi'
|
||||
icon_state = "mecha_rack"
|
||||
fits_max_w_class = W_CLASS_LARGE
|
||||
max_combined_w_class = 28
|
||||
slot_flags = 0
|
||||
rustle_sound = "rustle-metal"
|
||||
var/obj/item/mecha_parts/mecha_equipment/mech_part
|
||||
|
||||
/obj/item/weapon/storage/mechrack/Destroy()
|
||||
mech_part = null
|
||||
..()
|
||||
|
||||
/obj/item/weapon/storage/mechrack/distance_interact(mob/user)
|
||||
var/obj/mecha/M = mech_part.chassis
|
||||
if(istype(M) && M.operation_allowed(user))
|
||||
if(in_range(user,M))
|
||||
playsound(M, 'sound/effects/rustle-metal.ogg', 50, 1, -5)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/passive/runningboard
|
||||
name = "\improper Powered Exosuit Running Board"
|
||||
desc = "A running board with a power lifter attachment to catapult the pilot quickly into the cockpit. (Can be attached to: Working exosuits)"
|
||||
icon_state = "mecha_runningboard"
|
||||
origin_tech = Tc_MATERIALS + "=6;"
|
||||
is_activateable = FALSE
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/passive/runningboard/can_attach(obj/mecha/working/W)
|
||||
if(..())
|
||||
if(istype(W))
|
||||
return 1
|
||||
return 0
|
||||
@@ -293,6 +293,8 @@
|
||||
if(!get_charge())
|
||||
return
|
||||
if(src == target)
|
||||
var/obj/item/mecha_parts/mecha_equipment/passive/rack/R = get_equipment(/obj/item/mecha_parts/mecha_equipment/passive/rack)
|
||||
R.rack.AltClick(user)
|
||||
return
|
||||
var/dir_to_target = get_dir(src,target)
|
||||
if(dir_to_target && !(dir_to_target & src.dir))//wrong direction
|
||||
@@ -560,6 +562,10 @@
|
||||
src.log_message("Attack by paw. Attacker - [user].",1)
|
||||
else
|
||||
src.log_message("Attack by hand. Attacker - [user].",1)
|
||||
var/obj/item/mecha_parts/mecha_equipment/passive/rack/R = get_equipment(/obj/item/mecha_parts/mecha_equipment/passive/rack)
|
||||
if(R && operation_allowed(user))
|
||||
R.rack.AltClick(user)
|
||||
return
|
||||
user.do_attack_animation(src, user)
|
||||
if ((M_HULK in user.mutations) && !prob(src.deflect_chance))
|
||||
src.take_damage(15)
|
||||
@@ -1125,33 +1131,29 @@
|
||||
to_chat(usr, "<span class='notice'><B>Subject cannot have abiotic items on.</B></span>")
|
||||
return
|
||||
*/
|
||||
var/passed
|
||||
if(src.dna)
|
||||
if(usr.dna.unique_enzymes==src.dna)
|
||||
passed = 1
|
||||
else if(src.operation_allowed(usr))
|
||||
passed = 1
|
||||
if(!passed)
|
||||
if(!operation_allowed(usr))
|
||||
to_chat(usr, "<span class='warning'>Access Denied.</span>")
|
||||
src.log_append_to_last("Permission denied.")
|
||||
log_append_to_last("Permission denied.")
|
||||
return
|
||||
for(var/mob/living/carbon/slime/M in range(1,usr))
|
||||
if(M.Victim == usr)
|
||||
to_chat(usr, "You're too busy getting your life sucked out of you.")
|
||||
return
|
||||
|
||||
visible_message("<span class='notice'>[usr] starts to climb into \the [src].</span>")
|
||||
|
||||
|
||||
if(do_after(usr, src, 40))
|
||||
if(!src.occupant)
|
||||
moved_inside(usr)
|
||||
refresh_spells()
|
||||
else if(src.occupant!=usr)
|
||||
to_chat(usr, "[src.occupant] was faster. Try better next time, loser.")
|
||||
if(get_equipment(/obj/item/mecha_parts/mecha_equipment/passive/runningboard))
|
||||
moved_inside(usr)
|
||||
refresh_spells()
|
||||
visible_message("<span class='good'>[usr] is instantly lifted into \the [src] by the running board!</span>")
|
||||
else
|
||||
to_chat(usr, "You stop entering the exosuit.")
|
||||
return
|
||||
visible_message("<span class='notice'>[usr] starts to climb into \the [src].</span>")
|
||||
if(do_after(usr, src, 40))
|
||||
if(!src.occupant)
|
||||
moved_inside(usr)
|
||||
refresh_spells()
|
||||
else if(src.occupant!=usr)
|
||||
to_chat(usr, "[src.occupant] was faster. Try better next time, loser.")
|
||||
else
|
||||
to_chat(usr, "You stop entering the exosuit.")
|
||||
|
||||
/obj/mecha/proc/moved_inside(var/mob/living/carbon/human/H as mob)
|
||||
if(!isnull(src.loc) && H && H.client && H in range(1))
|
||||
@@ -1392,11 +1394,14 @@
|
||||
/////////////////////////
|
||||
|
||||
/obj/mecha/proc/operation_allowed(mob/living/carbon/human/H)
|
||||
if(dna)
|
||||
if(!(usr.dna.unique_enzymes==dna))
|
||||
return FALSE
|
||||
if(istype(H))
|
||||
for(var/ID in list(H.get_active_hand(), H.wear_id, H.belt))
|
||||
if(src.check_access(ID,src.operation_req_access))
|
||||
if(src.check_access(ID,operation_req_access))
|
||||
return 1
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/mecha/proc/internals_access_allowed(mob/living/carbon/human/H)
|
||||
@@ -1581,6 +1586,13 @@
|
||||
output += "</div>"
|
||||
return output
|
||||
|
||||
//returns an equipment object if we have one of that type, useful since is_type_in_list won't return the object
|
||||
//since is_type_in_list uses caching, this is a slower operation, so only use it if needed
|
||||
/obj/mecha/proc/get_equipment(var/equip_type)
|
||||
for(var/obj/item/mecha_parts/mecha_equipment/ME in equipment)
|
||||
if(istype(ME,equip_type))
|
||||
return ME
|
||||
return null
|
||||
|
||||
/obj/mecha/proc/get_log_html()
|
||||
var/output = "<html><head><title>[src.name] Log</title></head><body style='font: 13px 'Courier', monospace;'>"
|
||||
|
||||
@@ -752,3 +752,37 @@
|
||||
name = "[t]'s ID card ([assignment])"
|
||||
else
|
||||
return
|
||||
|
||||
/obj/item/weapon/mech_expansion_kit
|
||||
name = "exosuit expansion kit"
|
||||
desc = "All the equipment you need to replace that useless legroom with a useful bonus equipment slot on your mech."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "modkit"
|
||||
flags = FPRINT
|
||||
siemens_coefficient = 0
|
||||
w_class = W_CLASS_SMALL
|
||||
var/working = FALSE
|
||||
|
||||
/obj/item/weapon/mech_expansion_kit/preattack(atom/target, mob/user , proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
if(!istype(target,/obj/mecha))
|
||||
to_chat(user,"<span class='warning'>That isn't an exosuit!</span>")
|
||||
return
|
||||
if(working)
|
||||
to_chat(user,"<span class='warning'>This is already being used to upgrade something!</span>")
|
||||
return
|
||||
var/obj/mecha/M = target
|
||||
if(M.max_equip > initial(M.max_equip))
|
||||
to_chat(user,"<span class='warning'>That exosuit cannot be modified any further. There's no more legroom to eliminate!</span>")
|
||||
return
|
||||
to_chat(user,"<span class='notice'>You begin modifying the exosuit.</span>")
|
||||
working = TRUE
|
||||
if(do_after(user,target,4 SECONDS))
|
||||
to_chat(user,"<span class='notice'>You finish modifying the exosuit!</span>")
|
||||
M.max_equip++
|
||||
qdel(src)
|
||||
else
|
||||
to_chat(user,"<span class='notice'>You stop modifying the exosuit.</span>")
|
||||
working = FALSE
|
||||
return 1
|
||||
@@ -39,7 +39,7 @@
|
||||
playsound(src, rustle_sound, 50, 1, -5)
|
||||
|
||||
/obj/item/weapon/storage/MouseDropFrom(obj/over_object as obj)
|
||||
if(over_object == usr && (in_range(src, usr) || is_holder_of(usr, src)))
|
||||
if(over_object == usr && (in_range(src, usr) || is_holder_of(usr, src) || distance_interact(usr)))
|
||||
orient2hud()
|
||||
show_to(usr)
|
||||
return
|
||||
@@ -54,13 +54,25 @@
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/storage/AltClick(mob/user)
|
||||
if(!(in_range(src, user) || is_holder_of(user, src)))
|
||||
if(!(in_range(src, user) || is_holder_of(user, src) || distance_interact(user)))
|
||||
return ..()
|
||||
orient2hud(user)
|
||||
if(user.s_active)
|
||||
user.s_active.close(user)
|
||||
src.show_to(user)
|
||||
|
||||
//override to allow certain circumstances of looking inside this item if not holding or adjacent
|
||||
//distance interact can let you use storage even inside a mecha (see screen_objects.dm L160)
|
||||
//and also pull items out of that storage; it can be quite powerful, add narrow conditions
|
||||
/obj/item/weapon/storage/proc/distance_interact(mob/user)
|
||||
return FALSE
|
||||
|
||||
/obj/item/weapon/storage/Adjacent(var/atom/neighbor)
|
||||
if(ismob(neighbor) && distance_interact(neighbor))
|
||||
return TRUE
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/storage/proc/empty_contents_to(var/atom/place)
|
||||
var/turf = get_turf(place)
|
||||
for(var/obj/objects in contents)
|
||||
@@ -365,7 +377,6 @@
|
||||
var/obj/item/weapon/storage/fancy/F = src
|
||||
F.update_icon(1)
|
||||
|
||||
|
||||
if(new_location)
|
||||
var/mob/M
|
||||
if(ismob(loc))
|
||||
@@ -402,7 +413,7 @@
|
||||
|
||||
//This proc is called when you want to place an item into the storage item.
|
||||
/obj/item/weapon/storage/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(!Adjacent(user,MAX_ITEM_DEPTH))
|
||||
if(!Adjacent(user,MAX_ITEM_DEPTH) && !distance_interact(user))
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
for (var/obj/item/I in get_all_slots())
|
||||
drop_from_inventory(I)
|
||||
drop_hands()
|
||||
|
||||
|
||||
// deletes all and only equipped items, including items in hand
|
||||
/mob/proc/delete_all_equipped_items()
|
||||
for (var/obj/item/I in get_all_slots())
|
||||
@@ -346,7 +346,7 @@
|
||||
/mob/proc/drop_hands(var/atom/Target, force_drop = 0) //drops both items
|
||||
for(var/obj/item/I in held_items)
|
||||
drop_item(I, Target, force_drop = force_drop)
|
||||
|
||||
|
||||
/mob/proc/delete_held_items(var/atom/Target) //deletes both items
|
||||
for(var/obj/item/I in held_items)
|
||||
qdel(I)
|
||||
|
||||
@@ -268,3 +268,23 @@
|
||||
build_path = /obj/item/mecha_parts/mecha_equipment/tool/collector
|
||||
category = "Exosuit_Modules"
|
||||
materials = list(MAT_IRON=10000,MAT_PLASMA=10000)
|
||||
|
||||
/datum/design/mechrack
|
||||
name = "Module Design (Exosuit-Mounted Rack)"
|
||||
desc = "Allows for the construction of the Exosuit-Mounted Rack."
|
||||
id = "mech_rack"
|
||||
build_type = MECHFAB
|
||||
req_tech = list(Tc_MATERIALS = 3, Tc_MAGNETS = 3)
|
||||
build_path = /obj/item/mecha_parts/mecha_equipment/passive/rack
|
||||
category = "Exosuit_Modules"
|
||||
materials = list(MAT_IRON=10000)
|
||||
|
||||
/datum/design/mechrunningboard
|
||||
name = "Module Design (Powered Exosuit Running Board)"
|
||||
desc = "Allows for the construction of the Powered Exosuit Running Board."
|
||||
id = "mech_runningboard"
|
||||
build_type = MECHFAB
|
||||
req_tech = list(Tc_MATERIALS = 6)
|
||||
build_path = /obj/item/mecha_parts/mecha_equipment/passive/runningboard
|
||||
category = "Exosuit_Modules"
|
||||
materials = list(MAT_IRON=10000)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
BIN
sound/effects/rustle-metal.ogg
Normal file
BIN
sound/effects/rustle-metal.ogg
Normal file
Binary file not shown.
@@ -760,6 +760,7 @@
|
||||
#include "code\game\mecha\combat\marauder.dm"
|
||||
#include "code\game\mecha\combat\phazon.dm"
|
||||
#include "code\game\mecha\equipment\mecha_equipment.dm"
|
||||
#include "code\game\mecha\equipment\passive\passive.dm"
|
||||
#include "code\game\mecha\equipment\tools\medical_tools.dm"
|
||||
#include "code\game\mecha\equipment\tools\sec_tools.dm"
|
||||
#include "code\game\mecha\equipment\tools\tools.dm"
|
||||
|
||||
Reference in New Issue
Block a user