mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
* moves the brain component to living-level. Makes some tweaks to NPC AI so they know they're being attacked by something * that took a lot more than I expected to fix the melee * adds the weapon throw attack. Fixes where you could only ever have one attack type for your NPC. Fixes a bad usr argument in throw. * /*DOES NOT WORK*/ Changes mob function so it uses a movement component, rather than it being under the mob component. Adds the Astar mob movement component. Adds Receive and Return signal handling. moves get def zone to this system. * movement through astar now works. * cleanup of debug * Damians requested changes * That doesn't work.
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
/datum/component/controller/movement
|
|
var/walk_delay = 4
|
|
|
|
/datum/component/controller/movement/basic/RecieveSignal(var/message_type, var/list/args)
|
|
if(isliving(container.holder))
|
|
var/mob/living/M=container.holder
|
|
if(COMSIG_MOVE)
|
|
if("loc" in args)
|
|
walk_to(M, args["loc"], 1, walk_delay)
|
|
if("dir" in args)
|
|
walk(M, args["dir"], walk_delay)
|
|
|
|
/datum/component/controller/movement/astar
|
|
var/list/movement_nodes = list()
|
|
var/target
|
|
|
|
/datum/component/controller/movement/astar/RecieveSignal(var/message_type, var/list/args)
|
|
if(isliving(container.holder))
|
|
var/mob/living/M=container.holder
|
|
if(message_type == COMSIG_MOVE)
|
|
if("loc" in args)
|
|
if(args["loc"] == target)
|
|
return //We're already on our way there
|
|
target = args["loc"]
|
|
movement_nodes = AStar(M, target, /turf/proc/AdjacentTurfsSpace, /turf/proc/Distance, 0, 30, id=M.get_visible_id())
|
|
if("dir" in args)
|
|
movement_nodes.Cut()
|
|
walk(M, args["dir"], walk_delay)
|
|
if(message_type == COMSIG_LIFE)
|
|
if(movement_nodes.len && target && (target != null))
|
|
if(movement_nodes.len > 0)
|
|
step_to(M, movement_nodes[1])
|
|
movement_nodes -= movement_nodes[1]
|
|
else if(movement_nodes.len == 1)
|
|
step_to(src, target)
|
|
movement_nodes.Cut()
|
|
return 1
|