Merge pull request #9592 from Ghommie/Ghommie-cit262

Porting movespeed modification system updates.
This commit is contained in:
kevinz000
2019-10-29 21:27:53 -07:00
committed by GitHub
38 changed files with 193 additions and 200 deletions
+2 -2
View File
@@ -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>")
+29 -18
View File
@@ -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
..()