Files
fulpstation/code/_onclick/ai.dm
Aleksej Komarov 5521c8ebee [READY] tgui-next: Initial PR, speedy new Air Alarm interface. (#46764)
* Initial tgui-next commit

* Improve dev server, slight changes to layout.

* Add more components, fix dragging, finalize scrubber list

* Complete an air alarm interface.

* Multiple improvements based on feedback

- LabeledList now has a "buttons" prop, where you can put buttons.
- Improved Box and Flex components
- Whole UI is now dimmable if non-interactive
- Basic documentation of components (Box and Flex so far).
- Icon and Box now accept a "color" prop.
- Routing improved in "Layout" component, you can now specify whether an interface is scrollable.

* Less harsh dimming

* Redux, Toasts

- Fixed inconsistent backend updates with Redux.
- Added Toasts which are currently unused, but are functional.

* acclimator + ai airlock ui

* Add a progress bar component, implement resizing

* Fix a zero in title bar

* Add a linter to keep shit tidy, fix danger level mapping, add some more docs

* better ai door interact ui

* final ai airlock interface

* Fix issues with code, enforce hard 120 line length cap, automerge binaries

* Implement hot module reloading

* Fix progress bar, add color support

* Fix ProgressBar baseline alignment issues

* Remove unwanted padding on the bottom of the LabeledList.

* Component improvements

- Fix baseline issues with Button and ProgressBar components
- Box how inherits props from Box
- Atomic colors and Button colors are now auto-generated, all range of colors supported

* Chem Dispenser UI, animated numbers, more style fixes

* Add an IE8 polyfill

* Intermediate state of fixing IE8

* Lots of shimming and general misery

* Fully working old TGUI chainloader for IE8, more pipeline improvements

* Support title-less Sections

* Delete Yarn, use Lerna for workspace management

* Improve maths and animated numbers

* Fix loss of focus for scrollable content, activate buttons with keyboard

* Attempt to bust the cache, grab focus on keyboard presses too

* Fix hot module replacement by manually pulling replaced modules.

* backend logging

 un-nuke line endings

changes without insane line endings

* helper procs + href support

* slight optimization

* compiles

* Redux, Hotkeys, Kitchen Sink (for UI testing), Tabs component

* Push logs to backend, small kitchen sink changes, tab fixes

* Update component reference in README

* Small fixes

* Next bunch of IE8 fixes, PureComponent optimization for Inferno

* Delete old tgui html

* Log the event of loading the old tgui

* Enable tgui logging on server by default

* Final solution

* Extract routes into a separate file, fix ChemDispenser bug

- Chem dispenser was needlessly disabling transfer amount buttons

* Disable baseline alignment for vertical tabs

* Fix tabs and box units

- Tab content was not taking full page width
- Box can now accepts strings as units, which will be treated as raw style values.

* Fix tgui on Terry

* Fix sending all logs with an "error" flag

* Some macro UI component changes and improvements

- Refer to README.md diff to see what's new

* Tooltip component

* Add support for themes, nanotrasen logo is back

* Clockwork theme hotfix

* Slight adjustment to logo positioning

* Actually proper solution for logo positioning

* Fix color maps

* tgui-next thermomachine interface

* tgui-next canister interface

* Add icon_class_name proc to asset cache

* Lots of stuff backported from actioninja's repo

* Cleanup oopsies

* Cargo UI adjustments

* Nuke lodash

* Minor fixes and cleanup

- Remove local Inferno package in favor of upstream Inferno
- Fix "initial" prop on AnimatedNumber
- Force fancy=0 for IE8
- Click-through dimmer

* Add a bat file for dummies

* podlauncher interface fix

* Update README, assert code dominance

* Clarify usage of event handlers in Inferno

* Document LabeledList.Divider

* Fukken grammar

* fixes cellular emporium readapt button not working

* fixes incorrect action on button in atmos control interface

* remove unneeded data from airlock electronics ui

* Set +x mode on bin/tgui

* Fix filename cases

- They were untracked by git on windows

* Ignore package lock, make batch more robust

- package-lock.json is very random and unreliable as fuck. Yarn was better.

* Build tgui-next in travis

* bruh

- fixes tgui error reporting

* logging cleanup + always log
2019-10-15 17:20:37 +02:00

193 lines
4.8 KiB
Plaintext

/*
AI ClickOn()
Note currently ai restrained() returns 0 in all cases,
therefore restrained code has been removed
The AI can double click to move the camera (this was already true but is cleaner),
or double click a mob to track them.
Note that AI have no need for the adjacency proc, and so this proc is a lot cleaner.
*/
/mob/living/silicon/ai/DblClickOn(atom/A, params)
if(control_disabled || incapacitated())
return
if(ismob(A))
ai_actual_track(A)
else
A.move_camera_by_click()
/mob/living/silicon/ai/ClickOn(atom/A, params)
if(world.time <= next_click)
return
next_click = world.time + 1
if(!can_interact_with(A))
return
if(multicam_on)
var/turf/T = get_turf(A)
if(T)
for(var/obj/screen/movable/pic_in_pic/ai/P in T.vis_locs)
if(P.ai == src)
P.Click(params)
break
if(check_click_intercept(params,A))
return
if(control_disabled || incapacitated())
return
var/turf/pixel_turf = get_turf_pixel(A)
if(isnull(pixel_turf))
return
if(!can_see(A))
if(isturf(A)) //On unmodified clients clicking the static overlay clicks the turf underneath
return //So there's no point messaging admins
message_admins("[ADMIN_LOOKUPFLW(src)] might be running a modified client! (failed can_see on AI click of [A] (Turf Loc: [ADMIN_VERBOSEJMP(pixel_turf)]))")
var/message = "[key_name(src)] might be running a modified client! (failed can_see on AI click of [A] (Turf Loc: [AREACOORD(pixel_turf)]))"
log_admin(message)
if(REALTIMEOFDAY >= chnotify + 9000)
chnotify = REALTIMEOFDAY
send2irc_adminless_only("NOCHEAT", message)
return
var/list/modifiers = params2list(params)
if(modifiers["shift"] && modifiers["ctrl"])
CtrlShiftClickOn(A)
return
if(modifiers["middle"])
if(controlled_mech) //Are we piloting a mech? Placed here so the modifiers are not overridden.
controlled_mech.click_action(A, src, params) //Override AI normal click behavior.
return
if(modifiers["shift"])
ShiftClickOn(A)
return
if(modifiers["alt"]) // alt and alt-gr (rightalt)
AltClickOn(A)
return
if(modifiers["ctrl"])
CtrlClickOn(A)
return
if(world.time <= next_move)
return
if(aicamera.in_camera_mode)
aicamera.camera_mode_off()
aicamera.captureimage(pixel_turf, usr)
return
if(waypoint_mode)
waypoint_mode = 0
set_waypoint(A)
return
A.attack_ai(src)
/*
AI has no need for the UnarmedAttack() and RangedAttack() procs,
because the AI code is not generic; attack_ai() is used instead.
The below is only really for safety, or you can alter the way
it functions and re-insert it above.
*/
/mob/living/silicon/ai/UnarmedAttack(atom/A)
A.attack_ai(src)
/mob/living/silicon/ai/RangedAttack(atom/A)
A.attack_ai(src)
/atom/proc/attack_ai(mob/user)
return
/*
Since the AI handles shift, ctrl, and alt-click differently
than anything else in the game, atoms have separate procs
for AI shift, ctrl, and alt clicking.
*/
/mob/living/silicon/ai/CtrlShiftClickOn(atom/A)
A.AICtrlShiftClick(src)
/mob/living/silicon/ai/ShiftClickOn(atom/A)
A.AIShiftClick(src)
/mob/living/silicon/ai/CtrlClickOn(atom/A)
A.AICtrlClick(src)
/mob/living/silicon/ai/AltClickOn(atom/A)
A.AIAltClick(src)
/*
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.
*/
/* Questions: Instead of an Emag check on every function, can we not add to airlocks onclick if emag return? */
/* Atom Procs */
/atom/proc/AICtrlClick()
return
/atom/proc/AIAltClick(mob/living/silicon/ai/user)
AltClick(user)
return
/atom/proc/AIShiftClick()
return
/atom/proc/AICtrlShiftClick()
return
/* Airlocks */
/obj/machinery/door/airlock/AICtrlClick() // Bolts doors
if(obj_flags & EMAGGED)
return
toggle_bolt(usr)
add_hiddenprint(usr)
/obj/machinery/door/airlock/AIAltClick() // Eletrifies doors.
if(obj_flags & EMAGGED)
return
if(!secondsElectrified)
shock_perm(usr)
else
shock_restore(usr)
/obj/machinery/door/airlock/AIShiftClick() // Opens and closes doors!
if(obj_flags & EMAGGED)
return
user_toggle_open(usr)
add_hiddenprint(usr)
/obj/machinery/door/airlock/AICtrlShiftClick() // Sets/Unsets Emergency Access Override
if(obj_flags & EMAGGED)
return
toggle_emergency(usr)
add_hiddenprint(usr)
/* APC */
/obj/machinery/power/apc/AICtrlClick() // turns off/on APCs.
if(can_use(usr, 1))
toggle_breaker(usr)
/* AI Turrets */
/obj/machinery/turretid/AIAltClick() //toggles lethal on turrets
if(ailock)
return
toggle_lethal(usr)
/obj/machinery/turretid/AICtrlClick() //turns off/on Turrets
if(ailock)
return
toggle_on(usr)
/* Holopads */
/obj/machinery/holopad/AIAltClick(mob/living/silicon/ai/user)
hangup_all_calls()
add_hiddenprint(usr)
//
// Override TurfAdjacent for AltClicking
//
/mob/living/silicon/ai/TurfAdjacent(turf/T)
return (GLOB.cameranet && GLOB.cameranet.checkTurfVis(T))