@@ -0,0 +1,90 @@
|
||||
//Note to future generations: I didn't write this god-awful code I just ported it to the event system and tried to make it less moon-speaky.
|
||||
//Don't judge me D; ~Carn //Maximum judging occuring - Remie.
|
||||
// Tut tut Remie, let's keep our comments constructive. - coiax
|
||||
|
||||
/*
|
||||
|
||||
Contents:
|
||||
- The Ninja "Random" Event
|
||||
- Ninja creation code
|
||||
*/
|
||||
|
||||
/datum/round_event_control/ninja
|
||||
name = "Space Ninja"
|
||||
typepath = /datum/round_event/ghost_role/ninja
|
||||
max_occurrences = 1
|
||||
earliest_start = 40 MINUTES
|
||||
gamemode_blacklist = list("dynamic")
|
||||
min_players = 15
|
||||
|
||||
/datum/round_event/ghost_role/ninja
|
||||
var/success_spawn = 0
|
||||
role_name = "space ninja"
|
||||
minimum_required = 1
|
||||
|
||||
var/helping_station
|
||||
var/spawn_loc
|
||||
var/give_objectives = TRUE
|
||||
|
||||
/datum/round_event/ghost_role/ninja/setup()
|
||||
helping_station = rand(0,1)
|
||||
|
||||
/datum/round_event/ghost_role/ninja/kill()
|
||||
if(!success_spawn && control)
|
||||
control.occurrences--
|
||||
return ..()
|
||||
|
||||
/datum/round_event/ghost_role/ninja/spawn_role()
|
||||
//selecting a spawn_loc
|
||||
if(!spawn_loc)
|
||||
var/list/spawn_locs = list()
|
||||
for(var/obj/effect/landmark/carpspawn/L in GLOB.landmarks_list)
|
||||
if(isturf(L.loc))
|
||||
spawn_locs += L.loc
|
||||
if(!spawn_locs.len)
|
||||
return kill()
|
||||
spawn_loc = pick(spawn_locs)
|
||||
if(!spawn_loc)
|
||||
return MAP_ERROR
|
||||
|
||||
//selecting a candidate player
|
||||
var/list/candidates = get_candidates(ROLE_NINJA, null, ROLE_NINJA)
|
||||
if(!candidates.len)
|
||||
return NOT_ENOUGH_PLAYERS
|
||||
|
||||
var/mob/dead/selected_candidate = pick_n_take(candidates)
|
||||
var/key = selected_candidate.key
|
||||
|
||||
//Prepare ninja player mind
|
||||
var/datum/mind/Mind = new /datum/mind(key)
|
||||
Mind.assigned_role = ROLE_NINJA
|
||||
Mind.special_role = ROLE_NINJA
|
||||
Mind.active = 1
|
||||
|
||||
//spawn the ninja and assign the candidate
|
||||
var/mob/living/carbon/human/Ninja = create_space_ninja(spawn_loc)
|
||||
Mind.transfer_to(Ninja)
|
||||
var/datum/antagonist/ninja/ninjadatum = new
|
||||
ninjadatum.helping_station = pick(TRUE,FALSE)
|
||||
Mind.add_antag_datum(ninjadatum)
|
||||
|
||||
if(Ninja.mind != Mind) //something has gone wrong!
|
||||
throw EXCEPTION("Ninja created with incorrect mind")
|
||||
|
||||
spawned_mobs += Ninja
|
||||
message_admins("[ADMIN_LOOKUPFLW(Ninja)] has been made into a ninja by an event.")
|
||||
log_game("[key_name(Ninja)] was spawned as a ninja by an event.")
|
||||
success_spawn = TRUE
|
||||
|
||||
return SUCCESSFUL_SPAWN
|
||||
|
||||
|
||||
//=======//NINJA CREATION PROCS//=======//
|
||||
|
||||
/proc/create_space_ninja(spawn_loc)
|
||||
var/mob/living/carbon/human/new_ninja = new(spawn_loc)
|
||||
var/datum/preferences/A = new()//Randomize appearance for the ninja.
|
||||
A.real_name = "[pick(GLOB.ninja_titles)] [pick(GLOB.ninja_names)]"
|
||||
A.copy_to(new_ninja)
|
||||
new_ninja.dna.update_dna_identity()
|
||||
return new_ninja
|
||||
@@ -16,7 +16,7 @@
|
||||
implants = list(/obj/item/implant/explosive)
|
||||
|
||||
|
||||
/datum/outfit/ninja/post_equip(mob/living/carbon/human/H, visualsOnly = FALSE, client/preference_source)
|
||||
/datum/outfit/ninja/post_equip(mob/living/carbon/human/H)
|
||||
if(istype(H.wear_suit, suit))
|
||||
var/obj/item/clothing/suit/space/space_ninja/S = H.wear_suit
|
||||
if(istype(H.belt, belt))
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
/*
|
||||
|
||||
Contents:
|
||||
- Stealth Verbs
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/toggle_stealth()
|
||||
if(!affecting || stealth_cooldown > world.time)
|
||||
return
|
||||
if(stealth)
|
||||
cancel_stealth()
|
||||
else
|
||||
if(cell.charge <= 0)
|
||||
to_chat(affecting, "<span class='warning'>You don't have enough power to enable Stealth!</span>")
|
||||
return
|
||||
stealth = TRUE
|
||||
stealth_cooldown = world.time + 5 SECONDS
|
||||
animate(affecting, alpha = 15, time = 3 SECONDS)
|
||||
affecting.visible_message("<span class='warning'>[affecting.name] vanishes into thin air!</span>", \
|
||||
"<span class='notice'>You are now mostly invisible to normal detection.</span>")
|
||||
addtimer(CALLBACK(src, .proc/enable_signals), 3 SECONDS)
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/enable_signals()
|
||||
if(!affecting)
|
||||
return
|
||||
RegisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_TELEPORTED, COMSIG_LIVING_GUN_PROCESS_FIRE), .proc/reduce_stealth)
|
||||
RegisterSignal(affecting, COMSIG_MOVABLE_BUMP, .proc/bumping_stealth)
|
||||
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/reduce_stealth(datum/source)
|
||||
affecting.alpha = min(affecting.alpha + 40, 100)
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/bumping_stealth(datum/source, atom/A)
|
||||
if(isliving(A))
|
||||
affecting.alpha = min(affecting.alpha + 20, 100)
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/cancel_stealth()
|
||||
if(!affecting || !stealth)
|
||||
return FALSE
|
||||
stealth = !stealth
|
||||
stealth_cooldown = world.time + 5 SECONDS
|
||||
UnregisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_TELEPORTED, COMSIG_LIVING_GUN_PROCESS_FIRE))
|
||||
animate(affecting, alpha = 255, time = 3 SECONDS)
|
||||
affecting.visible_message("<span class='warning'>[affecting.name] appears from thin air!</span>", \
|
||||
"<span class='notice'>You are now visible.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/stealth()
|
||||
if(!s_busy)
|
||||
toggle_stealth()
|
||||
else
|
||||
to_chat(affecting, "<span class='danger'>Stealth does not appear to work!</span>")
|
||||
@@ -0,0 +1,190 @@
|
||||
|
||||
/*
|
||||
|
||||
Contents:
|
||||
- The Ninja Space Suit
|
||||
- Ninja Space Suit Procs
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// /obj/item/clothing/suit/space/space_ninja
|
||||
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja
|
||||
name = "ninja suit"
|
||||
desc = "A unique, vacuum-proof suit of nano-enhanced armor designed specifically for Spider Clan assassins."
|
||||
icon_state = "s-ninja"
|
||||
item_state = "s-ninja_suit"
|
||||
allowed = list(/obj/item/gun, /obj/item/ammo_box, /obj/item/ammo_casing, /obj/item/melee/baton, /obj/item/restraints/handcuffs, /obj/item/tank/internals, /obj/item/stock_parts/cell)
|
||||
slowdown = 1
|
||||
resistance_flags = LAVA_PROOF | ACID_PROOF
|
||||
armor = list("melee" = 60, "bullet" = 50, "laser" = 30,"energy" = 15, "bomb" = 30, "bio" = 30, "rad" = 30, "fire" = 100, "acid" = 100)
|
||||
strip_delay = 12
|
||||
|
||||
actions_types = list(/datum/action/item_action/initialize_ninja_suit, /datum/action/item_action/ninjasmoke, /datum/action/item_action/ninjaboost, /datum/action/item_action/ninjapulse, /datum/action/item_action/ninjastar, /datum/action/item_action/ninjanet, /datum/action/item_action/ninja_sword_recall, /datum/action/item_action/ninja_stealth, /datum/action/item_action/toggle_glove)
|
||||
|
||||
//Important parts of the suit.
|
||||
var/mob/living/carbon/human/affecting = null
|
||||
var/obj/item/stock_parts/cell/cell
|
||||
var/datum/effect_system/spark_spread/spark_system
|
||||
var/datum/techweb/stored_research
|
||||
var/obj/item/disk/tech_disk/t_disk//To copy design onto disk.
|
||||
var/obj/item/energy_katana/energyKatana //For teleporting the katana back to the ninja (It's an ability)
|
||||
|
||||
//Other articles of ninja gear worn together, used to easily reference them after initializing.
|
||||
var/obj/item/clothing/head/helmet/space/space_ninja/n_hood
|
||||
var/obj/item/clothing/shoes/space_ninja/n_shoes
|
||||
var/obj/item/clothing/gloves/space_ninja/n_gloves
|
||||
|
||||
//Main function variables.
|
||||
var/s_initialized = 0//Suit starts off.
|
||||
var/s_coold = 0//If the suit is on cooldown. Can be used to attach different cooldowns to abilities. Ticks down every second based on suit ntick().
|
||||
var/s_cost = 5//Base energy cost each ntick.
|
||||
var/s_acost = 25//Additional cost for additional powers active.
|
||||
var/s_delay = 40//How fast the suit does certain things, lower is faster. Can be overridden in specific procs. Also determines adverse probability.
|
||||
var/a_transfer = 20//How much radium is used per adrenaline boost.
|
||||
var/a_maxamount = 7//Maximum number of adrenaline boosts.
|
||||
var/s_maxamount = 20//Maximum number of smoke bombs.
|
||||
|
||||
//Support function variables.
|
||||
var/stealth = FALSE//Stealth off.
|
||||
var/stealth_cooldown = 0
|
||||
var/s_busy = FALSE//Is the suit busy with a process? Like AI hacking. Used for safety functions.
|
||||
|
||||
//Ability function variables.
|
||||
var/s_bombs = 10//Number of smoke bombs.
|
||||
var/a_boost = 3//Number of adrenaline boosters.
|
||||
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/get_cell()
|
||||
return cell
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/Initialize()
|
||||
. = ..()
|
||||
|
||||
//Spark Init
|
||||
spark_system = new
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
|
||||
//Research Init
|
||||
stored_research = new()
|
||||
|
||||
//Cell Init
|
||||
cell = new/obj/item/stock_parts/cell/high
|
||||
cell.charge = 9000
|
||||
cell.name = "black power cell"
|
||||
cell.icon_state = "bscell"
|
||||
|
||||
//Simply deletes all the attachments and self, killing all related procs.
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/terminate()
|
||||
qdel(n_hood)
|
||||
qdel(n_gloves)
|
||||
qdel(n_shoes)
|
||||
qdel(src)
|
||||
|
||||
|
||||
//Randomizes suit parameters.
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/randomize_param()
|
||||
s_cost = rand(1,20)
|
||||
s_acost = rand(20,100)
|
||||
s_delay = rand(10,100)
|
||||
s_bombs = rand(5,20)
|
||||
a_boost = rand(1,7)
|
||||
|
||||
|
||||
//This proc prevents the suit from being taken off.
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/lock_suit(mob/living/carbon/human/H)
|
||||
if(!istype(H))
|
||||
return FALSE
|
||||
if(!is_ninja(H))
|
||||
to_chat(H, "<span class='danger'><B>fÄTaL ÈÈRRoR</B>: 382200-*#00CÖDE <B>RED</B>\nUNAUHORIZED USÈ DETÈCeD\nCoMMÈNCING SUB-R0UIN3 13...\nTÈRMInATING U-U-USÈR...</span>")
|
||||
H.gib()
|
||||
return FALSE
|
||||
if(!istype(H.head, /obj/item/clothing/head/helmet/space/space_ninja))
|
||||
to_chat(H, "<span class='userdanger'>ERROR</span>: 100113 UNABLE TO LOCATE HEAD GEAR\nABORTING...")
|
||||
return FALSE
|
||||
if(!istype(H.shoes, /obj/item/clothing/shoes/space_ninja))
|
||||
to_chat(H, "<span class='userdanger'>ERROR</span>: 122011 UNABLE TO LOCATE FOOT GEAR\nABORTING...")
|
||||
return FALSE
|
||||
if(!istype(H.gloves, /obj/item/clothing/gloves/space_ninja))
|
||||
to_chat(H, "<span class='userdanger'>ERROR</span>: 110223 UNABLE TO LOCATE HAND GEAR\nABORTING...")
|
||||
return FALSE
|
||||
affecting = H
|
||||
ADD_TRAIT(src, TRAIT_NODROP, NINJA_SUIT_TRAIT) //colons make me go all |=
|
||||
slowdown = 0
|
||||
n_hood = H.head
|
||||
ADD_TRAIT(n_hood, TRAIT_NODROP, NINJA_SUIT_TRAIT)
|
||||
n_shoes = H.shoes
|
||||
ADD_TRAIT(n_shoes, TRAIT_NODROP, NINJA_SUIT_TRAIT)
|
||||
n_shoes.slowdown--
|
||||
n_gloves = H.gloves
|
||||
ADD_TRAIT(n_gloves, TRAIT_NODROP, NINJA_SUIT_TRAIT)
|
||||
return TRUE
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/lockIcons(mob/living/carbon/human/H)
|
||||
icon_state = H.gender==FEMALE ? "s-ninjanf" : "s-ninjan"
|
||||
H.gloves.icon_state = "s-ninjan"
|
||||
H.gloves.item_state = "s-ninjan"
|
||||
|
||||
|
||||
//This proc allows the suit to be taken off.
|
||||
/obj/item/clothing/suit/space/space_ninja/proc/unlock_suit()
|
||||
affecting = null
|
||||
REMOVE_TRAIT(src, TRAIT_NODROP, NINJA_SUIT_TRAIT)
|
||||
slowdown = 1
|
||||
icon_state = "s-ninja"
|
||||
if(n_hood)//Should be attached, might not be attached.
|
||||
REMOVE_TRAIT(n_hood, TRAIT_NODROP, NINJA_SUIT_TRAIT)
|
||||
if(n_shoes)
|
||||
REMOVE_TRAIT(n_shoes, TRAIT_NODROP, NINJA_SUIT_TRAIT)
|
||||
n_shoes.slowdown++
|
||||
if(n_gloves)
|
||||
n_gloves.icon_state = "s-ninja"
|
||||
n_gloves.item_state = "s-ninja"
|
||||
REMOVE_TRAIT(n_gloves, TRAIT_NODROP, NINJA_SUIT_TRAIT)
|
||||
n_gloves.candrain=0
|
||||
n_gloves.draining=0
|
||||
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/examine(mob/user)
|
||||
..()
|
||||
if(s_initialized && user == affecting)
|
||||
to_chat(user, "All systems operational. Current energy capacity: <B>[DisplayEnergy(cell.charge)]</B>.\n\
|
||||
The CLOAK-tech device is <B>[stealth?"active":"inactive"]</B>.\n\
|
||||
There are <B>[s_bombs]</B> smoke bomb\s remaining.\n\
|
||||
There are <B>[a_boost]</B> adrenaline booster\s remaining.")
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/ui_action_click(mob/user, action)
|
||||
if(istype(action, /datum/action/item_action/initialize_ninja_suit))
|
||||
toggle_on_off()
|
||||
return TRUE
|
||||
if(!s_initialized)
|
||||
to_chat(user, "<span class='warning'><b>ERROR</b>: suit offline. Please activate suit.</span>")
|
||||
return FALSE
|
||||
if(istype(action, /datum/action/item_action/ninjasmoke))
|
||||
ninjasmoke()
|
||||
return TRUE
|
||||
if(istype(action, /datum/action/item_action/ninjaboost))
|
||||
ninjaboost()
|
||||
return TRUE
|
||||
if(istype(action, /datum/action/item_action/ninjapulse))
|
||||
ninjapulse()
|
||||
return TRUE
|
||||
if(istype(action, /datum/action/item_action/ninjastar))
|
||||
ninjastar()
|
||||
return TRUE
|
||||
if(istype(action, /datum/action/item_action/ninjanet))
|
||||
ninjanet()
|
||||
return TRUE
|
||||
if(istype(action, /datum/action/item_action/ninja_sword_recall))
|
||||
ninja_sword_recall()
|
||||
return TRUE
|
||||
if(istype(action, /datum/action/item_action/ninja_stealth))
|
||||
stealth()
|
||||
return TRUE
|
||||
if(istype(action, /datum/action/item_action/toggle_glove))
|
||||
n_gloves.toggledrain()
|
||||
return TRUE
|
||||
return FALSE
|
||||
@@ -0,0 +1,17 @@
|
||||
/obj/item/clothing/suit/space/space_ninja/process()
|
||||
if(!affecting || !s_initialized)
|
||||
return PROCESS_KILL
|
||||
|
||||
if(cell.charge > 0)
|
||||
if(s_coold)
|
||||
s_coold--//Checks for ability s_cooldown first.
|
||||
|
||||
cell.charge -= s_cost//s_cost is the default energy cost each tick, usually 5.
|
||||
if(stealth && stealth_cooldown <= world.time)//If stealth is active.
|
||||
cell.charge -= s_acost
|
||||
affecting.alpha = max(affecting.alpha - 10, 15)
|
||||
|
||||
else
|
||||
cell.charge = 0
|
||||
if(stealth)
|
||||
cancel_stealth()
|
||||
Reference in New Issue
Block a user