mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Refactoring hardsuit click checking.
This commit is contained in:
@@ -89,27 +89,24 @@
|
||||
*/
|
||||
|
||||
/mob/living/silicon/ai/ShiftClickOn(var/atom/A)
|
||||
A.AIShiftClick(src)
|
||||
if(A.AIShiftClick(src))
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/silicon/ai/CtrlClickOn(var/atom/A)
|
||||
A.AICtrlClick(src)
|
||||
if(A.AICtrlClick(src))
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/silicon/ai/AltClickOn(var/atom/A)
|
||||
A.AIAltClick(src)
|
||||
if(A.AIAltClick(src))
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/silicon/ai/MiddleClickOn(var/atom/A)
|
||||
A.AIMiddleClick(src)
|
||||
|
||||
/*
|
||||
Sticking minor pAI and brain overrides into this because I can.
|
||||
*/
|
||||
/mob/living/silicon/pai/MiddleClickOn(var/atom/A)
|
||||
if(src.loc == src.card)
|
||||
return A.AIMiddleClick(src)
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/brain/MiddleClickOn(var/atom/A)
|
||||
if(istype(src.loc, /obj/item/device/mmi))
|
||||
return A.AIMiddleClick(src)
|
||||
return ..()
|
||||
|
||||
if(A.AIMiddleClick(src))
|
||||
return
|
||||
..()
|
||||
/*
|
||||
The following criminally helpful code is just the previous code cleaned up;
|
||||
I have no idea why it was in atoms.dm instead of respective files.
|
||||
@@ -131,7 +128,7 @@
|
||||
Topic(src, list("src"= "\ref[src]", "command"="open", "activate" = "1"), 1) // 1 meaning no window (consistency!)
|
||||
else
|
||||
Topic(src, list("src"= "\ref[src]", "command"="open", "activate" = "0"), 1)
|
||||
return
|
||||
return 1
|
||||
|
||||
/atom/proc/AICtrlClick()
|
||||
return
|
||||
@@ -141,15 +138,18 @@
|
||||
Topic(src, list("src"= "\ref[src]", "command"="bolts", "activate" = "0"), 1)// 1 meaning no window (consistency!)
|
||||
else
|
||||
Topic(src, list("src"= "\ref[src]", "command"="bolts", "activate" = "1"), 1)
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/apc/AICtrlClick() // turns off/on APCs.
|
||||
Topic(src, list("src"= "\ref[src]", "breaker"="1"), 1) // 1 meaning no window (consistency!)
|
||||
return 1
|
||||
|
||||
/obj/machinery/turretid/AICtrlClick() //turns off/on Turrets
|
||||
Topic(src, list("src"= "\ref[src]", "command"="enable", "value"="[!enabled]"), 1) // 1 meaning no window (consistency!)
|
||||
return 1
|
||||
|
||||
/atom/proc/AIAltClick(var/atom/A)
|
||||
AltClick(A)
|
||||
return AltClick(A)
|
||||
|
||||
/obj/machinery/door/airlock/AIAltClick() // Electrifies doors.
|
||||
if(!electrified_until)
|
||||
@@ -158,17 +158,13 @@
|
||||
else
|
||||
// disable/6 is not in Topic; disable/5 disables both temporary and permanent shock
|
||||
Topic(src, list("src"= "\ref[src]", "command"="electrify_permanently", "activate" = "0"), 1)
|
||||
return
|
||||
return 1
|
||||
|
||||
/obj/machinery/turretid/AIAltClick() //toggles lethal on turrets
|
||||
Topic(src, list("src"= "\ref[src]", "command"="lethal", "value"="[!lethal]"), 1) // 1 meaning no window (consistency!)
|
||||
return 1
|
||||
|
||||
/atom/proc/AIMiddleClick(var/mob/living/silicon/user)
|
||||
var/obj/item/weapon/rig/rig = user.get_rig()
|
||||
if(rig && rig.wearer && rig.ai_can_move_suit(user, check_user_module = 1))
|
||||
if(rig.wearer.HardsuitClickOn(src, alert_ai = 1))
|
||||
message_admins("\The [user] ([user.ckey ? user.ckey : "*no key*"]) forced \the [rig.wearer] ([rig.wearer.ckey ? rig.wearer.ckey : "*no key*"]) to use hardsuit module on \the [src].")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/door/airlock/AIMiddleClick() // Toggles door bolt lights.
|
||||
@@ -180,7 +176,7 @@
|
||||
Topic(src, list("src"= "\ref[src]", "command"="lights", "activate" = "1"), 1) // 1 meaning no window (consistency!)
|
||||
else
|
||||
Topic(src, list("src"= "\ref[src]", "command"="lights", "activate" = "0"), 1)
|
||||
return
|
||||
return 1
|
||||
|
||||
//
|
||||
// Override AdjacentQuick for AltClicking
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
setMoveCooldown(5) //taking an item off of an inventory slot
|
||||
else
|
||||
setMoveCooldown(10) //getting something out of a backpack
|
||||
|
||||
|
||||
if(W)
|
||||
var/resolved = W.resolve_attackby(A, src)
|
||||
if(!resolved && A && W)
|
||||
@@ -130,7 +130,7 @@
|
||||
if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1))
|
||||
if(A.Adjacent(src)) // see adjacent.dm
|
||||
setMoveCooldown(10)
|
||||
|
||||
|
||||
if(W)
|
||||
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
|
||||
var/resolved = W.resolve_attackby(A,src)
|
||||
@@ -280,7 +280,7 @@
|
||||
else
|
||||
user.listed_turf = T
|
||||
user.client.statpanel = T.name
|
||||
return
|
||||
return 1
|
||||
|
||||
/mob/proc/TurfAdjacent(var/turf/T)
|
||||
return T.AdjacentQuick(src)
|
||||
|
||||
@@ -29,34 +29,53 @@
|
||||
src << "Somehow you bugged the system. Setting your hardsuit mode to middle-click."
|
||||
hardsuit_click_mode = MIDDLE_CLICK
|
||||
|
||||
/mob/living/carbon/human/MiddleClickOn(atom/A)
|
||||
/mob/living/MiddleClickOn(atom/A)
|
||||
if(client && client.hardsuit_click_mode == MIDDLE_CLICK)
|
||||
if(HardsuitClickOn(A))
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/AltClickOn(atom/A)
|
||||
/mob/living/AltClickOn(atom/A)
|
||||
if(client && client.hardsuit_click_mode == ALT_CLICK)
|
||||
if(HardsuitClickOn(A))
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/CtrlClickOn(atom/A)
|
||||
/mob/living/CtrlClickOn(atom/A)
|
||||
if(client && client.hardsuit_click_mode == CTRL_CLICK)
|
||||
if(HardsuitClickOn(A))
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/proc/HardsuitClickOn(var/atom/A, var/alert_ai = 0)
|
||||
if(!canClick())
|
||||
return
|
||||
if(back)
|
||||
var/obj/item/weapon/rig/rig = back
|
||||
if(istype(rig) && rig.selected_module)
|
||||
rig.selected_module.engage(A, alert_ai)
|
||||
if(ismob(A)) // No instant mob attacking - though modules have their own cooldowns
|
||||
setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
return 1
|
||||
/mob/living/proc/can_use_rig()
|
||||
return 0
|
||||
|
||||
/mob/living/carbon/human/can_use_rig()
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/brain/can_use_rig()
|
||||
return istype(loc, /obj/item/device/mmi)
|
||||
|
||||
/mob/living/silicon/ai/can_use_rig()
|
||||
return carded
|
||||
|
||||
/mob/living/silicon/pai/can_use_rig()
|
||||
return loc == card
|
||||
|
||||
/mob/living/proc/HardsuitClickOn(var/atom/A, var/alert_ai = 0)
|
||||
if(!can_use_rig() || !canClick())
|
||||
return 0
|
||||
var/obj/item/weapon/rig/rig = get_rig()
|
||||
if(istype(rig) && !rig.offline && rig.selected_module)
|
||||
if(src != rig.wearer)
|
||||
if(rig.ai_can_move_suit(src, check_user_module = 1))
|
||||
message_admins("\The [src] ([src.ckey ? src.ckey : "*no key*"]) is trying to force \the [rig.wearer] ([rig.wearer.ckey ? rig.wearer.ckey : "*no key*"]) to use a hardsuit module.")
|
||||
else
|
||||
return 0
|
||||
rig.selected_module.engage(A, alert_ai)
|
||||
if(ismob(A)) // No instant mob attacking - though modules have their own cooldowns
|
||||
setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
#undef MIDDLE_CLICK
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
if(istype(ai.loc, /turf/))
|
||||
new /obj/structure/AIcore/deactivated(get_turf(ai))
|
||||
|
||||
ai.carded = 1
|
||||
admin_attack_log(user, ai, "Carded with [src.name]", "Was carded with [src.name]", "used the [src.name] to card")
|
||||
src.name = "[initial(name)] - [ai.name]"
|
||||
|
||||
@@ -127,6 +128,7 @@
|
||||
/obj/item/device/aicard/proc/clear()
|
||||
if(carded_ai && istype(carded_ai.loc, /turf))
|
||||
carded_ai.canmove = 0
|
||||
carded_ai.carded = 0
|
||||
name = initial(name)
|
||||
carded_ai = null
|
||||
update_icon()
|
||||
@@ -148,4 +150,4 @@
|
||||
return
|
||||
var/obj/item/weapon/rig/rig = src.get_rig()
|
||||
if(istype(rig))
|
||||
rig.forced_move(direction, user)
|
||||
rig.forced_move(direction, user)
|
||||
|
||||
@@ -181,8 +181,8 @@
|
||||
for(var/obj/item/piece in list(helmet,boots,gloves,chest))
|
||||
if(!piece) continue
|
||||
piece.icon_state = "[initial(icon_state)]"
|
||||
if(airtight)
|
||||
piece.item_flags &= ~(STOPPRESSUREDAMAGE|AIRTIGHT)
|
||||
if(airtight)
|
||||
piece.item_flags &= ~(STOPPRESSUREDAMAGE|AIRTIGHT)
|
||||
update_icon(1)
|
||||
|
||||
/obj/item/weapon/rig/proc/toggle_seals(var/mob/living/carbon/human/M,var/instant)
|
||||
@@ -270,9 +270,9 @@
|
||||
for(var/obj/item/piece in list(helmet,boots,gloves,chest))
|
||||
if(!piece) continue
|
||||
piece.icon_state = "[initial(icon_state)][!seal_target ? "" : "_sealed"]"
|
||||
canremove = !seal_target
|
||||
canremove = !seal_target
|
||||
if(airtight)
|
||||
update_component_sealed()
|
||||
update_component_sealed()
|
||||
update_icon(1)
|
||||
return 0
|
||||
|
||||
@@ -291,9 +291,9 @@
|
||||
for(var/obj/item/piece in list(helmet,boots,gloves,chest))
|
||||
if(canremove)
|
||||
piece.item_flags &= ~(STOPPRESSUREDAMAGE|AIRTIGHT)
|
||||
else
|
||||
else
|
||||
piece.item_flags |= (STOPPRESSUREDAMAGE|AIRTIGHT)
|
||||
update_icon(1)
|
||||
update_icon(1)
|
||||
|
||||
/obj/item/weapon/rig/process()
|
||||
|
||||
@@ -894,6 +894,9 @@
|
||||
/obj/item/weapon/rig/get_rig()
|
||||
return src
|
||||
|
||||
/mob/living/carbon/human/get_rig()
|
||||
return back
|
||||
|
||||
#undef ONLY_DEPLOY
|
||||
#undef ONLY_RETRACT
|
||||
#undef SEAL_DELAY
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
/obj/machinery/portable_atmospherics/hydroponics/AltClick()
|
||||
if(mechanical && !usr.stat && !usr.lying && Adjacent(usr))
|
||||
close_lid(usr)
|
||||
return
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
/obj/machinery/portable_atmospherics/hydroponics/attack_ghost(var/mob/dead/observer/user)
|
||||
|
||||
@@ -81,7 +81,7 @@ var/list/ai_verbs_default = list(
|
||||
|
||||
var/datum/ai_icon/selected_sprite // The selected icon set
|
||||
var/custom_sprite = 0 // Whether the selected icon is custom
|
||||
|
||||
var/carded
|
||||
|
||||
/mob/living/silicon/ai/proc/add_ai_verbs()
|
||||
src.verbs |= ai_verbs_default
|
||||
|
||||
Reference in New Issue
Block a user