mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #7875 from VOREStation/upstream-merge-7082
[MIRROR] Refactor move/click code and cooldowns
This commit is contained in:
@@ -54,4 +54,4 @@
|
|||||||
//---------------
|
//---------------
|
||||||
//#define isturf(D) istype(D, /turf) //Built in
|
//#define isturf(D) istype(D, /turf) //Built in
|
||||||
#define isopenspace(A) istype(A, /turf/simulated/open)
|
#define isopenspace(A) istype(A, /turf/simulated/open)
|
||||||
#define isspace(A) istype(A, /turf/space)
|
#define isspace(A) istype(A, /turf/space)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
var/icon_rotation = 0 // Used to rotate icons in update_transform()
|
var/icon_rotation = 0 // Used to rotate icons in update_transform()
|
||||||
var/old_x = 0
|
var/old_x = 0
|
||||||
var/old_y = 0
|
var/old_y = 0
|
||||||
var/datum/riding/riding_datum //VOREStation Add - Moved from /obj/vehicle
|
var/datum/riding/riding_datum = null
|
||||||
var/does_spin = TRUE // Does the atom spin when thrown (of course it does :P)
|
var/does_spin = TRUE // Does the atom spin when thrown (of course it does :P)
|
||||||
var/movement_type = NONE
|
var/movement_type = NONE
|
||||||
|
|
||||||
|
|||||||
@@ -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/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
|
var/created_name = null
|
||||||
|
|
||||||
New()
|
/obj/structure/door_assembly/New()
|
||||||
update_state()
|
update_state()
|
||||||
|
|
||||||
/obj/structure/door_assembly/door_assembly_com
|
/obj/structure/door_assembly/door_assembly_com
|
||||||
base_icon_state = "com"
|
base_icon_state = "com"
|
||||||
@@ -136,23 +136,23 @@
|
|||||||
airlock_type = "/multi_tile/glass"
|
airlock_type = "/multi_tile/glass"
|
||||||
glass = -1 //To prevent bugs in deconstruction process.
|
glass = -1 //To prevent bugs in deconstruction process.
|
||||||
|
|
||||||
New()
|
/obj/structure/door_assembly/multi_tile/New()
|
||||||
if(dir in list(EAST, WEST))
|
if(dir in list(EAST, WEST))
|
||||||
bound_width = width * world.icon_size
|
bound_width = width * world.icon_size
|
||||||
bound_height = world.icon_size
|
bound_height = world.icon_size
|
||||||
else
|
else
|
||||||
bound_width = world.icon_size
|
bound_width = world.icon_size
|
||||||
bound_height = width * world.icon_size
|
bound_height = width * world.icon_size
|
||||||
update_state()
|
update_state()
|
||||||
|
|
||||||
Moved(atom/old_loc, direction, forced = FALSE)
|
/obj/structure/door_assembly/multi_tile/Moved(atom/old_loc, direction, forced = FALSE)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(dir in list(EAST, WEST))
|
if(dir in list(EAST, WEST))
|
||||||
bound_width = width * world.icon_size
|
bound_width = width * world.icon_size
|
||||||
bound_height = world.icon_size
|
bound_height = world.icon_size
|
||||||
else
|
else
|
||||||
bound_width = world.icon_size
|
bound_width = world.icon_size
|
||||||
bound_height = width * world.icon_size
|
bound_height = width * world.icon_size
|
||||||
|
|
||||||
/obj/structure/door_assembly/proc/rename_door(mob/living/user)
|
/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)
|
var/t = sanitizeSafe(input(user, "Enter the name for the windoor.", src.name, src.created_name), MAX_NAME_LEN)
|
||||||
|
|||||||
@@ -8,45 +8,45 @@
|
|||||||
w_class = ITEMSIZE_HUGE
|
w_class = ITEMSIZE_HUGE
|
||||||
var/obj/item/target/pinned_target // the current pinned target
|
var/obj/item/target/pinned_target // the current pinned target
|
||||||
|
|
||||||
Moved(atom/old_loc, direction, forced = FALSE)
|
/obj/structure/target_stake/Moved(atom/old_loc, direction, forced = FALSE)
|
||||||
. = ..()
|
. = ..()
|
||||||
// Move the pinned target along with the stake
|
// Move the pinned target along with the stake
|
||||||
if(pinned_target in view(3, src))
|
if(pinned_target in view(3, src))
|
||||||
pinned_target.forceMove(loc)
|
pinned_target.forceMove(loc)
|
||||||
|
|
||||||
else // Sanity check: if the pinned target can't be found in immediate view
|
else // Sanity check: if the pinned target can't be found in immediate view
|
||||||
pinned_target = null
|
pinned_target = null
|
||||||
density = 1
|
density = 1
|
||||||
|
|
||||||
attackby(obj/item/W as obj, mob/user as mob)
|
/obj/structure/target_stake/attackby(obj/item/W as obj, mob/user as mob)
|
||||||
// Putting objects on the stake. Most importantly, targets
|
// Putting objects on the stake. Most importantly, targets
|
||||||
if(pinned_target)
|
if(pinned_target)
|
||||||
return // get rid of that pinned target first!
|
return // get rid of that pinned target first!
|
||||||
|
|
||||||
if(istype(W, /obj/item/target))
|
if(istype(W, /obj/item/target))
|
||||||
density = 0
|
density = 0
|
||||||
W.density = 1
|
W.density = 1
|
||||||
user.remove_from_mob(W)
|
user.remove_from_mob(W)
|
||||||
W.loc = loc
|
W.loc = loc
|
||||||
W.layer = ABOVE_JUNK_LAYER
|
W.layer = ABOVE_JUNK_LAYER
|
||||||
pinned_target = W
|
pinned_target = W
|
||||||
to_chat(user, "You slide the target into the stake.")
|
to_chat(user, "You slide the target into the stake.")
|
||||||
return
|
return
|
||||||
|
|
||||||
attack_hand(mob/user as mob)
|
/obj/structure/target_stake/attack_hand(mob/user as mob)
|
||||||
// taking pinned targets off!
|
// taking pinned targets off!
|
||||||
if(pinned_target)
|
if(pinned_target)
|
||||||
density = 1
|
density = 1
|
||||||
pinned_target.density = 0
|
pinned_target.density = 0
|
||||||
pinned_target.layer = OBJ_LAYER
|
pinned_target.layer = OBJ_LAYER
|
||||||
|
|
||||||
pinned_target.loc = user.loc
|
pinned_target.loc = user.loc
|
||||||
if(ishuman(user))
|
if(ishuman(user))
|
||||||
if(!user.get_active_hand())
|
if(!user.get_active_hand())
|
||||||
user.put_in_hands(pinned_target)
|
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.")
|
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
|
||||||
|
|||||||
@@ -1658,7 +1658,7 @@
|
|||||||
var/obj/item/organ/external/e = organs_by_name[name]
|
var/obj/item/organ/external/e = organs_by_name[name]
|
||||||
if(!e)
|
if(!e)
|
||||||
continue
|
continue
|
||||||
if((e.status & ORGAN_BROKEN && (!e.splinted || (e.splinted && e.splinted in e.contents && prob(30))) || e.status & ORGAN_BLEEDING) && (getBruteLoss() + getFireLoss() >= 100))
|
if((e.status & ORGAN_BROKEN && (!e.splinted || (e.splinted in e.contents && prob(30))) || e.status & ORGAN_BLEEDING) && (getBruteLoss() + getFireLoss() >= 100))
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return ..()
|
return ..()
|
||||||
|
|||||||
@@ -785,6 +785,8 @@ default behaviour is:
|
|||||||
to_chat(usr, "OOC Metadata is not supported by this server!")
|
to_chat(usr, "OOC Metadata is not supported by this server!")
|
||||||
//VOREStation Edit End - Making it so SSD people have prefs with fallback to original style.
|
//VOREStation Edit End - Making it so SSD people have prefs with fallback to original style.
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
// Almost all of this handles pulling movables behind us
|
// Almost all of this handles pulling movables behind us
|
||||||
/mob/living/Move(atom/newloc, direct, movetime)
|
/mob/living/Move(atom/newloc, direct, movetime)
|
||||||
if(buckled && buckled.loc != newloc) //not updating position
|
if(buckled && buckled.loc != newloc) //not updating position
|
||||||
@@ -797,9 +799,8 @@ default behaviour is:
|
|||||||
// Prior to our move it's already too far away
|
// Prior to our move it's already too far away
|
||||||
if(pullee && get_dist(src, pullee) > 1)
|
if(pullee && get_dist(src, pullee) > 1)
|
||||||
stop_pulling()
|
stop_pulling()
|
||||||
// Shenanigans!
|
// Shenanigans! Pullee closed into locker for eg.
|
||||||
if(pullee && !isturf(pullee.loc) && pullee.loc != loc)
|
if(pullee && !isturf(pullee.loc) && pullee.loc != loc)
|
||||||
log_debug("[src]'s pull on [pullee] was broken despite [pullee] being in [pullee.loc]. Pull stopped manually.")
|
|
||||||
stop_pulling()
|
stop_pulling()
|
||||||
// Can't pull with no hands
|
// Can't pull with no hands
|
||||||
if(restrained())
|
if(restrained())
|
||||||
@@ -1235,7 +1236,7 @@ default behaviour is:
|
|||||||
//actually throw it!
|
//actually throw it!
|
||||||
src.visible_message("<span class='warning'>[src] has thrown [item].</span>")
|
src.visible_message("<span class='warning'>[src] has thrown [item].</span>")
|
||||||
|
|
||||||
if((istype(src.loc, /turf/space)) || (src.lastarea?.has_gravity == 0))
|
if((isspace(src.loc)) || (src.lastarea?.has_gravity == 0))
|
||||||
src.inertia_dir = get_dir(target, src)
|
src.inertia_dir = get_dir(target, src)
|
||||||
step(src, inertia_dir)
|
step(src, inertia_dir)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,10 @@
|
|||||||
return !P.can_hit_target(src, P.permutated, src == P.original, TRUE)
|
return !P.can_hit_target(src, P.permutated, src == P.original, TRUE)
|
||||||
return (!mover.density || !density || lying)
|
return (!mover.density || !density || lying)
|
||||||
|
|
||||||
/mob/living/SelfMove(turf/n, direct)
|
/mob/CanZASPass(turf/T, is_zone)
|
||||||
|
return ATMOS_PASS_YES
|
||||||
|
|
||||||
|
/mob/living/SelfMove(turf/n, direct, movetime)
|
||||||
// If on walk intent, don't willingly step into hazardous tiles.
|
// If on walk intent, don't willingly step into hazardous tiles.
|
||||||
// Unless the walker is confused.
|
// Unless the walker is confused.
|
||||||
if(m_intent == "walk" && confused <= 0)
|
if(m_intent == "walk" && confused <= 0)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
. += ..()
|
. += ..()
|
||||||
|
|
||||||
// NEW: Use power while moving.
|
// NEW: Use power while moving.
|
||||||
/mob/living/silicon/robot/SelfMove(turf/n, direct)
|
/mob/living/silicon/robot/SelfMove(turf/n, direct, movetime)
|
||||||
if (!is_component_functioning("actuator"))
|
if (!is_component_functioning("actuator"))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@
|
|||||||
. = ..()
|
. = ..()
|
||||||
to_chat(src,"<b>You are \the [src].</b> [player_msg]")
|
to_chat(src,"<b>You are \the [src].</b> [player_msg]")
|
||||||
|
|
||||||
/mob/living/simple_mob/SelfMove(turf/n, direct)
|
/mob/living/simple_mob/SelfMove(turf/n, direct, movetime)
|
||||||
var/turf/old_turf = get_turf(src)
|
var/turf/old_turf = get_turf(src)
|
||||||
var/old_dir = dir
|
var/old_dir = dir
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|||||||
@@ -42,8 +42,6 @@
|
|||||||
var/load_offset_y = 0 //pixel_y offset for item overlay
|
var/load_offset_y = 0 //pixel_y offset for item overlay
|
||||||
var/mob_offset_y = 0 //pixel_y offset for mob overlay
|
var/mob_offset_y = 0 //pixel_y offset for mob overlay
|
||||||
|
|
||||||
//var/datum/riding/riding_datum = null //VOREStation Edit - Moved to movables.
|
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
// Standard procs
|
// Standard procs
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user