Merge pull request #13350 from farie82/pull-move-rework

Makes pulling and moving things depend on your size and the items weight
This commit is contained in:
AffectedArc07
2020-08-17 20:58:00 +01:00
committed by GitHub
11 changed files with 77 additions and 20 deletions
+10 -4
View File
@@ -61,7 +61,7 @@
/atom/movable/proc/get_cell()
return
/atom/movable/proc/start_pulling(atom/movable/AM, state, force = move_force, supress_message = FALSE)
/atom/movable/proc/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE)
if(QDELETED(AM))
return FALSE
if(!(AM.can_be_pulled(src, state, force)))
@@ -87,7 +87,7 @@
if(ismob(AM))
var/mob/M = AM
add_attack_logs(src, M, "passively grabbed", ATKLOG_ALMOSTALL)
if(!supress_message)
if(show_message)
visible_message("<span class='warning'>[src] has grabbed [M] passively!</span>")
return TRUE
@@ -120,12 +120,18 @@
if(pulledby && moving_diagonally != FIRST_DIAG_STEP && get_dist(src, pulledby) > 1) //separated from our puller and not in the middle of a diagonal move.
pulledby.stop_pulling()
/atom/movable/proc/can_be_pulled(user, grab_state, force)
/atom/movable/proc/can_be_pulled(user, grab_state, force, show_message = FALSE)
if(src == user || !isturf(loc))
return FALSE
if(anchored || throwing)
if(anchored || move_resist == INFINITY)
if(show_message)
to_chat(user, "<span class='warning'>[src] appears to be anchored to the ground!</span>")
return FALSE
if(throwing)
return FALSE
if(force < (move_resist * MOVE_FORCE_PULL_RATIO))
if(show_message)
to_chat(user, "<span class='warning'>[src] is too heavy to pull!</span>")
return FALSE
return TRUE
+19
View File
@@ -2,6 +2,8 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
/obj/item
name = "item"
icon = 'icons/obj/items.dmi'
move_resist = null // Set in the Initialise depending on the item size. Unless it's overriden by a specific item
var/discrete = 0 // used in item_attack.dm to make an item not show an attack message to viewers
var/image/blood_overlay = null //this saves our blood splatter overlay, which will be processed not to go over the edges of the sprite
var/blood_overlay_color = null
@@ -113,6 +115,23 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
hitsound = 'sound/items/welder.ogg'
if(damtype == "brute")
hitsound = "swing_hit"
if(!move_resist)
determine_move_resist()
/obj/item/proc/determine_move_resist()
switch(w_class)
if(WEIGHT_CLASS_TINY)
move_resist = MOVE_FORCE_EXTREMELY_WEAK
if(WEIGHT_CLASS_SMALL)
move_resist = MOVE_FORCE_VERY_WEAK
if(WEIGHT_CLASS_NORMAL)
move_resist = MOVE_FORCE_WEAK
if(WEIGHT_CLASS_BULKY)
move_resist = MOVE_FORCE_NORMAL
if(WEIGHT_CLASS_HUGE)
move_resist = MOVE_FORCE_NORMAL
if(WEIGHT_CLASS_GIGANTIC)
move_resist = MOVE_FORCE_NORMAL
/obj/item/Destroy()
flags &= ~DROPDEL //prevent reqdels
@@ -81,7 +81,7 @@
/mob/living/carbon/alien/larva/show_inv(mob/user as mob)
return
/mob/living/carbon/alien/larva/start_pulling(atom/movable/AM, state, force = move_force, supress_message = FALSE)
/mob/living/carbon/alien/larva/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE)
return FALSE
/* Commented out because it's duplicated in life.dm
+24 -3
View File
@@ -3,8 +3,29 @@
var/datum/atom_hud/data/human/medical/advanced/medhud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
medhud.add_to_hud(src)
faction += "\ref[src]"
determine_move_and_pull_forces()
GLOB.mob_living_list += src
// Used to determine the forces dependend on the mob size
// Will only change the force if the force was not set in the mob type itself
/mob/living/proc/determine_move_and_pull_forces()
var/value
switch(mob_size)
if(MOB_SIZE_TINY)
value = MOVE_FORCE_EXTREMELY_WEAK
if(MOB_SIZE_SMALL)
value = MOVE_FORCE_WEAK
if(MOB_SIZE_HUMAN)
value = MOVE_FORCE_NORMAL
if(MOB_SIZE_LARGE)
value = MOVE_FORCE_NORMAL // For now
if(!move_force)
move_force = value
if(!pull_force)
pull_force = value
if(!move_resist)
move_resist = value
/mob/living/prepare_huds()
..()
prepare_data_huds()
@@ -203,7 +224,7 @@
set category = "Object"
if(istype(AM) && Adjacent(AM))
start_pulling(AM)
start_pulling(AM, show_message = TRUE)
else
stop_pulling()
@@ -921,10 +942,10 @@
return 0
return 1
/mob/living/start_pulling(atom/movable/AM, state, force = pull_force, supress_message = FALSE)
/mob/living/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE)
if(!AM || !src)
return FALSE
if(!(AM.can_be_pulled(src, state, force)))
if(!(AM.can_be_pulled(src, state, force, show_message)))
return FALSE
if(incapacitated())
return
+1 -1
View File
@@ -219,7 +219,7 @@
fire_stacks += L.fire_stacks
IgniteMob()
/mob/living/can_be_pulled(user, grab_state, force)
/mob/living/can_be_pulled(user, grab_state, force, show_message = FALSE)
return ..() && !(buckled && buckled.buckle_prevents_pull)
/mob/living/water_act(volume, temperature, source, method = REAGENT_TOUCH)
@@ -2,6 +2,11 @@
see_invisible = SEE_INVISIBLE_LIVING
pressure_resistance = 10
// Will be determined based on mob size if left null. Done in living/proc/determine_move_and_pull_forces()
move_resist = null
move_force = null
pull_force = null
//Health and life related vars
var/maxHealth = 100 //Maximum health that should be possible.
var/health = 100 //A mob's health
+1 -1
View File
@@ -517,7 +517,7 @@
/mob/living/silicon/pai/Bumped()
return
/mob/living/silicon/pai/start_pulling(atom/movable/AM, state, force = move_force, supress_message = FALSE)
/mob/living/silicon/pai/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE)
return FALSE
/mob/living/silicon/pai/update_canmove(delay_action_updates = 0)
@@ -19,6 +19,7 @@
ventcrawler = 2
magpulse = 1
mob_size = MOB_SIZE_SMALL
pull_force = MOVE_FORCE_VERY_WEAK // Can only drag small items
modules_break = FALSE
@@ -335,21 +336,22 @@
/mob/living/silicon/robot/drone/Bumped(atom/movable/AM)
return
/mob/living/silicon/robot/drone/start_pulling(var/atom/movable/AM)
/mob/living/silicon/robot/drone/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE)
if(is_type_in_list(AM, pullable_drone_items))
..()
..(AM, force = INFINITY) // Drone power! Makes them able to drag pipes and such
else if(istype(AM,/obj/item))
var/obj/item/O = AM
if(O.w_class > WEIGHT_CLASS_SMALL)
to_chat(src, "<span class='warning'>You are too small to pull that.</span>")
if(show_message)
to_chat(src, "<span class='warning'>You are too small to pull that.</span>")
return
else
..()
else
to_chat(src, "<span class='warning'>You are too small to pull that.</span>")
return
if(show_message)
to_chat(src, "<span class='warning'>You are too small to pull that.</span>")
/mob/living/silicon/robot/drone/add_robot_verbs()
src.verbs |= silicon_subsystems
@@ -85,8 +85,11 @@
get_scooped(M)
..()
/mob/living/simple_animal/mouse/start_pulling(var/atom/movable/AM)//Prevents mouse from pulling things
to_chat(src, "<span class='warning'>You are too small to pull anything.</span>")
/mob/living/simple_animal/mouse/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE)//Prevents mouse from pulling things
if(istype(AM, /obj/item/reagent_containers/food/snacks/cheesewedge))
return ..() // Get dem
if(show_message)
to_chat(src, "<span class='warning'>You are too small to pull anything except cheese.</span>")
return
/mob/living/simple_animal/mouse/Crossed(AM as mob|obj, oldloc)
@@ -32,8 +32,9 @@
animate_ghostly_presence(src, -1, 20, 1) // Restart the floating animation after the attack animation, as it will be cancelled.
/mob/living/simple_animal/possessed_object/start_pulling(var/atom/movable/AM) // Silly motherfuckers think they can pull things.
to_chat(src, "<span class='warning'>You are unable to pull [AM]!</span>")
/mob/living/simple_animal/possessed_object/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE) // Silly motherfuckers think they can pull things.
if(show_message)
to_chat(src, "<span class='warning'>You are unable to pull [AM]!</span>")
/mob/living/simple_animal/possessed_object/ghost() // Ghosting will return the object to normal, and will not disqualify the ghoster from various mid-round antag positions.
@@ -265,7 +265,7 @@
/mob/living/simple_animal/slime/unEquip(obj/item/I, force)
return
/mob/living/simple_animal/slime/start_pulling(atom/movable/AM, state, force = move_force, supress_message = FALSE)
/mob/living/simple_animal/slime/start_pulling(atom/movable/AM, state, force = pull_force, show_message = FALSE)
return
/mob/living/simple_animal/slime/attack_ui(slot)