Skip to content

Commit

Permalink
boss movement calls, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
silencer-pl committed Sep 29, 2024
1 parent ca3cc58 commit 694f0e3
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 26 deletions.
2 changes: 2 additions & 0 deletions code/modules/client/client_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,5 @@

/// Holds the game master datum for this client
var/datum/game_master/game_master_menu

var/boss_click_mode = 0 //overrides clicking while possessing bosses
12 changes: 11 additions & 1 deletion code/modules/pve/boss/abilities/boss_abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
qdel(ring_line_left)
qdel(ring_ring)

/datum/boss_action/proc/fire_cannon(atom/target, mob/owner)
/datum/boss_action/proc/fire_cannon(atom/target)
var/mob/living/pve_boss/boss = owner
if (!istype(boss))
return
Expand All @@ -478,3 +478,13 @@
projectile.fire_at(target_to_hit, boss, boss, ammo_datum.max_range, ammo_datum.shell_speed)
return

/datum/boss_action/proc/process_regular_movement(turf/target)
return

/datum/boss_action/proc/move_towards(atom/target)
var/turf/target_turf = target
if(!target_turf) return
if(istype(target_turf,/turf/open/space))
to_chat(src, SPAN_WARNING("Move liekly outside of map bounds."))
return
INVOKE_ASYNC(src, PROC_REF(process_regular_movement), target)
13 changes: 13 additions & 0 deletions code/modules/pve/boss/abilities/boss_click_actions.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/datum/bossclicking/

var/mob/living/pve_boss/attached_mob

/datum/bossclicking/proc/AssignMob(mob/owner_mob)
attached_mob = owner_mob

/datum/bossclicking/proc/InterceptClickOn(mob/user, params, atom/object)

var/list/modifiers = params2list(params)

if(modifiers[LEFT_CLICK])
attached_mob.boss_ability.fire_cannon(object)
52 changes: 38 additions & 14 deletions code/modules/pve/boss/boss.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//Critical defines go here. Why here and not where Cm keeps its ohter defines? Because I'm tired of constantly having to look somewhere else during dev.


/mob/living/pve_boss
icon = 'icons/Surge/surge_default.dmi'
icon_state = "default"
Expand All @@ -7,39 +10,60 @@
//below should be safely disregarded if type is not set to 1
var/boss_stage = 1
var/datum/boss_action/boss_ability
var/datum/bossclicking/boss_click_intercept
var/list/boss_abilities = list()
var/list/ability_cooldowns = list()
var/explosion_damage = 30
var/aoe_delay = 40
var/missile_storm_missiles = 25
var/current_ability
var/action_activated = 0
var/list/action_cooldowns = list()
var/list/action_last_use_time = list()

/mob/living/pve_boss/Initialize()
/mob/living/pve_boss/proc/setup_boss()
boss_ability.set_owner(src)
boss_click_intercept.AssignMob(src)
click_intercept = boss_click_intercept

/mob/living/pve_boss/Initialize()
. = ..()
INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living/pve_boss/, setup_boss))


/datum/boss_action/

var/mob/owner = null
var/action_activated = 0
var/action_delay = 10
var/action_last_use_time

/datum/boss_action/proc/set_owner(mob/owner_mob)

/datum/boss_action/proc/set_owner(mob/owner_mob) // Assigns owner reference, makes some of the ability code easier. null will null the owner value.
if(!owner_mob)
if(owner)
owner = null
else
return
owner = owner_mob
return

/datum/boss_action/proc/switch_action() // Called to switch the active action. This also defines which action is getting its cooldown set etc
var/mob/living/pve_boss/boss_mob = owner
var/ability_pos = boss_mob.boss_abilities.Find(boss_mob.current_ability)
if(ability_pos == 0)
to_chat(usr, SPAN_WARNING("Boss ability not found. Misconfiguration likely."))
return

/datum/boss_action/proc/apply_cooldown(cooldown)
var/mob/living/pve_boss/boss_mob = owner
if(cooldown)
action_delay = cooldown
action_last_use_time = world.time


/datum/boss_action/proc/trigger_boss_skill(atom/affected_atom, mob/owner) // Default proccall for boss skills
return
boss_mob.action_cooldowns[boss_mob.current_ability] = cooldown
boss_mob.action_last_use_time[boss_mob.current_ability] = world.time

/datum/boss_action/proc/action_cooldown_check()
if(action_activated) return 0
if(!action_last_use_time)
var/mob/living/pve_boss/boss_mob = owner
if(boss_mob.action_activated) return 0
if(!boss_mob.action_last_use_time[boss_mob.current_ability])
return 1
else if(world.time > action_last_use_time + action_delay)
else if(world.time > boss_mob.action_last_use_time[boss_mob.current_ability] + boss_mob.action_cooldowns[boss_mob.current_ability])
return 1
else
return 0
22 changes: 11 additions & 11 deletions code/modules/pve/boss/mobs/boss_bot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
icon = 'icons/Surge/boss_bot/boss.dmi'
icon_state = "Boss Walking"
icon_size = 64
speed = 1
melee_damage_lower = 30
melee_damage_upper = 40
attack_sound = null
health = 10000 // This will obviously need adjustments
layer = MOB_LAYER
pixel_x = -8
old_x = -8
Expand All @@ -17,28 +21,24 @@
mob_size = MOB_SIZE_IMMOBILE

/* Old Xeno vars for reference
caste_type = XENO_CASTE_XENOSURGE_BOSS_BOT
caste_desc = "An agile defense platform, saturating the battlefield with defensive fire."
tier = 4
melee_damage_lower = 25
melee_damage_upper = 40
melee_vehicle_damage = 40
plasma_gain = XENO_PLASMA_GAIN_TIER_1
plasma_max = XENO_NO_PLASMA
armor_deflection = 100
max_health = 3000
evasion = XENO_EVASION_NONE
speed = 1
xeno_explosion_resistance = XENO_EXPLOSIVE_ARMOR_TIER_10
fire_immunity = FIRE_IMMUNITY_NO_IGNITE
attack_delay = -4
small_explosives_stun = FALS
tackle_min = 4
tackle_max = 5
tackle_chance = 40
tacklestrength_min = 4
tacklestrength_max = 4
minimap_icon = "runner"
small_explosives_stun = FALS
/datum/action/xeno_action/onclick/toggle_long_range/boss_bot
handles_movement = TRUE
Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2264,6 +2264,7 @@
#include "code\modules\projectiles\magazines\specialist.dm"
#include "code\modules\pve\spawner.dm"
#include "code\modules\pve\boss\boss.dm"
#include "code\modules\pve\boss\abilities\boss_click_actions.dm"
#include "code\modules\pve\boss\abilities\boss_abilities.dm"
#include "code\modules\pve\boss\ammo\boss_ammo.dm"
#include "code\modules\pve\boss\mobs\boss_bot.dm"
Expand Down

0 comments on commit 694f0e3

Please sign in to comment.