Refactor move/click code and cooldowns

This commit is contained in:
Atermonera
2020-05-15 11:02:03 -07:00
committed by VirgoBot
parent 51c38f8555
commit 02f82fc1f0
18 changed files with 613 additions and 57 deletions
+18 -18
View File
@@ -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)
@@ -159,6 +159,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
+35 -35
View File
@@ -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