Merge pull request #9592 from Ghommie/Ghommie-cit262
Porting movespeed modification system updates.
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
glide_size = 8
|
||||
appearance_flags = TILE_BOUND|PIXEL_SCALE
|
||||
var/datum/forced_movement/force_moving = null //handled soley by forced_movement.dm
|
||||
var/floating = FALSE
|
||||
var/movement_type = GROUND //Incase you have multiple types, you automatically use the most useful one. IE: Skating on ice, flippers on water, flying over chasm/space, etc.
|
||||
var/atom/movable/pulling
|
||||
var/grab_state = 0
|
||||
@@ -422,6 +421,9 @@
|
||||
var/atom/movable/AM = item
|
||||
AM.onTransitZ(old_z,new_z)
|
||||
|
||||
/atom/movable/proc/setMovetype(newval)
|
||||
movement_type = newval
|
||||
|
||||
//Called whenever an object moves and by mobs when they attempt to move themselves through space
|
||||
//And when an object or action applies a force on src, see newtonian_move() below
|
||||
//Return 0 to have src start/keep drifting in a no-grav area and 1 to stop/not start drifting
|
||||
@@ -686,14 +688,14 @@
|
||||
/atom/movable/proc/float(on)
|
||||
if(throwing)
|
||||
return
|
||||
if(on && !floating)
|
||||
if(on && !(movement_type & FLOATING))
|
||||
animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1)
|
||||
sleep(10)
|
||||
animate(src, pixel_y = pixel_y - 2, time = 10, loop = -1)
|
||||
floating = TRUE
|
||||
else if (!on && floating)
|
||||
setMovetype(movement_type | FLOATING)
|
||||
else if (!on && (movement_type & FLOATING))
|
||||
animate(src, pixel_y = initial(pixel_y), time = 10)
|
||||
floating = FALSE
|
||||
setMovetype(movement_type & ~FLOATING)
|
||||
|
||||
/* Language procs */
|
||||
/atom/movable/proc/get_language_holder(shadow=TRUE)
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
if(!victim.client || !istype(victim))
|
||||
return
|
||||
to_chat(victim, "<span class='notice'>You feel fast!</span>")
|
||||
ADD_TRAIT(victim, TRAIT_GOTTAGOREALLYFAST, "yellow_orb")
|
||||
victim.add_movespeed_modifier(MOVESPEED_ID_YELLOW_ORB, update=TRUE, priority=100, multiplicative_slowdown=-2, blacklisted_movetypes=(FLYING|FLOATING))
|
||||
sleep(duration)
|
||||
REMOVE_TRAIT(victim, TRAIT_GOTTAGOREALLYFAST, "yellow_orb")
|
||||
victim.remove_movespeed_modifier(MOVESPEED_ID_YELLOW_ORB)
|
||||
to_chat(victim, "<span class='notice'>You slow down.</span>")
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/obj/item/tank/jetpack/New()
|
||||
..()
|
||||
if(gas_type)
|
||||
air_contents.gases[gas_type] = (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C)
|
||||
air_contents.gases[gas_type] = ((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
ion_trail = new
|
||||
ion_trail.set_up(src)
|
||||
@@ -37,42 +37,50 @@
|
||||
return
|
||||
|
||||
if(!on)
|
||||
turn_on()
|
||||
turn_on(user)
|
||||
to_chat(user, "<span class='notice'>You turn the jetpack on.</span>")
|
||||
else
|
||||
turn_off()
|
||||
turn_off(user)
|
||||
to_chat(user, "<span class='notice'>You turn the jetpack off.</span>")
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.UpdateButtonIcon()
|
||||
|
||||
/obj/item/tank/jetpack/proc/turn_on()
|
||||
/obj/item/tank/jetpack/proc/turn_on(mob/user)
|
||||
on = TRUE
|
||||
icon_state = "[initial(icon_state)]-on"
|
||||
ion_trail.start()
|
||||
RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/move_react)
|
||||
if(full_speed)
|
||||
user.add_movespeed_modifier(MOVESPEED_ID_JETPACK, priority=100, multiplicative_slowdown=-2, movetypes=FLOATING, conflict=MOVE_CONFLICT_JETPACK)
|
||||
|
||||
/obj/item/tank/jetpack/proc/turn_off()
|
||||
/obj/item/tank/jetpack/proc/turn_off(mob/user)
|
||||
on = FALSE
|
||||
stabilizers = FALSE
|
||||
icon_state = initial(icon_state)
|
||||
ion_trail.stop()
|
||||
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)
|
||||
user.remove_movespeed_modifier(MOVESPEED_ID_JETPACK)
|
||||
|
||||
/obj/item/tank/jetpack/proc/move_react(mob/user)
|
||||
allow_thrust(0.01, user)
|
||||
|
||||
/obj/item/tank/jetpack/proc/allow_thrust(num, mob/living/user)
|
||||
if(!on)
|
||||
return
|
||||
if((num < 0.005 || air_contents.total_moles() < num))
|
||||
turn_off()
|
||||
turn_off(user)
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(num)
|
||||
if(removed.total_moles() < 0.005)
|
||||
turn_off()
|
||||
turn_off(user)
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(user)
|
||||
T.assume_air(removed)
|
||||
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/tank/jetpack/suicide_act(mob/user)
|
||||
if (istype(user, /mob/living/carbon/human/))
|
||||
@@ -96,22 +104,22 @@
|
||||
if(!on)
|
||||
return
|
||||
if((num < 0.005 || air_contents.total_moles() < num))
|
||||
turn_off()
|
||||
turn_off(user)
|
||||
return
|
||||
if(rand(0,250) == 0)
|
||||
to_chat(user, "<span class='notice'>You feel your jetpack's engines cut out.</span>")
|
||||
turn_off()
|
||||
turn_off(user)
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(num)
|
||||
if(removed.total_moles() < 0.005)
|
||||
turn_off()
|
||||
turn_off(user)
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(user)
|
||||
T.assume_air(removed)
|
||||
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/tank/jetpack/void
|
||||
name = "void jetpack (oxygen)"
|
||||
@@ -178,6 +186,7 @@
|
||||
full_speed = FALSE
|
||||
var/datum/gas_mixture/temp_air_contents
|
||||
var/obj/item/tank/internals/tank = null
|
||||
var/mob/living/carbon/human/cur_user
|
||||
|
||||
/obj/item/tank/jetpack/suit/New()
|
||||
..()
|
||||
@@ -198,28 +207,30 @@
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/tank/jetpack/suit/turn_on()
|
||||
if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc))
|
||||
/obj/item/tank/jetpack/suit/turn_on(mob/user)
|
||||
if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc) || loc.loc != user)
|
||||
return
|
||||
var/mob/living/carbon/human/H = loc.loc
|
||||
var/mob/living/carbon/human/H = user
|
||||
tank = H.s_store
|
||||
air_contents = tank.air_contents
|
||||
START_PROCESSING(SSobj, src)
|
||||
cur_user = user
|
||||
..()
|
||||
|
||||
/obj/item/tank/jetpack/suit/turn_off()
|
||||
/obj/item/tank/jetpack/suit/turn_off(mob/user)
|
||||
tank = null
|
||||
air_contents = temp_air_contents
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
cur_user = null
|
||||
..()
|
||||
|
||||
/obj/item/tank/jetpack/suit/process()
|
||||
if(!istype(loc, /obj/item/clothing/suit/space/hardsuit) || !ishuman(loc.loc))
|
||||
turn_off()
|
||||
turn_off(cur_user)
|
||||
return
|
||||
var/mob/living/carbon/human/H = loc.loc
|
||||
if(!tank || tank != H.s_store)
|
||||
turn_off()
|
||||
turn_off(cur_user)
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user