From da73c134dbc9f088e95863fc1135f2c9abb7e060 Mon Sep 17 00:00:00 2001 From: Arkatos1 Date: Tue, 9 Apr 2019 02:17:40 +0200 Subject: [PATCH 1/2] Ghosts now orbit their followed targets --- code/__DEFINES/misc.dm | 9 +++- code/modules/mob/dead/observer/observer.dm | 48 ++++++++++++++-------- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 7783216427b..dff9426c641 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -394,4 +394,11 @@ // Defib stats #define DEFIB_TIME_LIMIT 120 -#define DEFIB_TIME_LOSS 60 \ No newline at end of file +#define DEFIB_TIME_LOSS 60 + +//Ghost orbit types: +#define GHOST_ORBIT_CIRCLE "circle" +#define GHOST_ORBIT_TRIANGLE "triangle" +#define GHOST_ORBIT_HEXAGON "hexagon" +#define GHOST_ORBIT_SQUARE "square" +#define GHOST_ORBIT_PENTAGON "pentagon" \ No newline at end of file diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 923c81c53b1..5ab5294edce 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -26,6 +26,7 @@ var/list/image/ghost_darkness_images = list() //this is a list of images for thi var/ghostvision = 1 //is the ghost able to see things humans can't? var/seedarkness = 1 var/data_hud_seen = FALSE //this should one of the defines in __DEFINES/hud.dm + var/ghost_orbit = GHOST_ORBIT_CIRCLE /mob/dead/observer/New(var/mob/body=null, var/flags=1) sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF @@ -414,8 +415,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/verb/follow(input in getmobs()) set category = "Ghost" - set name = "Follow" // "Haunt" - set desc = "Follow and haunt a mob." + set name = "Orbit" // "Haunt" + set desc = "Follow and orbit a mob." var/target = getmobs()[input] if(!target) return @@ -432,22 +433,37 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(target != src) if(following && following == target) return + + var/icon/I = icon(target.icon,target.icon_state,target.dir) + + var/orbitsize = (I.Width()+I.Height())*0.5 + + if(orbitsize == 0) + orbitsize = 40 + + orbitsize -= (orbitsize/world.icon_size)*(world.icon_size*0.25) + + var/rot_seg + + switch(ghost_orbit) + if(GHOST_ORBIT_TRIANGLE) + rot_seg = 3 + if(GHOST_ORBIT_SQUARE) + rot_seg = 4 + if(GHOST_ORBIT_PENTAGON) + rot_seg = 5 + if(GHOST_ORBIT_HEXAGON) + rot_seg = 6 + else //Circular + rot_seg = 36 //360/10 bby, smooth enough aproximation of a circle + following = target to_chat(src, "Now following [target]") - if(ismob(target)) - forceMove(get_turf(target)) - var/mob/M = target - M.following_mobs += src - else - spawn(0) - while(target && following == target && client) - var/turf/T = get_turf(target) - if(!T) - break - // To stop the ghost flickering. - if(loc != T) - forceMove(T) - sleep(15) + orbit(target,orbitsize, FALSE, 20, rot_seg) + +/mob/dead/observer/orbit() + setDir(2)//reset dir so the right directional sprites show up + return ..() /mob/proc/update_following() . = get_turf(src) From 19f681c24dcb57c3ee7c96211ccf684b291c0501 Mon Sep 17 00:00:00 2001 From: ParadiseSS13-Bot Date: Thu, 11 Apr 2019 08:41:39 -0400 Subject: [PATCH 2/2] Automatic changelog generation for PR #11279 [ci skip] --- html/changelogs/AutoChangeLog-pr-11279.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-11279.yml diff --git a/html/changelogs/AutoChangeLog-pr-11279.yml b/html/changelogs/AutoChangeLog-pr-11279.yml new file mode 100644 index 00000000000..11bdfb80538 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-11279.yml @@ -0,0 +1,4 @@ +author: "Arkatos" +delete-after: True +changes: + - tweak: "Ghosts now orbit around their followed targets"