mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 12:08:55 +01:00
[MIRROR] Mecha refactor 2020 (#579)
* Mecha refactor 2020 * Update effects.dm Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com> Co-authored-by: Azarak <azarak10@gmail.com>
This commit is contained in:
co-authored by
TiviPlus
Azarak
parent
2d915ac2e4
commit
cd0d700a85
@@ -25,7 +25,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
|
||||
var/datum/hud/living/carbon/hud = null // hud
|
||||
var/bootime = 0
|
||||
var/started_as_observer //This variable is set to 1 when you enter the game as an observer.
|
||||
//If you died in the game and are a ghsot - this will remain as null.
|
||||
//If you died in the game and are a ghost - this will remain as null.
|
||||
//Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot.
|
||||
var/atom/movable/following = null
|
||||
var/fun_verbs = 0
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
var/obj/item/radio/radio = null //Let's give it a radio.
|
||||
var/mob/living/brain/brainmob = null //The current occupant.
|
||||
var/mob/living/silicon/robot = null //Appears unused.
|
||||
var/obj/mecha = null //This does not appear to be used outside of reference in mecha.dm.
|
||||
var/obj/vehicle/sealed/mecha = null //This does not appear to be used outside of reference in mecha.dm.
|
||||
var/obj/item/organ/brain/brain = null //The actual brain
|
||||
var/datum/ai_laws/laws = new()
|
||||
var/force_replace_ai_name = FALSE
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
return ..()
|
||||
|
||||
/mob/living/brain/update_mobility()
|
||||
if(in_contents_of(/obj/mecha))
|
||||
if(in_contents_of(/obj/vehicle/sealed/mecha))
|
||||
mobility_flags = MOBILITY_FLAGS_DEFAULT
|
||||
else
|
||||
mobility_flags = NONE
|
||||
@@ -65,13 +65,6 @@
|
||||
if(stored_dna)
|
||||
stored_dna.real_name = real_name
|
||||
|
||||
/mob/living/brain/ClickOn(atom/A, params)
|
||||
..()
|
||||
if(container)
|
||||
var/obj/mecha/M = container.mecha
|
||||
if(istype(M))
|
||||
return M.click_action(A,src,params)
|
||||
|
||||
/mob/living/brain/forceMove(atom/destination)
|
||||
if(container)
|
||||
return container.forceMove(destination)
|
||||
@@ -92,7 +85,7 @@
|
||||
if(!container)
|
||||
return
|
||||
if (container.mecha)
|
||||
var/obj/mecha/M = container.mecha
|
||||
var/obj/vehicle/sealed/mecha/M = container.mecha
|
||||
if(M.mouse_pointer)
|
||||
client.mouse_pointer_icon = M.mouse_pointer
|
||||
if (client && ranged_ability && ranged_ability.ranged_mousepointer)
|
||||
|
||||
@@ -32,10 +32,6 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift)
|
||||
if(client && !suiciding && !(client in GLOB.dead_players_during_shift))
|
||||
GLOB.dead_players_during_shift += client
|
||||
GLOB.deaths_during_shift++
|
||||
if(ismecha(loc))
|
||||
var/obj/mecha/M = loc
|
||||
if(M.occupant == src)
|
||||
M.go_out()
|
||||
|
||||
if(!QDELETED(dna)) //The gibbed param is bit redundant here since dna won't exist at this point if they got deleted.
|
||||
dna.species.spec_death(gibbed, src)
|
||||
|
||||
@@ -353,46 +353,6 @@
|
||||
var/armor_block = run_armor_check(affecting, MELEE)
|
||||
apply_damage(damage, BRUTE, affecting, armor_block, wound_bonus=wound_mod)
|
||||
|
||||
/mob/living/carbon/human/mech_melee_attack(obj/mecha/M)
|
||||
|
||||
if(M.occupant.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(M.occupant, TRAIT_PACIFISM))
|
||||
to_chat(M.occupant, "<span class='warning'>You don't want to harm other living beings!</span>")
|
||||
return
|
||||
M.do_attack_animation(src)
|
||||
if(M.damtype == BRUTE)
|
||||
step_away(src,M,15)
|
||||
var/obj/item/bodypart/temp = get_bodypart(pick(BODY_ZONE_CHEST, BODY_ZONE_CHEST, BODY_ZONE_CHEST, BODY_ZONE_HEAD))
|
||||
if(temp)
|
||||
var/update = 0
|
||||
var/dmg = rand(M.force/2, M.force)
|
||||
switch(M.damtype)
|
||||
if(BRUTE)
|
||||
if(M.force > 35) // durand and other heavy mechas
|
||||
Unconscious(20)
|
||||
else if(M.force > 20 && !IsKnockdown()) // lightweight mechas like gygax
|
||||
Knockdown(40)
|
||||
update |= temp.receive_damage(dmg, 0)
|
||||
playsound(src, 'sound/weapons/punch4.ogg', 50, TRUE)
|
||||
if(BURN)
|
||||
update |= temp.receive_damage(0, dmg)
|
||||
playsound(src, 'sound/items/welder.ogg', 50, TRUE)
|
||||
if(TOX)
|
||||
M.mech_toxin_damage(src)
|
||||
else
|
||||
return
|
||||
if(update)
|
||||
update_damage_overlays()
|
||||
updatehealth()
|
||||
|
||||
visible_message("<span class='danger'>[M.name] hits [src]!</span>", \
|
||||
"<span class='userdanger'>[M.name] hits you!</span>", "<span class='hear'>You hear a sickening sound of flesh hitting flesh!</span>", COMBAT_MESSAGE_RANGE, M)
|
||||
to_chat(M, "<span class='danger'>You hit [src]!</span>")
|
||||
log_combat(M.occupant, src, "attacked", M, "(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])")
|
||||
|
||||
else
|
||||
..()
|
||||
|
||||
|
||||
/mob/living/carbon/human/ex_act(severity, target, origin)
|
||||
if(TRAIT_BOMBIMMUNE in dna.species.species_traits)
|
||||
|
||||
@@ -216,13 +216,13 @@
|
||||
disintegrate(I, I)
|
||||
|
||||
else if(ismecha(AM))
|
||||
var/obj/mecha/M = AM
|
||||
if(M.haslights)
|
||||
var/obj/vehicle/sealed/mecha/M = AM
|
||||
if(M.mecha_flags & HAS_LIGHTS)
|
||||
M.visible_message("<span class='danger'>[M]'s lights burn out!</span>")
|
||||
M.haslights = FALSE
|
||||
M.set_light(-M.lights_power)
|
||||
if(M.occupant)
|
||||
M.lights_action.Remove(M.occupant)
|
||||
M.mecha_flags &= ~HAS_LIGHTS
|
||||
M.set_light_on(FALSE)
|
||||
for(var/occupant in M.occupants)
|
||||
M.remove_action_type_from_mob(/datum/action/vehicle/sealed/mecha/mech_toggle_lights, occupant)
|
||||
for(var/obj/item/O in AM.GetAllContents())
|
||||
if(O.light_range && O.light_power)
|
||||
disintegrate(O, M)
|
||||
|
||||
@@ -98,39 +98,6 @@
|
||||
playsound(loc, 'sound/weapons/genhit.ogg', 50, TRUE, -1) //Item sounds are handled in the item itself
|
||||
return ..()
|
||||
|
||||
|
||||
/mob/living/mech_melee_attack(obj/mecha/M)
|
||||
if(M.occupant.a_intent == INTENT_HARM)
|
||||
if(HAS_TRAIT(M.occupant, TRAIT_PACIFISM))
|
||||
to_chat(M.occupant, "<span class='warning'>You don't want to harm other living beings!</span>")
|
||||
return
|
||||
M.do_attack_animation(src)
|
||||
if(M.damtype == BRUTE)
|
||||
step_away(src,M,15)
|
||||
switch(M.damtype)
|
||||
if(BRUTE)
|
||||
Unconscious(20)
|
||||
take_overall_damage(rand(M.force/2, M.force))
|
||||
playsound(src, 'sound/weapons/punch4.ogg', 50, TRUE)
|
||||
if(BURN)
|
||||
take_overall_damage(0, rand(M.force/2, M.force))
|
||||
playsound(src, 'sound/items/welder.ogg', 50, TRUE)
|
||||
if(TOX)
|
||||
M.mech_toxin_damage(src)
|
||||
else
|
||||
return
|
||||
updatehealth()
|
||||
visible_message("<span class='danger'>[M.name] hits [src]!</span>", \
|
||||
"<span class='userdanger'>[M.name] hits you!</span>", "<span class='hear'>You hear a sickening sound of flesh hitting flesh!</span>", COMBAT_MESSAGE_RANGE, M)
|
||||
to_chat(M, "<span class='danger'>You hit [src]!</span>")
|
||||
log_combat(M.occupant, src, "attacked", M, "(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])")
|
||||
else
|
||||
step_away(src,M)
|
||||
log_combat(M.occupant, src, "pushed", M)
|
||||
visible_message("<span class='warning'>[M] pushes [src] out of the way.</span>", \
|
||||
"<span class='warning'>[M] pushes you out of the way.</span>", "<span class='hear'>You hear aggressive shuffling!</span>", 5, M)
|
||||
to_chat(M, "<span class='danger'>You push [src] out of the way.</span>")
|
||||
|
||||
/mob/living/fire_act()
|
||||
adjust_fire_stacks(3)
|
||||
IgniteMob()
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
var/alarms = list("Motion"=list(), "Fire"=list(), "Atmosphere"=list(), "Power"=list(), "Camera"=list(), "Burglar"=list())
|
||||
var/viewalerts = 0
|
||||
var/icon/holo_icon//Default is assigned when AI is created.
|
||||
var/obj/mecha/controlled_mech //For controlled_mech a mech, to determine whether to relaymove or use the AI eye.
|
||||
var/obj/vehicle/sealed/mecha/controlled_mech //For controlled_mech a mech, to determine whether to relaymove or use the AI eye.
|
||||
var/radio_enabled = TRUE //Determins if a carded AI can speak with its built in radio or not.
|
||||
radiomod = ";" //AIs will, by default, state their laws on the internal radio.
|
||||
var/obj/item/multitool/aiMulti
|
||||
@@ -422,7 +422,7 @@
|
||||
to_chat(src, "Target is not on or near any active cameras on the station.")
|
||||
return
|
||||
if (href_list["ai_take_control"]) //Mech domination
|
||||
var/obj/mecha/M = locate(href_list["ai_take_control"]) in GLOB.mechas_list
|
||||
var/obj/vehicle/sealed/mecha/M = locate(href_list["ai_take_control"]) in GLOB.mechas_list
|
||||
if (!M)
|
||||
return
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
if(NONE)
|
||||
return FALSE
|
||||
if(POWER_REQ_ALL)
|
||||
return !T || !A || ((!A.power_equip || isspaceturf(T)) && !is_type_in_list(loc, list(/obj/item, /obj/mecha)))
|
||||
return !T || !A || ((!A.power_equip || isspaceturf(T)) && !is_type_in_list(loc, list(/obj/item, /obj/vehicle/sealed/mecha)))
|
||||
|
||||
/mob/living/silicon/ai/updatehealth()
|
||||
if(status_flags & GODMODE)
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
if(!search_objects)
|
||||
. = hearers(vision_range, targets_from) - src //Remove self, so we don't suicide
|
||||
|
||||
var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha))
|
||||
var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/vehicle/sealed/mecha))
|
||||
|
||||
for(var/HM in typecache_filter_list(range(vision_range, targets_from), hostile_machines))
|
||||
if(can_see(targets_from, HM, vision_range))
|
||||
@@ -215,9 +215,9 @@
|
||||
return TRUE
|
||||
|
||||
if(ismecha(the_target))
|
||||
var/obj/mecha/M = the_target
|
||||
if(M.occupant)//Just so we don't attack empty mechs
|
||||
if(CanAttack(M.occupant))
|
||||
var/obj/vehicle/sealed/mecha/M = the_target
|
||||
for(var/occupant in M.occupants)
|
||||
if(CanAttack(occupant))
|
||||
return TRUE
|
||||
|
||||
if(istype(the_target, /obj/machinery/porta_turret))
|
||||
@@ -561,7 +561,7 @@
|
||||
toggle_ai(AI_ON)
|
||||
|
||||
/mob/living/simple_animal/hostile/proc/ListTargetsLazy(_Z)//Step 1, find out what we can see
|
||||
var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha))
|
||||
var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/vehicle/sealed/mecha))
|
||||
. = list()
|
||||
for (var/I in SSmobs.clients_by_zlevel[_Z])
|
||||
var/mob/M = I
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
search_objects = 0
|
||||
mob_biotypes = MOB_ORGANIC|MOB_HUMANOID
|
||||
|
||||
var/spawn_mecha_type = /obj/mecha/combat/marauder/mauler/loaded
|
||||
var/obj/mecha/mecha //Ref to pilot's mecha instance
|
||||
var/spawn_mecha_type = /obj/vehicle/sealed/mecha/combat/marauder/mauler/loaded
|
||||
var/obj/vehicle/sealed/mecha/mecha //Ref to pilot's mecha instance
|
||||
var/required_mecha_charge = 7500 //If the pilot doesn't have a mecha, what charge does a potential Grand Theft Mecha need? (Defaults to half a battery)
|
||||
var/mecha_charge_evacuate = 50 //Amount of charge at which the pilot tries to abandon the mecha
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/no_mech/Initialize()
|
||||
. = ..()
|
||||
wanted_objects = typecacheof(/obj/mecha/combat, TRUE)
|
||||
wanted_objects = typecacheof(/obj/vehicle/sealed/mecha/combat, TRUE)
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/nanotrasen //nanotrasen are syndies! no it's just a weird path.
|
||||
name = "\improper Nanotrasen Mecha Pilot"
|
||||
@@ -50,7 +50,7 @@
|
||||
icon_living = "nanotrasen"
|
||||
icon_state = "nanotrasen"
|
||||
faction = list("nanotrasen")
|
||||
spawn_mecha_type = /obj/mecha/combat/marauder/loaded
|
||||
spawn_mecha_type = /obj/vehicle/sealed/mecha/combat/marauder/loaded
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/no_mech/nanotrasen
|
||||
name = "\improper Nanotrasen Mecha Pilot"
|
||||
@@ -63,12 +63,12 @@
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/Initialize()
|
||||
. = ..()
|
||||
if(spawn_mecha_type)
|
||||
var/obj/mecha/M = new spawn_mecha_type (get_turf(src))
|
||||
var/obj/vehicle/sealed/mecha/M = new spawn_mecha_type (get_turf(src))
|
||||
if(istype(M))
|
||||
enter_mecha(M)
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/proc/enter_mecha(obj/mecha/M)
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/proc/enter_mecha(obj/vehicle/sealed/mecha/M)
|
||||
if(!M)
|
||||
return 0
|
||||
target = null //Target was our mecha, so null it out
|
||||
@@ -89,11 +89,11 @@
|
||||
ranged = 0
|
||||
wanted_objects = list()
|
||||
search_objects = 0
|
||||
if(mecha && mecha.lights_action) //an AI mecha is an EVIL EVIL thing, so let's not hide them in the dark
|
||||
mecha.lights_action.Activate()
|
||||
if(LAZYACCESSASSOC(mecha.occupant_actions, src, /datum/action/vehicle/sealed/mecha/mech_defense_mode) && !mecha.defense_mode)
|
||||
var/datum/action/action = mecha.occupant_actions[src][/datum/action/vehicle/sealed/mecha/mech_defense_mode]
|
||||
action.Trigger(TRUE)
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/proc/exit_mecha(obj/mecha/M)
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/proc/exit_mecha(obj/vehicle/sealed/mecha/M)
|
||||
if(!M)
|
||||
return 0
|
||||
|
||||
@@ -102,9 +102,9 @@
|
||||
targets_from = src
|
||||
|
||||
//Find a new mecha
|
||||
wanted_objects = typecacheof(/obj/mecha/combat, TRUE)
|
||||
wanted_objects = typecacheof(/obj/vehicle/sealed/mecha/combat, TRUE)
|
||||
var/search_aggressiveness = 2
|
||||
for(var/obj/mecha/combat/C in range(vision_range,src))
|
||||
for(var/obj/vehicle/sealed/mecha/combat/C in range(vision_range,src))
|
||||
if(is_valid_mecha(C))
|
||||
target = C
|
||||
search_aggressiveness = 3 //We can see a mech? RUN FOR IT, IGNORE MOBS!
|
||||
@@ -116,23 +116,23 @@
|
||||
walk(M,0)//end any lingering movement loops, to prevent the haunted mecha bug
|
||||
|
||||
//Checks if a mecha is valid for theft
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/proc/is_valid_mecha(obj/mecha/M)
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/proc/is_valid_mecha(obj/vehicle/sealed/mecha/M)
|
||||
if(!M)
|
||||
return 0
|
||||
if(M.occupant)
|
||||
return 0
|
||||
return FALSE
|
||||
if(LAZYLEN(M.occupants))
|
||||
return FALSE
|
||||
if(!M.has_charge(required_mecha_charge))
|
||||
return 0
|
||||
return FALSE
|
||||
if(M.obj_integrity < M.max_integrity*0.5)
|
||||
return 0
|
||||
return 1
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/proc/mecha_face_target(atom/A)
|
||||
if(mecha)
|
||||
var/dirto = get_dir(mecha,A)
|
||||
if(mecha.dir != dirto) //checking, because otherwise the mecha makes too many turn noises
|
||||
mecha.mechturn(dirto)
|
||||
mecha.vehicle_move(dirto, TRUE)
|
||||
|
||||
|
||||
|
||||
@@ -163,8 +163,7 @@
|
||||
var/list/possible_weapons = get_mecha_equip_by_flag(MECHA_RANGED)
|
||||
if(possible_weapons.len)
|
||||
var/obj/item/mecha_parts/mecha_equipment/ME = pick(possible_weapons) //so we don't favor mecha.equipment[1] forever
|
||||
if(ME.action(A))
|
||||
ME.start_cooldown()
|
||||
if(ME.action(src,A))
|
||||
return
|
||||
|
||||
else
|
||||
@@ -177,16 +176,15 @@
|
||||
if(possible_weapons.len)
|
||||
var/obj/item/mecha_parts/mecha_equipment/ME = pick(possible_weapons)
|
||||
mecha_face_target(target)
|
||||
if(ME.action(target))
|
||||
ME.start_cooldown()
|
||||
if(ME.action(src,target))
|
||||
return
|
||||
|
||||
if(mecha.melee_can_hit)
|
||||
if(!TIMER_COOLDOWN_CHECK(mecha, COOLDOWN_MECHA_MELEE_ATTACK))
|
||||
mecha_face_target(target)
|
||||
target.mech_melee_attack(mecha)
|
||||
target.mech_melee_attack(mecha, src)
|
||||
else
|
||||
if(ismecha(target))
|
||||
var/obj/mecha/M = target
|
||||
var/obj/vehicle/sealed/mecha/M = target
|
||||
if(is_valid_mecha(M))
|
||||
enter_mecha(M)
|
||||
return
|
||||
@@ -199,49 +197,54 @@
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/handle_automated_action()
|
||||
if(..())
|
||||
if(!mecha)
|
||||
for(var/obj/mecha/combat/C in range(src,vision_range))
|
||||
if(is_valid_mecha(C))
|
||||
target = C //Let's nab it!
|
||||
minimum_distance = 1
|
||||
ranged = 0
|
||||
break
|
||||
if(mecha)
|
||||
var/list/L = PossibleThreats()
|
||||
var/threat_count = L.len
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
if(!mecha)
|
||||
for(var/obj/vehicle/sealed/mecha/combat/mecha_in_range in range(src,vision_range))
|
||||
if(is_valid_mecha(mecha_in_range))
|
||||
target = mecha_in_range //Let's nab it!
|
||||
minimum_distance = 1
|
||||
ranged = 0
|
||||
break
|
||||
if(mecha)
|
||||
var/list/L = PossibleThreats()
|
||||
var/threat_count = L.len
|
||||
|
||||
//Low Charge - Eject
|
||||
if(!mecha.has_charge(mecha_charge_evacuate))
|
||||
exit_mecha(mecha)
|
||||
return
|
||||
//Low Charge - Eject
|
||||
if(!mecha.has_charge(mecha_charge_evacuate))
|
||||
exit_mecha(mecha)
|
||||
return
|
||||
|
||||
//Too Much Damage - Eject
|
||||
if(mecha.obj_integrity < mecha.max_integrity*0.1)
|
||||
exit_mecha(mecha)
|
||||
return
|
||||
if(mecha.obj_integrity < mecha.max_integrity*0.1)
|
||||
exit_mecha(mecha)
|
||||
return
|
||||
|
||||
//Smoke if there's too many targets - Smoke Power
|
||||
if(threat_count >= threat_use_mecha_smoke && prob(smoke_chance))
|
||||
if(mecha.smoke_action && mecha.smoke_action.owner && mecha.smoke)
|
||||
mecha.smoke_action.Activate()
|
||||
//Smoke if there's too many targets - Smoke Power
|
||||
if(threat_count >= threat_use_mecha_smoke && prob(smoke_chance))
|
||||
if(LAZYACCESSASSOC(mecha.occupant_actions, src, /datum/action/vehicle/sealed/mecha/mech_smoke) && !mecha.smoke_charges)
|
||||
var/datum/action/action = mecha.occupant_actions[src][/datum/action/vehicle/sealed/mecha/mech_smoke]
|
||||
action.Trigger()
|
||||
|
||||
//Heavy damage - Defense Power or Retreat
|
||||
if(mecha.obj_integrity < mecha.max_integrity*0.25)
|
||||
if(prob(defense_mode_chance))
|
||||
if(mecha.defense_action && mecha.defense_action.owner && !mecha.defense_mode)
|
||||
mecha.leg_overload_mode = 0
|
||||
mecha.defense_action.Activate(TRUE)
|
||||
addtimer(CALLBACK(mecha.defense_action, /datum/action/innate/mecha/mech_defense_mode.proc/Activate, FALSE), 100) //10 seconds of defense, then toggle off
|
||||
//Heavy damage - Defense Power or Retreat
|
||||
if(mecha.obj_integrity < mecha.max_integrity*0.25)
|
||||
if(prob(defense_mode_chance))
|
||||
if(LAZYACCESSASSOC(mecha.occupant_actions, src, /datum/action/vehicle/sealed/mecha/mech_defense_mode) && !mecha.defense_mode)
|
||||
var/datum/action/action = mecha.occupant_actions[src][/datum/action/vehicle/sealed/mecha/mech_defense_mode]
|
||||
action.Trigger(TRUE)
|
||||
addtimer(CALLBACK(action, /datum/action/vehicle/sealed/mecha/mech_defense_mode.proc/Trigger, FALSE), 100) //10 seconds of defense, then toggle off
|
||||
|
||||
else if(prob(retreat_chance))
|
||||
//Speed boost if possible
|
||||
if(mecha.overload_action && mecha.overload_action.owner && !mecha.leg_overload_mode)
|
||||
mecha.overload_action.Activate(TRUE)
|
||||
addtimer(CALLBACK(mecha.overload_action, /datum/action/innate/mecha/mech_defense_mode.proc/Activate, FALSE), 100) //10 seconds of speeeeed, then toggle off
|
||||
else if(prob(retreat_chance))
|
||||
//Speed boost if possible
|
||||
if(LAZYACCESSASSOC(mecha.occupant_actions, src, /datum/action/vehicle/sealed/mecha/mech_overload_mode) && !mecha.leg_overload_mode)
|
||||
var/datum/action/action = mecha.occupant_actions[src][/datum/action/vehicle/sealed/mecha/mech_overload_mode]
|
||||
mecha.leg_overload_mode = FALSE
|
||||
action.Trigger(TRUE)
|
||||
addtimer(CALLBACK(action, /datum/action/vehicle/sealed/mecha/mech_overload_mode.proc/Trigger, FALSE), 100) //10 seconds of speeeeed, then toggle off
|
||||
|
||||
retreat_distance = 50
|
||||
addtimer(VARSET_CALLBACK(src, retreat_distance, 0), 10 SECONDS)
|
||||
retreat_distance = 50
|
||||
addtimer(VARSET_CALLBACK(src, retreat_distance, 0), 10 SECONDS)
|
||||
|
||||
|
||||
|
||||
@@ -260,17 +263,17 @@
|
||||
//~simple animals~
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/CanAttack(atom/the_target)
|
||||
if(ismecha(the_target))
|
||||
var/obj/mecha/M = the_target
|
||||
var/obj/vehicle/sealed/mecha/M = the_target
|
||||
if(mecha)
|
||||
if(M == mecha || !CanAttack(M.occupant))
|
||||
return 0
|
||||
if(M == mecha) //Dont kill yourself
|
||||
return FALSE
|
||||
else //we're not in a mecha, so we check if we can steal it instead.
|
||||
if(is_valid_mecha(M))
|
||||
return 1
|
||||
else if (M.occupant && CanAttack(M.occupant))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
return TRUE
|
||||
for(var/occupant in M.occupants)
|
||||
if(CanAttack(occupant))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
. = ..()
|
||||
|
||||
@@ -289,6 +292,6 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/mecha_pilot/Goto(target, delay, minimum_distance)
|
||||
if(mecha)
|
||||
walk_to(mecha, target, minimum_distance, mecha.step_in)
|
||||
walk_to(mecha, target, minimum_distance, mecha.movedelay)
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -215,7 +215,7 @@ Difficulty: Medium
|
||||
if(L.client)
|
||||
empty += pick(((RANGE_TURFS(2, L) - RANGE_TURFS(1, L)) & turfs) - empty) // picks a turf within 2 of the creature not outside or in the shield
|
||||
any_attack = 1
|
||||
for(var/obj/mecha/M in T.contents)
|
||||
for(var/obj/vehicle/sealed/mecha/M in T.contents)
|
||||
empty += pick(((RANGE_TURFS(2, M) - RANGE_TURFS(1, M)) & turfs) - empty)
|
||||
any_attack = 1
|
||||
if(!any_attack)
|
||||
@@ -285,7 +285,7 @@ Difficulty: Medium
|
||||
to_chat(L, "<span class='userdanger'>You're hit by [source]'s fire breath!</span>")
|
||||
|
||||
// deals damage to mechs
|
||||
for(var/obj/mecha/M in T.contents)
|
||||
for(var/obj/vehicle/sealed/mecha/M in T.contents)
|
||||
if(M in hit_list)
|
||||
continue
|
||||
hit_list += M
|
||||
@@ -372,7 +372,7 @@ Difficulty: Medium
|
||||
var/throwtarget = get_edge_target_turf(src, throw_dir)
|
||||
L.throw_at(throwtarget, 3)
|
||||
visible_message("<span class='warning'>[L] is thrown clear of [src]!</span>")
|
||||
for(var/obj/mecha/M in orange(1, src))
|
||||
for(var/obj/vehicle/sealed/mecha/M in orange(1, src))
|
||||
M.take_damage(75, BRUTE, MELEE, 1)
|
||||
|
||||
for(var/mob/M in range(7, src))
|
||||
@@ -444,7 +444,7 @@ Difficulty: Medium
|
||||
to_chat(L, "<span class='userdanger'>You fall directly into the pool of lava!</span>")
|
||||
|
||||
// deals damage to mechs
|
||||
for(var/obj/mecha/M in T.contents)
|
||||
for(var/obj/vehicle/sealed/mecha/M in T.contents)
|
||||
M.take_damage(45, BRUTE, MELEE, 1)
|
||||
|
||||
// changes turf to lava temporarily
|
||||
|
||||
@@ -694,14 +694,15 @@ Difficulty: Hard
|
||||
L.adjustBruteLoss(damage)
|
||||
if(caster)
|
||||
log_combat(caster, L, "struck with a [name]")
|
||||
for(var/obj/mecha/M in T.contents - hit_things) //also damage mechs.
|
||||
for(var/obj/vehicle/sealed/mecha/M in T.contents - hit_things) //also damage mechs.
|
||||
hit_things += M
|
||||
if(M.occupant)
|
||||
if(friendly_fire_check && caster && caster.faction_check_mob(M.occupant))
|
||||
for(var/O in M.occupants)
|
||||
var/mob/living/occupant = O
|
||||
if(friendly_fire_check && caster && caster.faction_check_mob(occupant))
|
||||
continue
|
||||
to_chat(M.occupant, "<span class='userdanger'>Your [M.name] is struck by a [name]!</span>")
|
||||
playsound(M,'sound/weapons/sear.ogg', 50, TRUE, -4)
|
||||
M.take_damage(damage, BURN, 0, 0)
|
||||
to_chat(occupant, "<span class='userdanger'>Your [M.name] is struck by a [name]!</span>")
|
||||
playsound(M,'sound/weapons/sear.ogg', 50, TRUE, -4)
|
||||
M.take_damage(damage, BURN, 0, 0)
|
||||
|
||||
/obj/effect/temp_visual/hierophant/blast/visual
|
||||
icon_state = "hierophant_blast"
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
if(ismineralturf(target))
|
||||
var/turf/closed/mineral/M = target
|
||||
M.gets_drilled()
|
||||
if(istype(target, /obj/mecha))
|
||||
var/obj/mecha/M = target
|
||||
if(istype(target, /obj/vehicle/sealed/mecha))
|
||||
var/obj/vehicle/sealed/mecha/M = target
|
||||
M.take_damage(50, BRUTE, MELEE, 1)
|
||||
|
||||
//Elites can't talk (normally)!
|
||||
|
||||
@@ -98,10 +98,11 @@
|
||||
if(M.client && CanAttack(M) && !M.has_unlimited_silicon_privilege)
|
||||
if(!M.is_blind())
|
||||
return M
|
||||
for(var/obj/mecha/M in view(world.view + 1, check)) //assuming if you can see them they can see you
|
||||
if(M.occupant && M.occupant.client)
|
||||
if(!M.occupant.is_blind())
|
||||
return M.occupant
|
||||
for(var/obj/vehicle/sealed/mecha/M in view(world.view + 1, check)) //assuming if you can see them they can see you
|
||||
for(var/O in M.occupants)
|
||||
var/mob/mechamob = O
|
||||
if(mechamob.client && !mechamob.is_blind())
|
||||
return mechamob
|
||||
return null
|
||||
|
||||
/mob/living/simple_animal/hostile/netherworld/migo
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
else
|
||||
enemies -= L
|
||||
else if(ismecha(A))
|
||||
var/obj/mecha/M = A
|
||||
if(M.occupant)
|
||||
var/obj/vehicle/sealed/mecha/M = A
|
||||
if(LAZYLEN(M.occupants))
|
||||
return A
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/ListTargets()
|
||||
@@ -31,10 +31,10 @@
|
||||
if(faction_check_mob(M) && attack_same || !faction_check_mob(M))
|
||||
enemies |= M
|
||||
else if(ismecha(A))
|
||||
var/obj/mecha/M = A
|
||||
if(M.occupant)
|
||||
var/obj/vehicle/sealed/mecha/M = A
|
||||
if(LAZYLEN(M.occupants))
|
||||
enemies |= M
|
||||
enemies |= M.occupant
|
||||
enemies |= M.occupants
|
||||
|
||||
for(var/mob/living/simple_animal/hostile/retaliate/H in around)
|
||||
if(faction_check_mob(H) && !attack_same && !H.attack_same)
|
||||
|
||||
@@ -128,8 +128,8 @@
|
||||
adjustHealth(-L.maxHealth * 0.5)
|
||||
return
|
||||
. = ..()
|
||||
if(istype(target, /obj/mecha))
|
||||
var/obj/mecha/M = target
|
||||
if(istype(target, /obj/vehicle/sealed/mecha))
|
||||
var/obj/vehicle/sealed/mecha/M = target
|
||||
M.take_damage(50, BRUTE, MELEE, 1)
|
||||
|
||||
/mob/living/simple_animal/hostile/space_dragon/Move()
|
||||
@@ -221,7 +221,7 @@
|
||||
L.adjustFireLoss(30)
|
||||
to_chat(L, "<span class='userdanger'>You're hit by [src]'s fire breath!</span>")
|
||||
// deals damage to mechs
|
||||
for(var/obj/mecha/M in T.contents)
|
||||
for(var/obj/vehicle/sealed/mecha/M in T.contents)
|
||||
if(M in hit_list)
|
||||
continue
|
||||
hit_list += M
|
||||
|
||||
@@ -134,10 +134,11 @@
|
||||
if(M.client && CanAttack(M) && !M.has_unlimited_silicon_privilege)
|
||||
if(!M.is_blind())
|
||||
return M
|
||||
for(var/obj/mecha/M in view(world.view + 1, check)) //assuming if you can see them they can see you
|
||||
if(M.occupant && M.occupant.client)
|
||||
if(!M.occupant.is_blind())
|
||||
return M.occupant
|
||||
for(var/obj/vehicle/sealed/mecha/M in view(world.view + 1, check)) //assuming if you can see them they can see you
|
||||
for(var/O in M.occupants)
|
||||
var/mob/mechamob = O
|
||||
if(mechamob.client && !mechamob.is_blind())
|
||||
return mechamob
|
||||
return null
|
||||
|
||||
// Cannot talk
|
||||
|
||||
@@ -450,8 +450,8 @@
|
||||
if(L.stat != CONSCIOUS)
|
||||
return FALSE
|
||||
if (ismecha(the_target))
|
||||
var/obj/mecha/M = the_target
|
||||
if (M.occupant)
|
||||
var/obj/vehicle/sealed/mecha/M = the_target
|
||||
if(LAZYLEN(M.occupants))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -1157,7 +1157,7 @@
|
||||
return
|
||||
client.mouse_pointer_icon = initial(client.mouse_pointer_icon)
|
||||
if (ismecha(loc))
|
||||
var/obj/mecha/M = loc
|
||||
var/obj/vehicle/sealed/mecha/M = loc
|
||||
if(M.mouse_pointer)
|
||||
client.mouse_pointer_icon = M.mouse_pointer
|
||||
else if (istype(loc, /obj/vehicle/sealed))
|
||||
|
||||
Reference in New Issue
Block a user