mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-30 16:47:34 +01:00
Refactor move/click code
This commit is contained in:
@@ -151,12 +151,13 @@
|
||||
add_fingerprint(user)
|
||||
return M
|
||||
|
||||
/atom/movable/proc/handle_buckled_mob_movement(atom/old_loc, direct)
|
||||
/atom/movable/proc/handle_buckled_mob_movement(atom/old_loc, direct, movetime)
|
||||
for(var/A in buckled_mobs)
|
||||
var/mob/living/L = A
|
||||
L.forceMove(loc, direct)
|
||||
L.last_move = last_move
|
||||
L.inertia_dir = last_move
|
||||
if(!L.Move(loc, direct, movetime))
|
||||
L.forceMove(loc, direct, movetime)
|
||||
L.last_move = last_move
|
||||
L.inertia_dir = last_move
|
||||
|
||||
if(!buckle_dir)
|
||||
L.set_dir(dir)
|
||||
|
||||
@@ -636,6 +636,11 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
|
||||
//Looking through a scope or binoculars should /not/ improve your periphereal vision. Still, increase viewsize a tiny bit so that sniping isn't as restricted to NSEW
|
||||
/obj/item/var/ignore_visor_zoom_restriction = FALSE
|
||||
|
||||
/obj/item/on_loc_moved(var/oldloc)
|
||||
. = ..()
|
||||
if(zoom)
|
||||
zoom() // aka unzoom
|
||||
|
||||
/obj/item/proc/zoom(var/tileoffset = 14,var/viewsize = 9) //tileoffset is client view offset in the direction the user is facing. viewsize is how far out this thing zooms. 7 is normal view
|
||||
|
||||
var/devicename
|
||||
|
||||
@@ -99,7 +99,6 @@
|
||||
anchored = 0
|
||||
|
||||
can_buckle = 1
|
||||
buckle_movable = 1
|
||||
buckle_lying = 0
|
||||
buckle_dir = SOUTH
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
var/glass = 0 // 0 = glass can be installed. -1 = glass can't be installed. 1 = glass is already installed. Text = mineral plating is installed instead.
|
||||
var/created_name = null
|
||||
|
||||
New()
|
||||
update_state()
|
||||
/obj/structure/door_assembly/New()
|
||||
update_state()
|
||||
|
||||
/obj/structure/door_assembly/door_assembly_com
|
||||
base_icon_state = "com"
|
||||
@@ -136,23 +136,23 @@
|
||||
airlock_type = "/multi_tile/glass"
|
||||
glass = -1 //To prevent bugs in deconstruction process.
|
||||
|
||||
New()
|
||||
if(dir in list(EAST, WEST))
|
||||
bound_width = width * world.icon_size
|
||||
bound_height = world.icon_size
|
||||
else
|
||||
bound_width = world.icon_size
|
||||
bound_height = width * world.icon_size
|
||||
update_state()
|
||||
/obj/structure/door_assembly/multi_tile/New()
|
||||
if(dir in list(EAST, WEST))
|
||||
bound_width = width * world.icon_size
|
||||
bound_height = world.icon_size
|
||||
else
|
||||
bound_width = world.icon_size
|
||||
bound_height = width * world.icon_size
|
||||
update_state()
|
||||
|
||||
Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
if(dir in list(EAST, WEST))
|
||||
bound_width = width * world.icon_size
|
||||
bound_height = world.icon_size
|
||||
else
|
||||
bound_width = world.icon_size
|
||||
bound_height = width * world.icon_size
|
||||
/obj/structure/door_assembly/multi_tile/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
if(dir in list(EAST, WEST))
|
||||
bound_width = width * world.icon_size
|
||||
bound_height = world.icon_size
|
||||
else
|
||||
bound_width = world.icon_size
|
||||
bound_height = width * world.icon_size
|
||||
|
||||
/obj/structure/door_assembly/proc/rename_door(mob/living/user)
|
||||
var/t = sanitizeSafe(input(user, "Enter the name for the windoor.", src.name, src.created_name), MAX_NAME_LEN)
|
||||
|
||||
@@ -158,6 +158,20 @@
|
||||
else
|
||||
unbuckle_mob()
|
||||
|
||||
/obj/structure/bed/chair/office/handle_buckled_mob_movement(atom/new_loc, direction, movetime)
|
||||
for(var/A in buckled_mobs)
|
||||
var/mob/living/occupant = A
|
||||
occupant.buckled = null
|
||||
occupant.Move(loc, direction, movetime)
|
||||
occupant.buckled = src
|
||||
if (occupant && (loc != occupant.loc))
|
||||
if (propelled)
|
||||
for (var/mob/O in src.loc)
|
||||
if (O != occupant)
|
||||
Bump(O)
|
||||
else
|
||||
unbuckle_mob()
|
||||
|
||||
/obj/structure/bed/chair/office/Bump(atom/A)
|
||||
..()
|
||||
if(!has_buckled_mobs()) return
|
||||
|
||||
@@ -8,45 +8,45 @@
|
||||
w_class = ITEMSIZE_HUGE
|
||||
var/obj/item/target/pinned_target // the current pinned target
|
||||
|
||||
Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
// Move the pinned target along with the stake
|
||||
if(pinned_target in view(3, src))
|
||||
pinned_target.forceMove(loc)
|
||||
/obj/structure/target_stake/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
// Move the pinned target along with the stake
|
||||
if(pinned_target in view(3, src))
|
||||
pinned_target.forceMove(loc)
|
||||
|
||||
else // Sanity check: if the pinned target can't be found in immediate view
|
||||
pinned_target = null
|
||||
density = 1
|
||||
else // Sanity check: if the pinned target can't be found in immediate view
|
||||
pinned_target = null
|
||||
density = 1
|
||||
|
||||
attackby(obj/item/W as obj, mob/user as mob)
|
||||
// Putting objects on the stake. Most importantly, targets
|
||||
if(pinned_target)
|
||||
return // get rid of that pinned target first!
|
||||
/obj/structure/target_stake/attackby(obj/item/W as obj, mob/user as mob)
|
||||
// Putting objects on the stake. Most importantly, targets
|
||||
if(pinned_target)
|
||||
return // get rid of that pinned target first!
|
||||
|
||||
if(istype(W, /obj/item/target))
|
||||
density = 0
|
||||
W.density = 1
|
||||
user.remove_from_mob(W)
|
||||
W.loc = loc
|
||||
W.layer = ABOVE_JUNK_LAYER
|
||||
pinned_target = W
|
||||
to_chat(user, "You slide the target into the stake.")
|
||||
return
|
||||
if(istype(W, /obj/item/target))
|
||||
density = 0
|
||||
W.density = 1
|
||||
user.remove_from_mob(W)
|
||||
W.loc = loc
|
||||
W.layer = ABOVE_JUNK_LAYER
|
||||
pinned_target = W
|
||||
to_chat(user, "You slide the target into the stake.")
|
||||
return
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
// taking pinned targets off!
|
||||
if(pinned_target)
|
||||
density = 1
|
||||
pinned_target.density = 0
|
||||
pinned_target.layer = OBJ_LAYER
|
||||
/obj/structure/target_stake/attack_hand(mob/user as mob)
|
||||
// taking pinned targets off!
|
||||
if(pinned_target)
|
||||
density = 1
|
||||
pinned_target.density = 0
|
||||
pinned_target.layer = OBJ_LAYER
|
||||
|
||||
pinned_target.loc = user.loc
|
||||
if(ishuman(user))
|
||||
if(!user.get_active_hand())
|
||||
user.put_in_hands(pinned_target)
|
||||
to_chat(user, "You take the target out of the stake.")
|
||||
else
|
||||
pinned_target.loc = get_turf(user)
|
||||
pinned_target.loc = user.loc
|
||||
if(ishuman(user))
|
||||
if(!user.get_active_hand())
|
||||
user.put_in_hands(pinned_target)
|
||||
to_chat(user, "You take the target out of the stake.")
|
||||
else
|
||||
pinned_target.loc = get_turf(user)
|
||||
to_chat(user, "You take the target out of the stake.")
|
||||
|
||||
pinned_target = null
|
||||
pinned_target = null
|
||||
|
||||
Reference in New Issue
Block a user