mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Messing with component mobs further (#17770)
* 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.
This commit is contained in:
@@ -8,18 +8,11 @@
|
||||
switch(message_type)
|
||||
if(COMSIG_CLICKON)
|
||||
var/atom/A = args["target"]
|
||||
M.ClickOn(A)
|
||||
|
||||
if(COMSIG_MOVE) // list("loc"=turf)
|
||||
// list("dir"=NORTH)
|
||||
if("loc" in args)
|
||||
//walk_to(src, target, minimum_distance, delay)
|
||||
//testing("Walking towards [args["loc"]] with walk_delay=[walk_delay]")
|
||||
walk_to(M, args["loc"], 1, walk_delay)
|
||||
if("dir" in args)
|
||||
// walk(M, get_dir(src,M), MISSILE_SPEED)
|
||||
walk(M, args["dir"], walk_delay)
|
||||
|
||||
var/params
|
||||
if(args["def_zone"])
|
||||
var/list/L = list("def_zone" = args["def_zone"])
|
||||
params = list2params(L)
|
||||
M.ClickOn(A, params)
|
||||
if(COMSIG_STEP)
|
||||
step(M, args["dir"], walk_delay)
|
||||
|
||||
|
||||
37
code/modules/components/ai/controllers/movement.dm
Normal file
37
code/modules/components/ai/controllers/movement.dm
Normal file
@@ -0,0 +1,37 @@
|
||||
/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
|
||||
Reference in New Issue
Block a user