-tg- pull refactor

This commit does the following:
 - Overhauls how pull works. It is now based on a mob verb,
   mob/verb/pulled()
 - Makes the pull icon much more responsive. It is now updated whenever a
   mob starts or stops pulling an object, and instantly updates.
   - This required HUD changes. God help me.
This commit is contained in:
Tigercat2000
2015-10-10 11:15:52 -07:00
parent 07770fdda7
commit ccdae149bb
40 changed files with 101 additions and 186 deletions
+3 -4
View File
@@ -135,10 +135,9 @@
nightvisionicon.name = "night vision"
nightvisionicon.screen_loc = ui_alien_nightvision
mymob.pullin = new /obj/screen()
mymob.pullin = new /obj/screen/pull()
mymob.pullin.icon = 'icons/mob/screen1_alien.dmi'
mymob.pullin.icon_state = "pull0"
mymob.pullin.name = "pull"
mymob.pullin.update_icon(mymob)
mymob.pullin.screen_loc = ui_pull_resist
alien_plasma_display = new /obj/screen()
@@ -171,4 +170,4 @@
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.toxin, mymob.fire, mymob.healths, nightvisionicon, mymob.pullin, alien_plasma_display, mymob.pullin, mymob.blind, mymob.flash) //, mymob.hands, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += src.adding + src.other
mymob.client.screen += mymob.client.void
mymob.client.screen += mymob.client.void
+3 -4
View File
@@ -56,10 +56,9 @@
nightvisionicon.name = "night vision"
nightvisionicon.screen_loc = ui_alien_nightvision
mymob.pullin = new /obj/screen()
mymob.pullin = new /obj/screen/pull()
mymob.pullin.icon = 'icons/mob/screen1_alien.dmi'
mymob.pullin.icon_state = "pull0"
mymob.pullin.name = "pull"
mymob.pullin.update_icon(mymob)
mymob.pullin.screen_loc = ui_pull_resist
mymob.blind = new /obj/screen()
@@ -69,7 +68,7 @@
mymob.blind.screen_loc = "CENTER-7,CENTER-7"
mymob.blind.layer = 0
mymob.blind.mouse_opacity = 0
mymob.flash = new /obj/screen()
mymob.flash.icon = 'icons/mob/screen1_alien.dmi'
mymob.flash.icon_state = "blank"
+2 -3
View File
@@ -422,10 +422,9 @@
mymob.nutrition_icon.name = "nutrition"
mymob.nutrition_icon.screen_loc = ui_nutrition
mymob.pullin = new /obj/screen()
mymob.pullin = new /obj/screen/pull()
mymob.pullin.icon = ui_style
mymob.pullin.icon_state = "pull0"
mymob.pullin.name = "pull"
mymob.pullin.update_icon(mymob)
mymob.pullin.screen_loc = ui_pull_resist
src.hotkeybuttons += mymob.pullin
+3 -4
View File
@@ -233,10 +233,9 @@
mymob.nutrition_icon.name = "nutrition"
mymob.nutrition_icon.screen_loc = ui_nutrition
mymob.pullin = new /obj/screen()
mymob.pullin = new /obj/screen/pull()
mymob.pullin.icon = ui_style
mymob.pullin.icon_state = "pull0"
mymob.pullin.name = "pull"
mymob.pullin.update_icon(mymob)
mymob.pullin.screen_loc = ui_pull_resist
src.hotkeybuttons += mymob.pullin
@@ -299,6 +298,6 @@
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.pressure, mymob.toxin, mymob.bodytemp, mymob.internals, mymob.fire, mymob.healths, mymob.healthdoll, mymob.nutrition_icon, mymob.pullin, mymob.blind, mymob.flash, mymob.damageoverlay, mymob.gun_setting_icon) //, mymob.hands, mymob.rest, mymob.sleep) //, mymob.mach )
mymob.client.screen += src.adding + src.hotkeybuttons
mymob.client.screen += mymob.client.void
mymob.client.screen += mymob.client.void
return
+3 -4
View File
@@ -18,10 +18,9 @@
mymob.healths.name = "health"
mymob.healths.screen_loc = ui_health
mymob.pullin = new /obj/screen()
mymob.pullin = new /obj/screen/pull()
mymob.pullin.icon = 'icons/mob/screen1_corgi.dmi'
mymob.pullin.icon_state = "pull0"
mymob.pullin.name = "pull"
mymob.pullin.update_icon(mymob)
mymob.pullin.screen_loc = ui_construct_pull
mymob.oxygen = new /obj/screen()
@@ -67,4 +66,4 @@
mymob.client.screen = list()
mymob.client.screen += list(blobpwrdisplay, blobhealthdisplay)
mymob.client.screen += mymob.client.void
mymob.client.screen += mymob.client.void
+2 -3
View File
@@ -125,10 +125,9 @@
mymob.fire.name = "fire"
mymob.fire.screen_loc = ui_fire
mymob.pullin = new /obj/screen()
mymob.pullin = new /obj/screen/pull()
mymob.pullin.icon = 'icons/mob/screen1_robot.dmi'
mymob.pullin.icon_state = "pull0"
mymob.pullin.name = "pull"
mymob.pullin.update_icon(mymob)
mymob.pullin.screen_loc = ui_borg_pull
mymob.blind = new /obj/screen()
+15 -3
View File
@@ -170,6 +170,21 @@
overlays.Cut()
overlays += image('icons/mob/zone_sel.dmi', "[selecting]")
/obj/screen/pull
name = "stop pulling"
icon = 'icons/mob/screen1_Midnight.dmi'
icon_state = "pull"
/obj/screen/pull/Click()
usr.stop_pulling()
/obj/screen/pull/update_icon(mob/mymob)
if(!mymob) return
if(mymob.pulling)
icon_state = "pull"
else
icon_state = "pull0"
/obj/screen/Click(location, control, params)
if(!usr) return 1
@@ -347,9 +362,6 @@
if("disarm")
usr.a_intent = I_DISARM
usr.hud_used.action_intent.icon_state = "intent_disarm"
if("pull")
usr.stop_pulling()
if("throw")
if(!usr.stat && isturf(usr.loc) && !usr.restrained())
usr:toggle_throw_mode()
-1
View File
@@ -89,7 +89,6 @@
add_cell()
add_iterators()
removeVerb(/obj/mecha/verb/disconnect_from_port)
removeVerb(/atom/movable/verb/pull)
log_message("[src.name] created.")
loc.Entered(src)
mechas_list += src //global mech list
@@ -7,8 +7,6 @@
var/propelled = 0 // Check for fire-extinguisher-driven chairs
/obj/structure/stool/bed/chair/New()
if(anchored)
src.verbs -= /atom/movable/verb/pull
..()
spawn(3) //sorry. i don't think there's a better way to do this.
handle_rotation()
+1 -20
View File
@@ -210,26 +210,7 @@ var/list/wood_icons = list("wood","wood-broken")
var/obj/item/stack/tile/light/T = floor_tile
T.on = !T.on
update_icon()
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored || !isturf(user.pulling.loc))
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
// if(M==user) //temporary hack to stop runtimes. ~Carn
// user.stop_pulling() //but...fixed the root of the problem
// return //shoudn't be needed now, unless somebody fucks with pulling again.
var/mob/t = M.pulling
M.stop_pulling()
step(user.pulling, get_dir(user.pulling.loc, src))
M.start_pulling(t)
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
..()
/turf/simulated/floor/proc/gets_drilled()
return
+1
View File
@@ -277,6 +277,7 @@
user << "\blue You push the wall but nothing happens!"
playsound(src, 'sound/weapons/Genhit.ogg', 25, 1)
src.add_fingerprint(user)
..()
return
/turf/simulated/wall/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
@@ -31,6 +31,7 @@
user << "\blue You push the wall but nothing happens!"
playsound(src, 'sound/weapons/Genhit.ogg', 25, 1)
src.add_fingerprint(user)
..()
return
+2 -19
View File
@@ -31,23 +31,6 @@
else
set_light(0)
/turf/space/attack_hand(mob/user as mob)
if ((user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored || !isturf(user.pulling.loc))
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
var/atom/movable/t = M.pulling
M.stop_pulling()
step(user.pulling, get_dir(user.pulling.loc, src))
M.start_pulling(t)
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
/turf/space/attackby(obj/item/C as obj, mob/user as mob, params)
if (istype(C, /obj/item/stack/rods))
@@ -87,10 +70,10 @@
/turf/space/Entered(atom/movable/A as mob|obj)
..()
if ((!(A) || src != A.loc))
if ((!(A) || src != A.loc))
return
if(destination_z)
if(destination_z)
A.x = destination_x
A.y = destination_y
A.z = destination_z
+3
View File
@@ -52,6 +52,9 @@
..()
return QDEL_HINT_HARDDEL_NOW
/turf/attack_hand(mob/user as mob)
user.Move_Pulled(src)
/turf/ex_act(severity)
return 0
-17
View File
@@ -3,23 +3,6 @@
icon = 'icons/turf/floors.dmi'
icon_state = "Floor3"
/turf/unsimulated/floor/attack_hand(var/mob/user as mob)
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored || !isturf(user.pulling.loc))
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
var/mob/t = M.pulling
M.stop_pulling()
step(user.pulling, get_dir(user.pulling.loc, src))
M.start_pulling(t)
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
/turf/unsimulated/floor/grass
icon_state = "grass1"
-1
View File
@@ -74,7 +74,6 @@
add_cell()
add_iterators()
removeVerb(/obj/mecha/verb/disconnect_from_port)
removeVerb(/atom/movable/verb/pull)
log_message("[src.name]'s functions initialised. Work protocols active - Entering IDLE mode.")
loc.Entered(src)
return
-8
View File
@@ -1,8 +0,0 @@
/atom/movable/verb/pull()
set name = "Pull"
set category = null
set src in oview(1)
if(Adjacent(usr))
usr.start_pulling(src)
return
@@ -230,13 +230,6 @@
else
healths.icon_state = "health6"
if(pullin)
if(pulling)
pullin.icon_state = "pull"
else
pullin.icon_state = "pull0"
if (toxin) toxin.icon_state = "tox[toxins_alert ? 1 : 0]"
if (oxygen) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]"
if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]"
@@ -1289,12 +1289,6 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
if(pressure)
pressure.icon_state = "pressure[pressure_alert]"
if(pullin)
if(pulling) pullin.icon_state = "pull1"
else pullin.icon_state = "pull0"
// if(rest) //Not used with new UI
// if(resting || lying || sleeping) rest.icon_state = "rest1"
// else rest.icon_state = "rest0"
if(toxin)
if(hal_screwyhud == 4 || toxins_alert) toxin.icon_state = "tox1"
else toxin.icon_state = "tox0"
+10
View File
@@ -26,6 +26,16 @@
current << "\red <FONT size = 3><B>The fog clouding your mind clears. You remember nothing from the moment you were implanted until now..(You don't remember who enslaved you)</B></FONT>"
*/
//mob verbs are a lot faster than object verbs
//for more info on why this is not atom/pull, see examinate() in mob.dm
/mob/living/verb/pulled(atom/movable/AM as mob|obj in oview(1))
set name = "Pull"
set category = "Object"
if(AM.Adjacent(src))
src.start_pulling(AM)
return
//same as above
/mob/living/pointed(atom/A as mob|obj|turf in view())
if(src.stat || !src.canmove || src.restrained())
@@ -42,10 +42,6 @@
set src = usr.contents
return 0
/mob/aiEye/pull()
set popup_menu = 0
set src = usr.contents
return 0
// Use this when setting the aiEye's location.
// It will also stream the chunk that the new loc is in.
@@ -65,7 +65,7 @@
for(var/V in components)
var/datum/robot_component/C = components[V]
C.consume_power()
var/amt = Clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick
@@ -287,7 +287,6 @@
src.bodytemp.icon_state = "temp-2"
if(src.pullin) src.pullin.icon_state = "pull[src.pulling ? 1 : 0]"
//Oxygen and fire does nothing yet!!
// if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]"
// if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]"
@@ -30,7 +30,6 @@
/mob/living/simple_animal/bee/New(loc, var/obj/machinery/apiary/new_parent)
..()
parent = new_parent
verbs -= /atom/movable/verb/pull
/mob/living/simple_animal/bee/Destroy()
if(parent)
@@ -38,9 +38,6 @@
if(fire)
if(fire_alert) fire.icon_state = "fire[fire_alert]" //fire_alert is either 0 if no alert, 1 for heat and 2 for cold.
else fire.icon_state = "fire0"
if(pullin)
if(pulling) pullin.icon_state = "pull1"
else pullin.icon_state = "pull0"
if(oxygen)
if(oxygen_alert) oxygen.icon_state = "oxy1"
else oxygen.icon_state = "oxy0"
+26 -31
View File
@@ -844,6 +844,30 @@ var/list/slot_equipment_priority = list( \
if(istype(M,/mob/living/silicon/ai)) return
show_inv(usr)
//this and stop_pulling really ought to be /mob/living procs
/mob/proc/start_pulling(atom/movable/AM)
if ( !AM || !src || src==AM || !isturf(AM.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort!
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()
src.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()
@@ -853,37 +877,8 @@ var/list/slot_equipment_priority = list( \
if(pulling)
pulling.pulledby = null
pulling = null
/mob/proc/start_pulling(var/atom/movable/AM)
if ( !AM || !usr || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort!
return
if (AM.anchored)
usr << "<span class='notice'>It won't budge!</span>"
return
var/mob/M = AM
if(ismob(AM))
if(!iscarbon(src))
M.LAssailant = null
else
M.LAssailant = usr
if(pulling)
var/pulling_old = pulling
stop_pulling()
// Are we pulling the same thing twice? Just stop pulling.
if(pulling_old == AM)
return
src.pulling = AM
AM.pulledby = src
//Attempted fix for people flying away through space when cuffed and dragged.
if(ismob(AM))
var/mob/pulled = AM
pulled.inertia_dir = 0
if(pullin)
pullin.update_icon(src)
/mob/proc/can_use_hands()
return
+22
View File
@@ -447,5 +447,27 @@
/mob/proc/mob_negates_gravity()
return 0
/mob/proc/Move_Pulled(atom/A)
if (!canmove || restrained() || !pulling)
return
if (pulling.anchored)
return
if (!pulling.Adjacent(src))
return
if (A == loc && pulling.density)
return
if (!Process_Spacemove(get_dir(pulling.loc, A)))
return
if (ismob(pulling))
var/mob/M = pulling
var/atom/movable/t = M.pulling
M.stop_pulling()
step(pulling, get_dir(pulling.loc, A))
if(M)
M.start_pulling(t)
else
step(pulling, get_dir(pulling.loc, A))
return
/mob/proc/update_gravity()
return
+1 -15
View File
@@ -1,20 +1,6 @@
/turf/simulated/floor/engine/attack_hand(var/mob/user as mob)
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored)
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
var/atom/movable/t = M.pulling
M.stop_pulling()
step(user.pulling, get_dir(user.pulling.loc, src))
M.start_pulling(t)
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
user.Move_Pulled(src)
/turf/simulated/floor/engine/ex_act(severity)
switch(severity)
+1 -15
View File
@@ -124,21 +124,7 @@
// attack with hand, move pulled object onto conveyor
/obj/machinery/conveyor/attack_hand(mob/user as mob)
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored)
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
M.stop_pulling()
step(user.pulling, get_dir(user.pulling.loc, src))
user.stop_pulling()
else
step(user.pulling, get_dir(user.pulling.loc, src))
user.stop_pulling()
return
user.Move_Pulled(src)
// make the conveyor broken
@@ -33,7 +33,6 @@
/obj/vehicle/train/ambulance/engine/New()
..()
cell = new /obj/item/weapon/stock_parts/cell/high
verbs -= /atom/movable/verb/pull
key = new()
/obj/vehicle/train/ambulance/engine/Move()
@@ -41,7 +41,6 @@
/obj/vehicle/train/cargo/engine/New()
..()
cell = new /obj/item/weapon/stock_parts/cell/high
verbs -= /atom/movable/verb/pull
key = new()
var/image/I = new(icon = 'icons/obj/vehicles.dmi', icon_state = "cargo_engine_overlay", layer = src.layer + 0.2) //over mobs
overlays += I
@@ -279,10 +278,5 @@
if(!lead && !tow)
anchored = 0
if(verbs.Find(/atom/movable/verb/pull))
return
else
verbs += /atom/movable/verb/pull
else
anchored = 1
verbs -= /atom/movable/verb/pull
anchored = 1
Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 29 KiB

-1
View File
@@ -882,7 +882,6 @@
#include "code\game\vehicles\spacepods\parts.dm"
#include "code\game\vehicles\spacepods\pod_fabricator.dm"
#include "code\game\vehicles\spacepods\spacepod.dm"
#include "code\game\verbs\atom_verbs.dm"
#include "code\game\verbs\ooc.dm"
#include "code\game\verbs\suicide.dm"
#include "code\game\verbs\who.dm"