Skip to content

Commit

Permalink
Adds the Ninja MODsuit (tgstation#67220)
Browse files Browse the repository at this point in the history
     Why It's Good For The Game

Ninja code is pretty bad, I think it's best to move away into nice modular stuff instead.
Changelog

cl Fikou, PositiveEntropy, Nerevar, InfraRedBaron
refactor: the ninja space suit is now a modsuit
fix: fixes dash beams not working
/cl
  • Loading branch information
Fikou authored May 31, 2022
1 parent a2130c3 commit ee3ab47
Show file tree
Hide file tree
Showing 74 changed files with 1,222 additions and 1,475 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/antagonists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ GLOBAL_LIST_INIT(ai_employers, list(
/// Checks if the given mob is a nuclear operative
#define IS_NUKE_OP(mob) (mob?.mind?.has_antag_datum(/datum/antagonist/nukeop))

//Tells whether or not someone is a space ninja
#define IS_SPACE_NINJA(mob) (mob?.mind?.has_antag_datum(/datum/antagonist/ninja))

/// Checks if the given mob is a heretic.
#define IS_HERETIC(mob) (mob.mind?.has_antag_datum(/datum/antagonist/heretic))
/// Check if the given mob is a heretic monster.
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@
#define CULT_SHUTTLE_CURSE "cult_shuttle_curse.json"
/// File location for eigenstasium lines
#define EIGENSTASIUM_FILE "eigenstasium.json"
/// File location for ninja lines
#define NINJA_FILE "ninja.json"
27 changes: 2 additions & 25 deletions code/_globalvars/phobias.dm
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,9 @@ GLOBAL_LIST_INIT(phobia_objs, list(
)),

"anime" = typecacheof(list(
/obj/item/clothing/gloves/space_ninja,
/obj/item/clothing/head/kitty/genuine,
/obj/item/clothing/mask/gas/space_ninja,
/obj/item/clothing/shoes/space_ninja,
/obj/item/clothing/suit/space/space_ninja,
/obj/item/clothing/mask/gas/ninja,
/obj/item/clothing/under/syndicate/ninja,
/obj/item/clothing/under/costume/schoolgirl,
/obj/item/energy_katana,
/obj/item/food/chawanmushi,
Expand Down Expand Up @@ -428,27 +426,6 @@ GLOBAL_LIST_INIT(phobia_objs, list(
/obj/structure/beebox,
)),

"anime" = typecacheof(list(
/obj/item/clothing/gloves/space_ninja,
/obj/item/clothing/head/kitty/genuine,
/obj/item/clothing/mask/gas/space_ninja,
/obj/item/clothing/shoes/space_ninja,
/obj/item/clothing/suit/space/space_ninja,
/obj/item/clothing/under/costume/schoolgirl,
/obj/item/energy_katana,
/obj/item/food/chawanmushi,
/obj/item/food/sashimi,
/obj/item/highfrequencyblade,
/obj/item/katana,
/obj/item/nullrod/claymore/katana,
/obj/item/nullrod/scythe/vibro,
/obj/item/reagent_containers/food/drinks/bottle/sake,
/obj/item/throwing_star,
/obj/item/toy/katana,
/obj/structure/mineral_door/paperframe,
/obj/structure/window/paperframe,
)),

"blood" = typecacheof(list(
/obj/effect/decal/cleanable/blood,
/obj/item/reagent_containers/blood,
Expand Down
10 changes: 0 additions & 10 deletions code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
to_chat(src, span_notice("You look at your arm and sigh."))
return

// Special glove functions:
// If the gloves do anything, have them return 1 to stop
// normal attack_hand() here.
var/obj/item/clothing/gloves/G = gloves // not typecast specifically enough in defines
if(proximity_flag && istype(G) && G.Touch(A,1,modifiers))
return
//This signal is needed to prevent gloves of the north star + hulk.
if(SEND_SIGNAL(src, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, A, proximity_flag, modifiers) & COMPONENT_CANCEL_ATTACK_CHAIN)
return
Expand Down Expand Up @@ -114,10 +108,6 @@
. = ..()
if(.)
return
if(gloves)
var/obj/item/clothing/gloves/G = gloves
if(istype(G) && G.Touch(A,0,modifiers)) // for magic gloves
return TRUE

if(isturf(A) && get_dist(src,A) <= 1)
Move_Pulled(A)
Expand Down
10 changes: 6 additions & 4 deletions code/datums/dash_weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
var/dash_sound = 'sound/magic/blink.ogg'
var/recharge_sound = 'sound/magic/charge.ogg'
var/beam_effect = "blur"
var/beam_length = 2 SECONDS
var/phasein = /obj/effect/temp_visual/dir_setting/ninja/phase
var/phaseout = /obj/effect/temp_visual/dir_setting/ninja/phase/out

Expand All @@ -33,18 +34,19 @@
/// Teleports user to target using do_teleport. Returns TRUE if teleport successful, FALSE otherwise.
/datum/action/innate/dash/proc/teleport(mob/user, atom/target)
if(!IsAvailable())
user.balloon_alert(user, "no charges!")
return FALSE

var/turf/current_turf = get_turf(user)
var/turf/target_turf = get_turf(target)
if(target in view(user.client.view, user))
if(!do_teleport(user, target_turf, no_effects = TRUE))
user.balloon_alert(user, "dash blocked by location!")
return FALSE

var/obj/spot1 = new phaseout(get_turf(user), user.dir)
var/obj/spot1 = new phaseout(current_turf, user.dir)
var/obj/spot2 = new phasein(target_turf, user.dir)
spot1.Beam(spot2,beam_effect, time = beam_length)
playsound(target_turf, dash_sound, 25, TRUE)
var/obj/spot2 = new phasein(get_turf(user), user.dir)
spot1.Beam(spot2,beam_effect,time=2 SECONDS)
current_charges--
owner.update_action_buttons_icon()
addtimer(CALLBACK(src, .proc/charge), charge_rate)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/elements/digitalcamo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

to_chat(M, span_warning("[source.p_their()] skin seems to be shifting like something is moving below it."))

/datum/element/digitalcamo/proc/can_track(datum/source)
/datum/element/digitalcamo/proc/can_track(datum/source, mob/user)
SIGNAL_HANDLER

return COMPONENT_CANT_TRACK
Expand Down
44 changes: 23 additions & 21 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -707,29 +707,31 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e
do_drop_animation(location)

/obj/item/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
if(hit_atom && !QDELETED(hit_atom))
SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, hit_atom, throwingdatum)
if(get_temperature() && isliving(hit_atom))
var/mob/living/L = hit_atom
L.ignite_mob()
var/itempush = 1
if(w_class < 4)
itempush = 0 //too light to push anything
if(istype(hit_atom, /mob/living)) //Living mobs handle hit sounds differently.
var/volume = get_volume_by_throwforce_and_or_w_class()
if (throwforce > 0)
if (mob_throw_hit_sound)
playsound(hit_atom, mob_throw_hit_sound, volume, TRUE, -1)
else if(hitsound)
playsound(hit_atom, hitsound, volume, TRUE, -1)
else
playsound(hit_atom, 'sound/weapons/genhit.ogg',volume, TRUE, -1)
if(QDELETED(hit_atom))
return
if(SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, hit_atom, throwingdatum) & COMPONENT_MOVABLE_IMPACT_NEVERMIND)
return
if(get_temperature() && isliving(hit_atom))
var/mob/living/L = hit_atom
L.ignite_mob()
var/itempush = 1
if(w_class < 4)
itempush = 0 //too light to push anything
if(istype(hit_atom, /mob/living)) //Living mobs handle hit sounds differently.
var/volume = get_volume_by_throwforce_and_or_w_class()
if (throwforce > 0)
if (mob_throw_hit_sound)
playsound(hit_atom, mob_throw_hit_sound, volume, TRUE, -1)
else if(hitsound)
playsound(hit_atom, hitsound, volume, TRUE, -1)
else
playsound(hit_atom, 'sound/weapons/throwtap.ogg', 1, volume, -1)

playsound(hit_atom, 'sound/weapons/genhit.ogg',volume, TRUE, -1)
else
playsound(src, drop_sound, YEET_SOUND_VOLUME, ignore_walls = FALSE)
return hit_atom.hitby(src, 0, itempush, throwingdatum=throwingdatum)
playsound(hit_atom, 'sound/weapons/throwtap.ogg', 1, volume, -1)

else
playsound(src, drop_sound, YEET_SOUND_VOLUME, ignore_walls = FALSE)
return hit_atom.hitby(src, 0, itempush, throwingdatum=throwingdatum)

/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, gentle = FALSE, quickstart = TRUE)
if(HAS_TRAIT(src, TRAIT_NODROP))
Expand Down
17 changes: 16 additions & 1 deletion code/modules/antagonists/abductor/equipment/abduction_gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,24 @@ Congratulations! You are now trained for invasive xenobiology research!"}
desc = "Abduct with style - spiky style. Prevents digital tracking."
icon_state = "alienhelmet"
inhand_icon_state = "alienhelmet"
blockTracking = TRUE
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDEFACIALHAIR|HIDESNOUT

/obj/item/clothing/head/helmet/abductor/equipped(mob/living/user, slot)
. = ..()
if(slot_flags & slot)
RegisterSignal(user, COMSIG_LIVING_CAN_TRACK, .proc/can_track)
else
UnregisterSignal(user, COMSIG_LIVING_CAN_TRACK)

/obj/item/clothing/head/helmet/abductor/dropped(mob/living/user)
. = ..()
UnregisterSignal(user, COMSIG_LIVING_CAN_TRACK)

/obj/item/clothing/head/helmet/abductor/proc/can_track(datum/source, mob/user)
SIGNAL_HANDLER

return COMPONENT_CANT_TRACK

// Operating Table / Beds / Lockers

/obj/structure/bed/abductor
Expand Down
4 changes: 2 additions & 2 deletions code/modules/antagonists/nukeop/clownop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
/datum/outfit/clown_operative
name = "Clown Operative (Preview only)"

back = /obj/item/mod/control/pre_equipped/syndicate_empty/honkerative
back = /obj/item/mod/control/pre_equipped/empty/syndicate/honkerative
uniform = /obj/item/clothing/under/syndicate

/datum/outfit/clown_operative/post_equip(mob/living/carbon/human/H, visualsOnly)
Expand All @@ -79,7 +79,7 @@
/datum/outfit/clown_operative_elite
name = "Clown Operative (Elite, Preview only)"

back = /obj/item/mod/control/pre_equipped/syndicate_empty/honkerative
back = /obj/item/mod/control/pre_equipped/empty/syndicate/honkerative
uniform = /obj/item/clothing/under/syndicate

/datum/outfit/clown_operative_elite/post_equip(mob/living/carbon/human/H, visualsOnly)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/antagonists/nukeop/nukeop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
/datum/outfit/nuclear_operative
name = "Nuclear Operative (Preview only)"

back = /obj/item/mod/control/pre_equipped/syndicate_empty
back = /obj/item/mod/control/pre_equipped/empty/syndicate
uniform = /obj/item/clothing/under/syndicate

/datum/outfit/nuclear_operative/post_equip(mob/living/carbon/human/H, visualsOnly)
Expand All @@ -202,7 +202,7 @@
/datum/outfit/nuclear_operative_elite
name = "Nuclear Operative (Elite, Preview only)"

back = /obj/item/mod/control/pre_equipped/syndicate_empty/elite
back = /obj/item/mod/control/pre_equipped/empty/elite
uniform = /obj/item/clothing/under/syndicate
l_hand = /obj/item/modular_computer/tablet/nukeops
r_hand = /obj/item/shield/energy
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/space_ninja/space_ninja.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
show_to_ghosts = TRUE
antag_moodlet = /datum/mood_event/focused
suicide_cry = "FOR THE SPIDER CLAN!!"
preview_outfit = /datum/outfit/ninja
preview_outfit = /datum/outfit/ninja_preview
///Whether or not this ninja will obtain objectives
var/give_objectives = TRUE
///Whether or not this ninja receives the standard equipment
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cargo/markets/market_items/clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/datum/market_item/clothing/ninja_mask
name = "Space Ninja Mask"
desc = "Apart from being acid, lava, fireproof and being hard to take off someone it does nothing special on it's own."
item = /obj/item/clothing/mask/gas/space_ninja
item = /obj/item/clothing/mask/gas/ninja

price_min = CARGO_CRATE_VALUE
price_max = CARGO_CRATE_VALUE * 2.5
Expand Down
4 changes: 0 additions & 4 deletions code/modules/clothing/gloves/_gloves.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
var/mob/M = loc
M.update_inv_gloves()

// Called just before an attack_hand(), in mob/UnarmedAttack()
/obj/item/clothing/gloves/proc/Touch(atom/A, proximity, mouseparams)
return FALSE // return 1 to cancel attack_hand()

/obj/item/clothing/gloves/wirecutter_act(mob/living/user, obj/item/I)
. = ..()
if(!cut_type)
Expand Down
1 change: 0 additions & 1 deletion code/modules/clothing/head/_head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
icon = 'icons/obj/clothing/hats.dmi'
body_parts_covered = HEAD
slot_flags = ITEM_SLOT_HEAD
var/blockTracking = 0 //For AI tracking
var/can_toggle = null

///Special throw_impact for hats to frisbee hats at people to place them on their heads/attempt to de-hat them.
Expand Down
2 changes: 2 additions & 0 deletions code/modules/clothing/outfits/standard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@
/datum/outfit/chrono_agent/post_equip(mob/living/carbon/human/agent, visualsOnly)
. = ..()
var/obj/item/mod/control/mod = agent.back
if(!istype(mod))
return
var/obj/item/mod/module/eradication_lock/lock = locate(/obj/item/mod/module/eradication_lock) in mod.modules
lock.true_owner_ckey = agent.ckey

Expand Down
2 changes: 1 addition & 1 deletion code/modules/events/shuttle_loan.dm
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
var/turf/T = pick_n_take(empty_shuttle_turfs)

new /obj/effect/decal/remains/human(T)
new /obj/item/clothing/shoes/space_ninja(T)
new /obj/item/clothing/shoes/jackboots/fast(T)
new /obj/item/clothing/mask/balaclava(T)

for(var/i in 1 to 5)
Expand Down
9 changes: 0 additions & 9 deletions code/modules/mob/living/carbon/human/human_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@
return dna.species.handle_chemicals(R, src, delta_time, times_fired)
// if it returns 0, it will run the usual on_mob_life for that reagent. otherwise, it will stop after running handle_chemicals for the species.


/mob/living/carbon/human/can_track(mob/living/user)
if(istype(head, /obj/item/clothing/head))
var/obj/item/clothing/head/hat = head
if(hat.blockTracking)
return 0

return ..()

/mob/living/carbon/human/can_use_guns(obj/item/G)
. = ..()
if(G.trigger_guard == TRIGGER_GUARD_NORMAL)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@

/mob/living/proc/can_track(mob/living/user)
//basic fast checks go first. When overriding this proc, I recommend calling ..() at the end.
if(SEND_SIGNAL(src, COMSIG_LIVING_CAN_TRACK, args) & COMPONENT_CANT_TRACK)
if(SEND_SIGNAL(src, COMSIG_LIVING_CAN_TRACK, user) & COMPONENT_CANT_TRACK)
return FALSE
var/turf/T = get_turf(src)
if(!T)
Expand Down
6 changes: 5 additions & 1 deletion code/modules/mod/mod_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
. += span_notice("You could remove [ai] with an <b>intellicard</b>.")
else
. += span_notice("You could install an AI with an <b>intellicard</b>.")
. += span_notice("<i>You could examine it more thoroughly...</i>")

/obj/item/mod/control/examine_more(mob/user)
. = ..()
Expand Down Expand Up @@ -507,7 +508,7 @@
return
var/module_reference = display_names[pick]
var/obj/item/mod/module/picked_module = locate(module_reference) in modules
if(!istype(picked_module) || user.incapacitated())
if(!istype(picked_module))
return
picked_module.on_select()

Expand Down Expand Up @@ -592,6 +593,9 @@
/obj/item/mod/control/proc/subtract_charge(amount)
return core?.subtract_charge(amount) || FALSE

/obj/item/mod/control/proc/check_charge(amount)
return core?.check_charge(amount) || FALSE

/obj/item/mod/control/proc/update_charge_alert()
if(!wearer)
return
Expand Down
15 changes: 15 additions & 0 deletions code/modules/mod/mod_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
/obj/item/mod/core/proc/subtract_charge(amount)
return FALSE

/obj/item/mod/core/proc/check_charge(amount)
return FALSE

/obj/item/mod/core/proc/update_charge_alert()
mod.wearer.clear_alert(ALERT_MODSUIT_CHARGE)

Expand All @@ -62,6 +65,9 @@
/obj/item/mod/core/infinite/subtract_charge(amount)
return TRUE

/obj/item/mod/core/infinite/check_charge(amount)
return TRUE

/obj/item/mod/core/standard
name = "MOD standard core"
icon_state = "mod-core-standard"
Expand Down Expand Up @@ -120,6 +126,9 @@
return FALSE
return charge_source.use(amount, TRUE)

/obj/item/mod/core/standard/check_charge(amount)
return charge_amount() >= amount

/obj/item/mod/core/standard/update_charge_alert()
var/obj/item/stock_parts/cell/charge_source = charge_source()
if(!charge_source)
Expand Down Expand Up @@ -260,6 +269,9 @@
charge_source.adjust_charge(-amount*charge_modifier)
return TRUE

/obj/item/mod/core/ethereal/check_charge(amount)
return charge_amount() >= amount*charge_modifier

/obj/item/mod/core/ethereal/update_charge_alert()
var/obj/item/organ/internal/stomach/ethereal/charge_source = charge_source()
if(charge_source)
Expand Down Expand Up @@ -309,6 +321,9 @@
charge = max(0, charge - amount)
return TRUE

/obj/item/mod/core/plasma/check_charge(amount)
return charge_amount() >= amount

/obj/item/mod/core/plasma/update_charge_alert()
var/remaining_plasma = charge_amount() / max_charge_amount()
switch(remaining_plasma)
Expand Down
Loading

0 comments on commit ee3ab47

Please sign in to comment.