Adds a possession system for ghost mousedrop(). Currently allows for control of mice, drones and use of drone fabricators.

This commit is contained in:
Zuhayr
2015-11-23 05:52:33 +10:30
parent 17bd7ac3d7
commit e5ec6c761b
10 changed files with 128 additions and 36 deletions
+3
View File
@@ -125,3 +125,6 @@
#define FLASH_PROTECTION_NONE 0
#define FLASH_PROTECTION_MODERATE 1
#define FLASH_PROTECTION_MAJOR 2
#define ANIMAL_SPAWN_DELAY round(config.respawn_delay / 6)
#define DRONE_SPAWN_DELAY round(config.respawn_delay / 3)
+3
View File
@@ -532,3 +532,6 @@ datum/projectile_data
/proc/SecondsToTicks(var/seconds)
return seconds * 10
/proc/round_is_spooky(var/spookiness_threshold = config.cult_ghostwriter_req_cultists)
return (cult.current_antagonists.len > spookiness_threshold)
+2 -2
View File
@@ -61,12 +61,12 @@ proc/random_facial_hair_style(gender, species = "Human")
f_style = pick(valid_facialhairstyles)
return f_style
proc/sanitize_name(name, species = "Human")
var/datum/species/current_species
if(species)
current_species = all_species[species]
return current_species ? current_species.sanitize_name(name) : sanitizeName(name)
proc/random_name(gender, species = "Human")
+5
View File
@@ -214,6 +214,8 @@ var/list/gamemode_cache = list()
var/list/language_prefixes = list(",","#","-")//Default language prefixes
var/ghosts_can_possess_animals = 0
/datum/configuration/New()
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
for (var/T in L)
@@ -420,6 +422,9 @@ var/list/gamemode_cache = list()
if ("githuburl")
config.githuburl = value
if ("ghosts_can_possess_animals")
config.ghosts_can_possess_animals = value
if ("guest_jobban")
config.guest_jobban = 1
+21 -10
View File
@@ -462,7 +462,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
src << "<span class='warning'>Spawning as a mouse is currently disabled.</span>"
return
if(!MayRespawn(1, round(config.respawn_delay / 6)))
if(!MayRespawn(1, ANIMAL_SPAWN_DELAY))
return
var/turf/T = get_turf(src)
@@ -507,12 +507,28 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
//This is called when a ghost is drag clicked to something.
/mob/dead/observer/MouseDrop(atom/over)
if(!usr || !over) return
if (isobserver(usr) && usr.client && usr.client.holder && isliving(over))
if (usr.client.holder.cmd_ghost_drag(src,over))
if(isobserver(usr) && usr.client && isliving(over))
var/mob/living/M = over
// If they an admin, see if control can be resolved.
if(usr.client.holder && usr.client.holder.cmd_ghost_drag(src,M))
return
// Otherwise, see if we can possess the target.
if(usr == src && try_possession(M))
return
if(istype(over, /obj/machinery/drone_fabricator))
if(try_drone_spawn(src, over))
return
return ..()
/mob/dead/observer/proc/try_possession(var/mob/living/M)
if(!config.ghosts_can_possess_animals)
usr << "<span class='warning'>Ghosts are not permitted to possess animals.</span>"
return 0
if(!M.can_be_possessed_by(src))
return 0
return M.do_possession(src)
//Used for drawing on walls with blood puddles as a spooky ghost.
/mob/dead/verb/bloody_doodle()
@@ -530,12 +546,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if (usr != src)
return 0 //something is terribly wrong
var/ghosts_can_write
if(ticker.mode.name == "cult")
if(cult.current_antagonists.len > config.cult_ghostwriter_req_cultists)
ghosts_can_write = 1
if(!ghosts_can_write)
if(!round_is_spooky())
src << "\red The veil is not thin enough for you to do that."
return
@@ -662,7 +673,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/proc/can_admin_interact()
return 0
/mob/dead/observer/can_admin_interact()
return check_rights(R_ADMIN, 0, src)
+40
View File
@@ -810,3 +810,43 @@ default behaviour is:
ear_damage = damage
if(deaf >= 0)
ear_deaf = deaf
/mob/living/proc/can_be_possessed_by(var/mob/dead/observer/possessor)
if(!istype(possessor))
return 0
if(!possession_candidate)
possessor << "<span class='warning'>That animal cannot be possessed.</span>"
return 0
if(jobban_isbanned(possessor, "Animal"))
possessor << "<span class='warning'>You are banned from animal roles.</span>"
return 0
if(!possessor.MayRespawn(1,ANIMAL_SPAWN_DELAY))
return 0
return 1
/mob/living/proc/do_possession(var/mob/dead/observer/possessor)
if(!(istype(possessor) && possessor.ckey))
return 0
if(src.ckey || src.client)
possessor << "<span class='warning'>\The [src] already has a player.</span>"
return 0
message_admins("<span class='adminnotice'>[key_name_admin(possessor)] has taken control of \the [src].</span>")
log_admin("[key_name(possessor)] took control of \the [src].")
src.ckey = possessor.ckey
qdel(possessor)
if(round_is_spooky(6)) // Six or more active cultists.
src << "<span class='notice'>You reach out with tendrils of ectoplasm and invade the mind of \the [src]...</span>"
src << "<b>You have assumed direct control of \the [src].</b>"
src << "<span class='notice'>Due to the spookiness of the round, you have taken control of the poor animal as an invading, possessing spirit - roleplay accordingly.</span>"
src.universal_speak = 1
src.universal_understand = 1
//src.cultify() // Maybe another time.
return
src << "<b>You are now \the [src]!</b>"
src << "<span class='notice'>Remember to stay in character for a mob of this type!</span>"
return 1
@@ -43,3 +43,4 @@
var/fire_stacks
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
var/possession_candidate // Can be possessed by ghosts if unplayed.
@@ -36,6 +36,7 @@ var/list/mob_hat_cache = list()
req_access = list(access_engine, access_robotics)
integrated_light_power = 3
local_transmit = 1
possession_candidate = 1
mob_bump_flag = SIMPLE_ANIMAL
mob_swap_flags = SIMPLE_ANIMAL
@@ -57,6 +58,31 @@ var/list/mob_hat_cache = list()
holder_type = /obj/item/weapon/holder/drone
/mob/living/silicon/robot/drone/can_be_possessed_by(var/mob/dead/observer/possessor)
if(!istype(possessor))
return 0
if(!config.allow_drone_spawn)
src << "<span class='danger'>Playing as drones is not currently permitted.</span>"
return 0
if(jobban_isbanned(possessor,"Cyborg"))
usr << "<span class='danger'>You are banned from playing synthetics and cannot spawn as a drone.</span>"
return 0
if(!possessor.MayRespawn(1,DRONE_SPAWN_DELAY))
return 0
return 1
/mob/living/silicon/robot/drone/do_possession(var/mob/dead/observer/possessor)
if(!(istype(possessor) && possessor.ckey))
return 0
if(src.ckey || src.client)
possessor << "<span class='warning'>\The [src] already has a player.</span>"
return 0
message_admins("<span class='adminnotice'>[key_name_admin(possessor)] has taken control of \the [src].</span>")
log_admin("[key_name(possessor)] took control of \the [src].")
transfer_personality(possessor.client)
qdel(possessor)
return 1
/mob/living/silicon/robot/drone/Destroy()
if(hat)
hat.loc = get_turf(src)
@@ -85,45 +85,47 @@
drone_progress = 0
/mob/dead/verb/join_as_drone()
/mob/dead/observer/verb/join_as_drone()
set category = "Ghost"
set name = "Join As Drone"
set desc = "If there is a powered, enabled fabricator in the game world with a prepared chassis, join as a maintenance drone."
try_drone_spawn(src)
/proc/try_drone_spawn(var/mob/user, var/obj/machinery/drone_fabricator/fabricator)
if(ticker.current_state < GAME_STATE_PLAYING)
src << "<span class='danger'>The game hasn't started yet!</span>"
user << "<span class='danger'>The game hasn't started yet!</span>"
return
if(!(config.allow_drone_spawn))
src << "<span class='danger'>That verb is not currently permitted.</span>"
user << "<span class='danger'>That verb is not currently permitted.</span>"
return
if (!src.stat)
if(jobban_isbanned(user,"Cyborg"))
user << "<span class='danger'>You are banned from playing synthetics and cannot spawn as a drone.</span>"
return
if (usr != src)
return 0 //something is terribly wrong
if(jobban_isbanned(src,"Cyborg"))
usr << "<span class='danger'>You are banned from playing synthetics and cannot spawn as a drone.</span>"
if(!user.MayRespawn(1, DRONE_SPAWN_DELAY))
return
if(!MayRespawn(1, round(config.respawn_delay / 3)))
return
if(!fabricator)
var/list/all_fabricators = list()
for(var/obj/machinery/drone_fabricator/DF in world)
if(DF.stat & NOPOWER || !DF.produce_drones)
continue
if(DF.drone_progress >= 100)
var/list/all_fabricators = list()
for(var/obj/machinery/drone_fabricator/DF in machines)
if((DF.stat & NOPOWER) || !DF.produce_drones || DF.drone_progress < 100)
continue
all_fabricators[DF.fabricator_tag] = DF
if(!all_fabricators.len)
src << "<span class='danger'>There are no available drone spawn points, sorry.</span>"
return
if(!all_fabricators.len)
user << "<span class='danger'>There are no available drone spawn points, sorry.</span>"
return
var/choice = input(src,"Which fabricator do you wish to use?") as null|anything in all_fabricators
if(choice)
var/obj/machinery/drone_fabricator/chosen_fabricator = all_fabricators[choice]
chosen_fabricator.create_drone(src.client)
var/choice = input(user,"Which fabricator do you wish to use?") as null|anything in all_fabricators
if(!choice || !all_fabricators[choice])
return
fabricator = all_fabricators[choice]
if(user && fabricator && !((fabricator.stat & NOPOWER) || !fabricator.produce_drones || fabricator.drone_progress < 100))
fabricator.create_drone(user.client)
return 1
return
@@ -29,6 +29,7 @@
universal_understand = 1
holder_type = /obj/item/weapon/holder/mouse
mob_size = MOB_MINISCULE
possession_candidate = 1
/mob/living/simple_animal/mouse/Life()
..()