Merge pull request #10451 from kevinz000/mobility_flags

Mobility flags + combat rework stuff refactoring, fixes a few edge cases including the Oh Dreaded Xenomorph Hardstuns, etc etc time to break the game
This commit is contained in:
deathride58
2020-03-05 20:03:56 -05:00
committed by GitHub
290 changed files with 2244 additions and 1819 deletions
+6 -4
View File
@@ -18,7 +18,7 @@
icon_state = "ai"
move_resist = MOVE_FORCE_OVERPOWERING
density = TRUE
canmove = FALSE
mobility_flags = ALL
status_flags = CANSTUN|CANPUSH
a_intent = INTENT_HARM //so we always get pushed instead of trying to swap
sight = SEE_TURFS | SEE_MOBS | SEE_OBJS
@@ -324,8 +324,10 @@
to_chat(src, "<b>You are now [is_anchored ? "" : "un"]anchored.</b>")
// the message in the [] will change depending whether or not the AI is anchored
/mob/living/silicon/ai/update_canmove() //If the AI dies, mobs won't go through it anymore
return 0
// AIs are immobile
/mob/living/silicon/ai/update_mobility()
mobility_flags = ALL
return ALL
/mob/living/silicon/ai/proc/ai_cancel_call()
set category = "Malfunction"
@@ -987,7 +989,7 @@
deployed_shell.undeploy()
diag_hud_set_deployed()
/mob/living/silicon/ai/resist()
/mob/living/silicon/ai/do_resist()
return
/mob/living/silicon/ai/spawned/Initialize(mapload, datum/ai_laws/L, mob/target_ai)
+1 -1
View File
@@ -15,7 +15,7 @@
cameraFollow = null
move_resist = MOVE_FORCE_NORMAL
update_canmove()
update_mobility()
if(eyeobj)
eyeobj.setLoc(get_turf(src))
set_eyeobj_visible(FALSE)
+1 -1
View File
@@ -2,7 +2,7 @@
if(stat == DEAD)
return
stat = DEAD
canmove = 0
update_mobility()
update_sight()
clear_fullscreens()
+1 -2
View File
@@ -80,7 +80,7 @@
var/radio_short_cooldown = 3 MINUTES
var/radio_short_timerid
canmove = FALSE
mobility_flags = NONE
var/silent = FALSE
var/brightness_power = 5
@@ -101,7 +101,6 @@
START_PROCESSING(SSfastprocess, src)
GLOB.pai_list += src
make_laws()
canmove = 0
if(!istype(P)) //when manually spawning a pai, we create a card to put it into.
var/newcardloc = P
P = new /obj/item/paicard(newcardloc)
@@ -8,7 +8,7 @@
if(. & EMP_PROTECT_SELF)
return
take_holo_damage(50/severity)
Knockdown(400/severity)
DefaultCombatKnockdown(400/severity)
silent = max(silent, (PAI_EMP_SILENCE_DURATION) / SSmobs.wait / severity)
if(holoform)
fold_in(force = TRUE)
@@ -23,10 +23,10 @@
qdel(src)
if(2)
fold_in(force = 1)
Knockdown(400)
DefaultCombatKnockdown(400)
if(3)
fold_in(force = 1)
Knockdown(200)
DefaultCombatKnockdown(200)
//ATTACK HAND IGNORING PARENT RETURN VALUE
/mob/living/silicon/pai/attack_hand(mob/living/carbon/human/user)
@@ -98,7 +98,7 @@
take_holo_damage(amount * 0.25)
/mob/living/silicon/pai/adjustOrganLoss(slot, amount, maximum = 500) //I kept this in, unlike tg
Knockdown(amount * 0.2)
DefaultCombatKnockdown(amount * 0.2)
/mob/living/silicon/pai/getBruteLoss()
return emittermaxhealth - emitterhealth
@@ -17,7 +17,6 @@
return FALSE
emitter_next_use = world.time + emittercd
canmove = TRUE
density = TRUE
if(istype(card.loc, /obj/item/pda))
var/obj/item/pda/P = card.loc
@@ -37,6 +36,7 @@
C.push_data()
forceMove(get_turf(card))
card.forceMove(src)
update_mobility()
if(client)
client.perspective = EYE_PERSPECTIVE
client.eye = src
@@ -63,12 +63,11 @@
var/turf/T = drop_location()
card.forceMove(T)
forceMove(card)
canmove = FALSE
density = FALSE
set_light(0)
holoform = FALSE
if(resting)
lay_down()
set_resting(FALSE, TRUE, FALSE)
update_mobility()
/mob/living/silicon/pai/proc/choose_chassis()
if(!isturf(loc) && loc != card)
@@ -21,7 +21,7 @@
locked = FALSE //unlock cover
update_canmove()
update_mobility()
if(!QDELETED(builtInCamera) && builtInCamera.status)
builtInCamera.toggle_cam(src,0)
update_headlamp(1) //So borg lights are disabled when killed.
@@ -91,12 +91,3 @@
add_overlay(fire_overlay)
else
cut_overlay(fire_overlay)
/mob/living/silicon/robot/update_canmove()
if(stat || buckled || lockcharge || resting) //CITADEL EDIT resting dogborg-os
canmove = 0
else
canmove = 1
update_transform()
update_action_buttons_icon()
return canmove
+9 -83
View File
@@ -64,7 +64,7 @@
var/lawupdate = 1 //Cyborgs will sync their laws with their AI by default
var/scrambledcodes = 0 // Used to determine if a borg shows up on the robotics console. Setting to one hides them.
var/lockcharge //Boolean of whether the borg is locked down or not
var/locked_down //Boolean of whether the borg is locked down or not
var/toner = 0
var/tonermax = 40
@@ -493,7 +493,7 @@
update_icons()
else if(istype(W, /obj/item/wrench) && opened && !cell) //Deconstruction. The flashes break from the fall, to prevent this from being a ghetto reset module.
if(!lockcharge)
if(!locked_down)
to_chat(user, "<span class='boldannounce'>[src]'s bolts spark! Maybe you should lock them down first!</span>")
spark_system.start()
return
@@ -655,65 +655,6 @@
/mob/living/silicon/robot/regenerate_icons()
return update_icons()
/mob/living/silicon/robot/update_icons()
cut_overlays()
icon_state = module.cyborg_base_icon
//Citadel changes start here - Allows modules to use different icon files, and allows modules to specify a pixel offset
icon = (module.cyborg_icon_override ? module.cyborg_icon_override : initial(icon))
if(laser)
add_overlay("laser")//Is this even used??? - Yes borg/inventory.dm
if(disabler)
add_overlay("disabler")//ditto
if(sleeper_g && module.sleeper_overlay)
add_overlay("[module.sleeper_overlay]_g[sleeper_nv ? "_nv" : ""]")
if(sleeper_r && module.sleeper_overlay)
add_overlay("[module.sleeper_overlay]_r[sleeper_nv ? "_nv" : ""]")
if(stat == DEAD && module.has_snowflake_deadsprite)
icon_state = "[module.cyborg_base_icon]-wreck"
if(module.cyborg_pixel_offset)
pixel_x = module.cyborg_pixel_offset
//End of citadel changes
if(module.cyborg_base_icon == "robot")
icon = 'icons/mob/robots.dmi'
pixel_x = initial(pixel_x)
if(stat != DEAD && !(IsUnconscious() || IsStun() || IsKnockdown() || low_power_mode)) //Not dead, not stunned.
if(!eye_lights)
eye_lights = new()
if(lamp_intensity > 2)
eye_lights.icon_state = "[module.special_light_key ? "[module.special_light_key]":"[module.cyborg_base_icon]"]_l"
else
eye_lights.icon_state = "[module.special_light_key ? "[module.special_light_key]":"[module.cyborg_base_icon]"]_e[is_servant_of_ratvar(src) ? "_r" : ""]"
eye_lights.icon = icon
add_overlay(eye_lights)
if(opened)
if(wiresexposed)
add_overlay("ov-opencover +w")
else if(cell)
add_overlay("ov-opencover +c")
else
add_overlay("ov-opencover -c")
if(hat)
var/mutable_appearance/head_overlay = hat.build_worn_icon(state = hat.icon_state, default_layer = 20, default_icon_file = 'icons/mob/head.dmi')
head_overlay.pixel_y += hat_offset
add_overlay(head_overlay)
update_fire()
if(client && stat != DEAD && module.dogborg == TRUE)
if(resting)
if(sitting)
icon_state = "[module.cyborg_base_icon]-sit"
if(bellyup)
icon_state = "[module.cyborg_base_icon]-bellyup"
else if(!sitting && !bellyup)
icon_state = "[module.cyborg_base_icon]-rest"
cut_overlays()
else
icon_state = "[module.cyborg_base_icon]"
/mob/living/silicon/robot/proc/self_destruct()
if(emagged)
if(mmi)
@@ -728,8 +669,6 @@
connected_ai.connected_robots -= src
src.connected_ai = null
lawupdate = 0
lockcharge = 0
canmove = 1
scrambledcodes = 1
//Disconnect it's camera so it's not so easily tracked.
if(!QDELETED(builtInCamera))
@@ -738,6 +677,7 @@
// Instead of being listed as "deactivated". The downside is that I'm going
// to have to check if every camera is null or not before doing anything, to prevent runtime errors.
// I could change the network to null but I don't know what would happen, and it seems too hacky for me.
update_mobility()
/mob/living/silicon/robot/mode()
set name = "Activate Held Object"
@@ -759,8 +699,8 @@
throw_alert("locked", /obj/screen/alert/locked)
else
clear_alert("locked")
lockcharge = state
update_canmove()
locked_down = state
update_mobility()
/mob/living/silicon/robot/proc/SetEmagged(new_state)
emagged = new_state
@@ -949,7 +889,7 @@
to_chat(connected_ai, "<br><br><span class='notice'>NOTICE - Remote telemetry lost with [name].</span><br>")
/mob/living/silicon/robot/canUseTopic(atom/movable/M, be_close=FALSE, no_dextery=FALSE, no_tk=FALSE)
if(stat || lockcharge || low_power_mode)
if(stat || locked_down || low_power_mode)
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
return FALSE
if(be_close && !in_range(M, src))
@@ -1025,17 +965,17 @@
if(health <= -maxHealth) //die only once
death()
return
if(IsUnconscious() || IsStun() || IsKnockdown() || getOxyLoss() > maxHealth*0.5)
if(IsUnconscious() || IsStun() || IsParalyzed() || getOxyLoss() > maxHealth*0.5)
if(stat == CONSCIOUS)
stat = UNCONSCIOUS
blind_eyes(1)
update_canmove()
update_mobility()
update_headlamp()
else
if(stat == UNCONSCIOUS)
stat = CONSCIOUS
adjust_blindness(-1)
update_canmove()
update_mobility()
update_headlamp()
diag_hud_set_status()
diag_hud_set_health()
@@ -1269,20 +1209,6 @@
for(var/i in connected_ai.aicamera.stored)
aicamera.stored[i] = TRUE
/mob/living/silicon/robot/lay_down()
..()
update_canmove()
/mob/living/silicon/robot/update_canmove()
..()
if(client && stat != DEAD && dogborg == FALSE)
if(resting)
cut_overlays()
icon_state = "[module.cyborg_base_icon]-rest"
else
icon_state = "[module.cyborg_base_icon]"
update_icons()
/mob/living/silicon/robot/proc/rest_style()
set name = "Switch Rest Style"
set category = "Robot Commands"
@@ -36,7 +36,7 @@
"<span class='userdanger'>[M] has disabled [src]'s active module!</span>", null, COMBAT_MESSAGE_RANGE)
log_combat(M, src, "disarmed", "[I ? " removing \the [I]" : ""]")
else
Stun(40)
Paralyze(40)
step(src,get_dir(M,src))
log_combat(M, src, "pushed")
visible_message("<span class='danger'>[M] has forced back [src]!</span>", \
@@ -86,9 +86,9 @@
return
switch(severity)
if(1)
Stun(160)
Paralyze(160)
if(2)
Stun(60)
Paralyze(60)
/mob/living/silicon/robot/emag_act(mob/user)
@@ -0,0 +1,15 @@
/mob/living/silicon/robot/update_mobility()
var/newflags = NONE
if(!stat)
if(!resting)
newflags |= (MOBILITY_STAND | MOBILITY_RESIST)
if(!locked_down)
newflags |= MOBILITY_MOVE
newflags |= MOBILITY_PULL
if(!locked_down)
newflags |= MOBILITY_FLAGS_ANY_INTERACTION
mobility_flags = newflags
update_transform()
update_action_buttons_icon()
update_icons()
return mobility_flags
@@ -257,7 +257,7 @@
/obj/item/robot_module/proc/do_transform_delay()
var/mob/living/silicon/robot/R = loc
var/prev_lockcharge = R.lockcharge
var/prev_locked_down = R.locked_down
sleep(1)
flick("[cyborg_base_icon]_transform", R)
R.notransform = TRUE
@@ -267,7 +267,7 @@
for(var/i in 1 to 4)
playsound(R, pick('sound/items/drill_use.ogg', 'sound/items/jaws_cut.ogg', 'sound/items/jaws_pry.ogg', 'sound/items/welder.ogg', 'sound/items/ratchet.ogg'), 80, 1, -1)
sleep(7)
if(!prev_lockcharge)
if(!prev_locked_down)
R.SetLockdown(0)
R.setDir(SOUTH)
R.anchored = FALSE
@@ -0,0 +1,59 @@
/// this is bad code
/mob/living/silicon/robot/update_icons()
cut_overlays()
icon_state = module.cyborg_base_icon
//Citadel changes start here - Allows modules to use different icon files, and allows modules to specify a pixel offset
icon = (module.cyborg_icon_override ? module.cyborg_icon_override : initial(icon))
if(laser)
add_overlay("laser")//Is this even used??? - Yes borg/inventory.dm
if(disabler)
add_overlay("disabler")//ditto
if(sleeper_g && module.sleeper_overlay)
add_overlay("[module.sleeper_overlay]_g[sleeper_nv ? "_nv" : ""]")
if(sleeper_r && module.sleeper_overlay)
add_overlay("[module.sleeper_overlay]_r[sleeper_nv ? "_nv" : ""]")
if(stat == DEAD && module.has_snowflake_deadsprite)
icon_state = "[module.cyborg_base_icon]-wreck"
if(module.cyborg_pixel_offset)
pixel_x = module.cyborg_pixel_offset
//End of citadel changes
if(module.cyborg_base_icon == "robot")
icon = 'icons/mob/robots.dmi'
pixel_x = initial(pixel_x)
if(stat != DEAD && !(IsUnconscious() ||IsStun() || IsKnockdown() || IsParalyzed() || low_power_mode)) //Not dead, not stunned.
if(!eye_lights)
eye_lights = new()
if(lamp_intensity > 2)
eye_lights.icon_state = "[module.special_light_key ? "[module.special_light_key]":"[module.cyborg_base_icon]"]_l"
else
eye_lights.icon_state = "[module.special_light_key ? "[module.special_light_key]":"[module.cyborg_base_icon]"]_e[is_servant_of_ratvar(src) ? "_r" : ""]"
eye_lights.icon = icon
add_overlay(eye_lights)
if(opened)
if(wiresexposed)
add_overlay("ov-opencover +w")
else if(cell)
add_overlay("ov-opencover +c")
else
add_overlay("ov-opencover -c")
if(hat)
var/mutable_appearance/head_overlay = hat.build_worn_icon(state = hat.icon_state, default_layer = 20, default_icon_file = 'icons/mob/head.dmi')
head_overlay.pixel_y += hat_offset
add_overlay(head_overlay)
update_fire()
if(client && stat != DEAD && module.dogborg == TRUE)
if(resting)
if(sitting)
icon_state = "[module.cyborg_base_icon]-sit"
if(bellyup)
icon_state = "[module.cyborg_base_icon]-bellyup"
else if(!sitting && !bellyup)
icon_state = "[module.cyborg_base_icon]-rest"
cut_overlays()
else
icon_state = "[module.cyborg_base_icon]"
@@ -32,7 +32,7 @@
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
if(prob(damage))
for(var/mob/living/N in buckled_mobs)
N.Knockdown(20)
N.DefaultCombatKnockdown(20)
unbuckle_mob(N)
N.visible_message("<span class='boldwarning'>[N] is knocked off of [src] by [M]!</span>")
switch(M.melee_damage_type)
@@ -106,7 +106,7 @@
for(var/mob/living/M in buckled_mobs)
if(prob(severity*50))
unbuckle_mob(M)
M.Knockdown(40)
M.DefaultCombatKnockdown(40)
M.visible_message("<span class='boldwarning'>[M] is thrown off of [src]!</span>")
flash_act(affect_silicon = 1)
@@ -123,7 +123,7 @@
for(var/mob/living/M in buckled_mobs)
M.visible_message("<span class='boldwarning'>[M] is knocked off of [src]!</span>")
unbuckle_mob(M)
M.Knockdown(40)
M.DefaultCombatKnockdown(40)
if(P.stun || P.knockdown)
for(var/mob/living/M in buckled_mobs)
unbuckle_mob(M)