Merge pull request #10185 from Mitchs98/moveresist

Ports Move Force from TG
This commit is contained in:
variableundefined
2018-12-28 20:53:07 +08:00
committed by GitHub
33 changed files with 256 additions and 119 deletions
+2 -1
View File
@@ -3,7 +3,8 @@
/mob/camera
name = "camera mob"
density = 0
anchored = 1
move_force = INFINITY
move_resist = INFINITY
status_flags = GODMODE // You can't damage it.
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
see_in_dark = 7
+3
View File
@@ -3,3 +3,6 @@
/mob/dead/gib() //ghosts can't be gibbed.
return
/mob/dead
move_resist = INFINITY
+2 -2
View File
@@ -13,7 +13,7 @@ var/list/image/ghost_darkness_images = list() //this is a list of images for thi
density = 0
canmove = 0
alpha = 127
anchored = 1 // don't get pushed around
move_resist = INFINITY // don't get pushed around
invisibility = INVISIBILITY_OBSERVER
var/can_reenter_corpse
var/bootime = 0
@@ -706,6 +706,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
set name = "Mob spawners menu"
set desc = "See all currently available ghost spawners"
set category = "Ghost"
var/datum/spawners_menu/menu = new /datum/spawners_menu(src)
menu.ui_interact(src)
+1 -1
View File
@@ -574,7 +574,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
if(thrown_thing)
visible_message("<span class='danger'>[src] has thrown [thrown_thing].</span>")
newtonian_move(get_dir(target, src))
thrown_thing.throw_at(target, thrown_thing.throw_range, thrown_thing.throw_speed, src)
thrown_thing.throw_at(target, thrown_thing.throw_range, thrown_thing.throw_speed, src, null, null, null, move_force)
/mob/living/carbon/can_use_hands()
if(handcuffed)
+76 -25
View File
@@ -50,7 +50,7 @@
if(ObjBump(A))
return
if(istype(A, /atom/movable))
if(PushAM(A))
if(PushAM(A, move_force))
return
//Called when we bump into a mob
@@ -127,32 +127,41 @@
return
//Called when we want to push an atom/movable
/mob/living/proc/PushAM(atom/movable/AM)
/mob/living/proc/PushAM(atom/movable/AM, force = move_force)
if(now_pushing)
return 1
return TRUE
if(moving_diagonally) // no pushing during diagonal moves
return 1
return TRUE
if(!client && (mob_size < MOB_SIZE_SMALL))
return
if(!AM.anchored)
now_pushing = 1
var/t = get_dir(src, AM)
if(istype(AM, /obj/structure/window))
var/obj/structure/window/W = AM
if(W.fulltile)
for(var/obj/structure/window/win in get_step(W, t))
now_pushing = 0
return
if(pulling == AM)
stop_pulling()
var/current_dir
if(isliving(AM))
current_dir = AM.dir
step(AM, t)
if(current_dir)
AM.setDir(current_dir)
now_pushing = 0
now_pushing = TRUE
var/t = get_dir(src, AM)
var/push_anchored = FALSE
if((AM.move_resist * MOVE_FORCE_CRUSH_RATIO) <= force)
if(move_crush(AM, move_force, t))
push_anchored = TRUE
if((AM.move_resist * MOVE_FORCE_FORCEPUSH_RATIO) <= force) //trigger move_crush and/or force_push regardless of if we can push it normally
if(force_push(AM, move_force, t, push_anchored))
push_anchored = TRUE
if((AM.anchored && !push_anchored) || (force < (AM.move_resist * MOVE_FORCE_PUSH_RATIO)))
now_pushing = FALSE
return
if(istype(AM, /obj/structure/window))
var/obj/structure/window/W = AM
if(W.fulltile)
for(var/obj/structure/window/win in get_step(W,t))
now_pushing = FALSE
return
if(pulling == AM)
stop_pulling()
var/current_dir
if(isliving(AM))
current_dir = AM.dir
if(step(AM, t))
step(src, t)
if(current_dir)
AM.setDir(current_dir)
now_pushing = FALSE
/mob/living/Stat()
. = ..()
@@ -187,9 +196,20 @@
set name = "Pull"
set category = "Object"
if(AM.Adjacent(src))
if(istype(AM) && Adjacent(AM))
start_pulling(AM)
return
else
stop_pulling()
/mob/living/stop_pulling()
..()
if(pullin)
pullin.update_icon(src)
/mob/living/verb/stop_pulling1()
set name = "Stop Pulling"
set category = "IC"
stop_pulling()
//same as above
/mob/living/pointed(atom/A as mob|obj|turf in view())
@@ -852,6 +872,37 @@
return 0
return 1
/mob/living/start_pulling(atom/movable/AM, state, force = pull_force, supress_message = FALSE)
if(!AM || !src)
return FALSE
if(!(AM.can_be_pulled(src, state, force)))
return FALSE
if(incapacitated())
return
// If we're pulling something then drop what we're currently pulling and pull this instead.
AM.add_fingerprint(src)
if(pulling)
if(AM == pulling)// Are we trying to pull something we are already pulling? Then just stop here, no need to continue.
return
stop_pulling()
if(AM.pulledby)
visible_message("<span class='danger'>[src] has pulled [AM] from [AM.pulledby]'s grip.</span>")
AM.pulledby.stop_pulling() //an object can't be pulled by two mobs at once.
pulling = AM
AM.pulledby = src
if(pullin)
pullin.update_icon(src)
if(ismob(AM))
var/mob/M = AM
if(!iscarbon(src))
M.LAssailant = null
else
M.LAssailant = usr
/mob/living/proc/check_pull()
if(pulling && !(pulling in orange(1)))
stop_pulling()
/mob/living/proc/get_taste_sensitivity()
return 1
+2 -2
View File
@@ -73,7 +73,7 @@
return 0
//this proc handles being hit by a thrown atom
/mob/living/hitby(atom/movable/AM, skipcatch, hitpush = 1, blocked = 0)//Standardization and logging -Sieve
/mob/living/hitby(atom/movable/AM, skipcatch, hitpush = 1, blocked = 0, datum/thrownthing/throwingdatum)//Standardization and logging -Sieve
if(istype(AM, /obj/item))
var/obj/item/I = AM
var/zone = ran_zone("chest", 65)//Hits a random part of the body, geared towards the chest
@@ -229,7 +229,7 @@
// End BS12 momentum-transfer code.
/mob/living/proc/grabbedby(mob/living/carbon/user, supress_message = 0)
/mob/living/proc/grabbedby(mob/living/carbon/user, supress_message = FALSE)
if(user == src || anchored)
return 0
if(!(status_flags & CANPUSH))
+8 -3
View File
@@ -38,7 +38,7 @@ var/list/ai_verbs_default = list(
name = "AI"
icon = 'icons/mob/AI.dmi'//
icon_state = "ai"
anchored = 1 // -- TLE
move_resist = MOVE_FORCE_VERY_STRONG
density = 1
status_flags = CANSTUN|CANPARALYSE|CANPUSH
mob_size = MOB_SIZE_LARGE
@@ -533,9 +533,14 @@ var/list/ai_verbs_default = list(
if(!isturf(loc)) // if their location isn't a turf
return // stop
anchored = !anchored // Toggles the anchor
var/is_anchored = FALSE
if(move_resist == MOVE_FORCE_VERY_STRONG)
move_resist = MOVE_FORCE_VERY_STRONG
else
is_anchored = TRUE
move_resist = MOVE_FORCE_NORMAL
to_chat(src, "[anchored ? "<b>You are now anchored.</b>" : "<b>You are now unanchored.</b>"]")
to_chat(src, "[is_anchored ? "<b>You are now anchored.</b>" : "<b>You are now unanchored.</b>"]")
/mob/living/silicon/ai/update_canmove()
return FALSE
+2 -6
View File
@@ -517,12 +517,8 @@
/mob/living/silicon/pai/Bumped()
return
/mob/living/silicon/pai/start_pulling(var/atom/movable/AM)
if(stat || sleeping || paralysis || weakened)
return
if(istype(AM,/obj/item))
to_chat(src, "<span class='warning'>You are far too small to pull anything!</span>")
return
/mob/living/silicon/pai/start_pulling(atom/movable/AM, state, force = move_force, supress_message = FALSE)
return FALSE
/mob/living/silicon/pai/update_canmove(delay_action_updates = 0)
. = ..()
@@ -11,8 +11,8 @@
desc = "A Multiple Utility Load Effector bot."
icon_state = "mulebot0"
density = 1
anchored = 1
animate_movement=1
move_resist = MOVE_FORCE_STRONG
animate_movement = 1
health = 50
maxHealth = 50
damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0)
@@ -38,7 +38,9 @@
var/elimination = 0
var/anger_modifier = 0
var/obj/item/gps/internal_gps
anchored = TRUE
move_force = MOVE_FORCE_OVERPOWERING
move_resist = MOVE_FORCE_OVERPOWERING
pull_force = MOVE_FORCE_OVERPOWERING
mob_size = MOB_SIZE_LARGE
layer = MOB_LAYER + 0.5 //Looks weird with them slipping under mineral walls and cameras and shit otherwise
mouse_opacity = MOUSE_OPACITY_OPAQUE // Easier to click on in melee, they're giant targets anyway
@@ -136,7 +136,9 @@
throw_message = "does nothing to the rocky hide of the"
aggro_vision_range = 9
idle_vision_range = 5
anchored = 1 //Stays anchored until death as to be unpullable
move_force = MOVE_FORCE_VERY_STRONG
move_resist = MOVE_FORCE_VERY_STRONG
pull_force = MOVE_FORCE_VERY_STRONG
var/pre_attack = 0
loot = list(/obj/item/asteroid/goliath_hide{layer = 4.1})
@@ -152,7 +154,9 @@
icon_state = "Goliath_preattack"
/mob/living/simple_animal/hostile/asteroid/goliath/revive()
anchored = 1
move_force = MOVE_FORCE_VERY_STRONG
move_resist = MOVE_FORCE_VERY_STRONG
pull_force = MOVE_FORCE_VERY_STRONG
..()
/mob/living/simple_animal/hostile/asteroid/goliath/OpenFire()
@@ -42,7 +42,9 @@
see_invisible = SEE_INVISIBLE_OBSERVER_NOLIGHTING
sight = SEE_SELF|SEE_MOBS|SEE_OBJS|SEE_TURFS
anchored = 1
move_force = MOVE_FORCE_EXTREMELY_STRONG
move_resist = MOVE_FORCE_EXTREMELY_STRONG
pull_force = MOVE_FORCE_EXTREMELY_STRONG
status_flags = GODMODE // Cannot push also
var/cannot_be_seen = 1
@@ -10,7 +10,7 @@
var/mob_type = /mob/living/simple_animal/hostile/carp
var/spawn_text = "emerges from"
status_flags = 0
anchored = 1
move_resist = MOVE_FORCE_VERY_STRONG
AIStatus = AI_OFF
a_intent = INTENT_HARM
stop_automated_movement = 1
-2
View File
@@ -35,7 +35,6 @@
var/obj/machinery/machine = null
var/other_mobs = null
var/memory = ""
var/atom/movable/pulling = null
var/next_move = null
var/notransform = null //Carbon
var/other = 0.0
@@ -48,7 +47,6 @@
var/bhunger = 0 //Carbon
var/lying = 0
var/lying_prev = 0
var/canmove = 1
var/lastpuke = 0
var/unacidable = 0
var/can_strip = 1
@@ -12,8 +12,6 @@
stat = 2
canmove = 0
anchored = 1 // don't get pushed around
/mob/new_player/New()
GLOB.mob_list += src
-46
View File
@@ -1,46 +0,0 @@
//this and stop_pulling really ought to be /mob/living procs
/mob/proc/start_pulling(atom/movable/AM)
if(src == AM) // Trying to pull yourself is a shortcut to stop pulling
stop_pulling()
return
if(!AM || !isturf(AM.loc)) //if there's no object or the object being pulled is inside something: abort!
return
if(incapacitated())
return
if(!(AM.anchored))
AM.add_fingerprint(src)
// If we're pulling something then drop what we're currently pulling and pull this instead.
if(pulling)
// Are we trying to pull something we are already pulling? Then just stop here, no need to continue.
if(AM == pulling)
return
stop_pulling()
if(AM.pulledby)
visible_message("<span class='danger'>[src] has pulled [AM] from [AM.pulledby]'s grip.</span>")
AM.pulledby.stop_pulling() //an object can't be pulled by two mobs at once.
pulling = AM
AM.pulledby = src
if(pullin)
pullin.update_icon(src)
if(ismob(AM))
var/mob/M = AM
if(!iscarbon(src))
M.LAssailant = null
else
M.LAssailant = usr
/mob/verb/stop_pulling()
set name = "Stop Pulling"
set category = "IC"
if(pulling)
pulling.pulledby = null
pulling = null
if(pullin)
pullin.update_icon(src)
/mob/living/proc/check_pull()
if(pulling && !(pulling in orange(1)))
stop_pulling()
+4
View File
@@ -16,6 +16,7 @@ GLOBAL_LIST_INIT(conveyor_switches, list())
desc = "It's a conveyor belt, commonly used to transport large numbers of items elsewhere quite quickly."
layer = CONVEYOR_LAYER // so they appear under stuff but not below stuff like vents
anchored = TRUE
move_force = MOVE_FORCE_DEFAULT
var/operating = FALSE //NB: this can be TRUE while the belt doesn't go
var/forwards // The direction the conveyor sends you in
var/backwards // hopefully self-explanatory
@@ -183,9 +184,12 @@ GLOBAL_LIST_INIT(conveyor_switches, list())
..()
/obj/machinery/conveyor/proc/move_thing(atom/movable/AM)
if(move_force < (AM.move_resist))
return FALSE
if(!AM.anchored && AM.loc == loc)
step(AM, forwards)
/obj/machinery/conveyor/proc/can_conveyor_run()
if(stat & BROKEN)
return FALSE