Skip to content

Commit

Permalink
Some more abnormalities (#472)
Browse files Browse the repository at this point in the history
* All-Around Helper

* Some fixes, I hope
  • Loading branch information
EgorDinamit authored Oct 20, 2023
1 parent 6de9a83 commit 616cf8e
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 6 deletions.
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2440,6 +2440,7 @@
#include "code\modules\mob\living\simple_animal\hostile\infestation\spitter.dm"
#include "code\modules\mob\living\simple_animal\hostile\infestation\structures\hive_heart.dm"
#include "code\modules\mob\living\simple_animal\hostile\megafauna\_megafauna.dm"
#include "code\modules\mob\living\simple_animal\hostile\megafauna\abnormality\all_around_helper.dm"
#include "code\modules\mob\living\simple_animal\hostile\megafauna\abnormality\white_night.dm"
#include "code\modules\mob\living\simple_animal\hostile\megafauna\abnormality\white_night_apostles.dm"
#include "code\modules\mob\living\simple_animal\hostile\random_monster\_random_abilities.dm"
Expand Down
7 changes: 5 additions & 2 deletions code/_helpers/matrices.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Turn(.) //BYOND handles cases such as -270, 360, 540 etc. DOES NOT HANDLE 180 TURNS WELL, THEY TWEEN AND LOOK LIKE SHIT


/atom/proc/SpinAnimation(speed = 10, loops = -1, clockwise = 1, segments = 3)
/atom/proc/SpinAnimation(speed = 10, loops = -1, clockwise = 1, segments = 3, parallel = TRUE)
if(!segments)
return

Expand All @@ -23,7 +23,10 @@

speed /= segments

animate(src, transform = matrices[1], time = speed, loops)
if(parallel)
animate(src, transform = matrices[1], time = speed, loops, flags = ANIMATION_PARALLEL)
else
animate(src, transform = matrices[1], time = speed, loops)
for(var/i in 2 to segments) //2 because 1 is covered above
animate(transform = matrices[i], time = speed)
//doesn't have an object argument because this is "Stacking" with the animate call above
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
var/procname = null
var/atom/movable/target = null
var/check_flags = 0
var/processing = 0
var/active = 0
var/processing = FALSE
var/active = FALSE
var/obj/screen/movable/action_button/button = null
var/button_icon = 'icons/obj/action_buttons/actions.dmi'
var/button_icon_state = "default"
Expand Down
2 changes: 1 addition & 1 deletion code/datums/orbit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
shift.Translate(0, radius)
transform = shift

SpinAnimation(rotation_speed, -1, clockwise, rotation_segments)
SpinAnimation(rotation_speed, -1, clockwise, rotation_segments, parallel = FALSE)

/atom/movable/proc/stop_orbit()
SpinAnimation(0, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,38 @@
playsound(src, deathsound, 50, 1)

/datum/action/megafauna
action_type = AB_INNATE
var/chosen_message
var/chosen_attack_num

/datum/action/megafauna/Trigger()
/datum/action/megafauna/Activate()
to_chat(owner, FONT_LARGE(SPAN_DANGER(chosen_message)))
if(istype(owner, /mob/living/simple_animal/hostile/megafauna))
var/mob/living/simple_animal/hostile/megafauna/mf = owner
mf.chosen_attack = chosen_attack_num
return


/datum/action/megafauna/toggle
var/deactivate_message
var/button_icon_state_deactivated = ""

/datum/action/megafauna/toggle/Activate()
active = TRUE
to_chat(owner, FONT_LARGE(SPAN_DANGER(chosen_message)))
if(istype(owner, /mob/living/simple_animal/hostile/megafauna))
var/mob/living/simple_animal/hostile/megafauna/mf = owner
mf.chosen_attack = chosen_attack_num
button_icon_state = button_icon_state_deactivated
button.UpdateIcon()
return

/datum/action/megafauna/toggle/Deactivate()
active = FALSE
to_chat(owner, FONT_LARGE(SPAN_DANGER(deactivate_message)))
if(istype(owner, /mob/living/simple_animal/hostile/megafauna))
var/mob/living/simple_animal/hostile/megafauna/mf = owner
mf.chosen_attack = 0
button_icon_state = initial(button_icon_state)
button.UpdateIcon()
return
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/mob/living/simple_animal/hostile/megafauna/all_around_helper
name = "All-Around Helper"
desc = "A tiny spherical robot with blades attached in place of its \"legs\". It does looks helpful though."
icon = 'icons/mob/simple_animal/all_around_helper.dmi'
icon_state = "helper"
icon_living = "helper"
icon_dead = "helper"
speak_emote = list("states")
response_harm = "kicks"
faction = "abnormality"

default_pixel_x = -16
default_pixel_y = -16
pixel_x = -16
pixel_y = -16

health = 2000
maxHealth = 2000

natural_weapon = /obj/item/natural_weapon/all_around_helper
melee_attack_delay = 0
ranged = TRUE

movement_cooldown = 3.5

status_flags = NO_ANTAG

see_invisible = SEE_INVISIBLE_NOLIGHTING
see_in_dark = 7

natural_armor = list(
melee = ARMOR_MELEE_VERY_HIGH,
energy = ARMOR_ENERGY_SHIELDED,
laser = ARMOR_LASER_MAJOR,
)

mob_actions = list(
/datum/action/megafauna/toggle/helper_dash,
)

var/charging = FALSE
/// Maximum dash distance. After reaching that amount - forcibly stops without hitting a wall
var/dash_num = 50
var/dash_cooldown = 0
var/dash_cooldown_time = 8 SECONDS
var/dash_speed = 1
/// Damage done to humans hit during the dash. Non-human mobs receive twice the damage
var/dash_damage = 60
var/list/been_hit = list() // Don't get hit twice.

/obj/item/natural_weapon/all_around_helper
name = "blades"
attack_verb = list("cut", "sliced", "stabbed")
force = 12
armor_penetration = 25
sharp = TRUE
hitsound = 'sound/simple_mob/abnormality/all_around_helper/attack.ogg'
attack_cooldown = 3

/datum/action/megafauna/toggle/helper_dash
name = "Toggle Dash"
chosen_attack_num = 1
chosen_message = "You will now dash in that direction."
deactivate_message = "You won't dash anymore."
button_icon_state = "helper_toggle0"
button_icon_state_deactivated = "helper_toggle1"

/mob/living/simple_animal/hostile/megafauna/all_around_helper/SelfMove()
if(charging)
return FALSE
return ..()

/mob/living/simple_animal/hostile/megafauna/all_around_helper/IMove(turf/newloc, safety = TRUE)
if(charging)
return MOVEMENT_ON_COOLDOWN
return ..()

// Remind me to remove NPC and player differing controls...
/mob/living/simple_animal/hostile/megafauna/all_around_helper/ICheckRangedAttack(atom/A)
return TRUE

/mob/living/simple_animal/hostile/megafauna/all_around_helper/IRangedAttack(atom/A)
return RangedAttack(A)

/mob/living/simple_animal/hostile/megafauna/all_around_helper/RangedAttack(atom/A)
if(charging)
return

if(client && !A.Adjacent(src))
switch(chosen_attack)
if(1)
HelperDash(A)
return

if(dash_cooldown <= world.time)
var/chance_to_dash = 25
var/dir_to_target = get_dir(get_turf(src), get_turf(A))
if(dir_to_target in list(NORTH, SOUTH, WEST, EAST))
chance_to_dash = 100
if(prob(chance_to_dash))
HelperDash(A)

/mob/living/simple_animal/hostile/megafauna/all_around_helper/proc/HelperDash(atom/A)
if(charging || dash_cooldown > world.time)
return
dash_cooldown = world.time + dash_cooldown_time
charging = TRUE
var/dir_to_target = get_dir(get_turf(src), get_turf(A))
var/para = TRUE
if(dir_to_target in list(WEST, NORTHWEST, SOUTHWEST))
para = FALSE
been_hit = list()
SpinAnimation(1.8 SECONDS, 1, para)
addtimer(CALLBACK(src, .proc/DoDash, dir_to_target, 0), 1.5 SECONDS)
playsound(src, 'sound/simple_mob/abnormality/all_around_helper/rise.ogg', 100, 1)

/mob/living/simple_animal/hostile/megafauna/all_around_helper/proc/DoDash(move_dir, times_ran)
var/stop_charge = FALSE
if(times_ran >= dash_num)
stop_charge = TRUE
var/turf/T = get_step(get_turf(src), move_dir)
if(!T)
charging = FALSE
return
if(istype(T, /turf/simulated/mineral))
var/turf/simulated/mineral/M = T
M.GetDrilled()
if(T.density)
stop_charge = TRUE
for(var/obj/structure/window/W in T)
W.shatter()
for(var/obj/machinery/door/D in T.contents)
if(D.density)
if(istype(D, /obj/machinery/door/blast))
var/obj/machinery/door/blast/B = D
B.force_open()
continue
D.open(TRUE)
if(stop_charge)
playsound(src, 'sound/simple_mob/abnormality/all_around_helper/disable.ogg', 75, TRUE)
SLEEP_CHECK_DEATH(5 SECONDS)
charging = FALSE
return
forceMove(T)
var/para = TRUE
if(move_dir in list(WEST, NORTHWEST, SOUTHWEST))
para = FALSE
SpinAnimation(dash_speed, 1, para)
var/picked_sound = pick(
'sound/simple_mob/abnormality/all_around_helper/move01.ogg',
'sound/simple_mob/abnormality/all_around_helper/move02.ogg',
'sound/simple_mob/abnormality/all_around_helper/move03.ogg',
)
playsound(src, picked_sound, rand(50, 70), TRUE)
for(var/mob/living/L in range(1, T))
if(L.faction != faction)
if(L in been_hit)
continue
visible_message("<span class='boldwarning'>[src] runs through [L]!</span>")
to_chat(L, "<span class='userdanger'>[src] pierces you with their spinning blades!</span>")
playsound(L, 'sound/simple_mob/abnormality/all_around_helper/attack.ogg', 75, 1)
var/turf/LT = get_turf(L)
new /obj/effect/temp_visual/smash(LT)
if(ishuman(L))
var/mob/living/carbon/human/H = L
// Ugly code
var/affecting = pick(BP_HEAD, BP_CHEST, BP_L_ARM, BP_R_ARM, BP_L_LEG, BP_R_LEG)
H.apply_damage(dash_damage, BRUTE, affecting, DAM_SHARP | DAM_EDGE, null, 25)
else
L.adjustBruteLoss(dash_damage * 2)
if(L.stat >= DEAD)
L.gib()
continue
been_hit |= L
addtimer(CALLBACK(src, .proc/DoDash, move_dir, (times_ran + 1)), dash_speed)
Binary file added icons/mob/simple_animal/all_around_helper.dmi
Binary file not shown.
Binary file modified icons/obj/action_buttons/actions.dmi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 616cf8e

Please sign in to comment.