Fix on station jet air using and trails only on use. (#49567)

* Update carbon_movement.dm

* Carbon use jets before basic spacemove sources

Now carbons dont try propel yourself by thing around, when use jet.

* up

* Jet used when jet must be used

No more persistent jet air use

* Jet implant used when jet implant must be used

No more persistent jet implant air use

* TRUE and FALSE in carbon_movement.dm

* missing right-paren

* missing right-paren in imp

* better jetpack check

* better augment jetpack check

* augment jet toggle on fix

* fix m

* up

* Jet trails only on air use
This commit is contained in:
Dennok
2020-03-08 20:35:10 -04:00
committed by GitHub
parent c834c5f476
commit 8a888c690c
3 changed files with 65 additions and 20 deletions
@@ -1,24 +1,25 @@
/mob/living/carbon/slip(knockdown_amount, obj/O, lube, paralyze, force_drop)
if(movement_type & FLYING)
return 0
return FALSE
if(!(lube&SLIDE_ICE))
log_combat(src, (O ? O : get_turf(src)), "slipped on the", null, ((lube & SLIDE) ? "(LUBE)" : null))
return loc.handle_slip(src, knockdown_amount, O, lube, paralyze, force_drop)
/mob/living/carbon/Process_Spacemove(movement_dir = 0)
if(..())
return 1
if(!isturf(loc))
return 0
return FALSE
// Do we have a jetpack implant (and is it on)?
var/obj/item/organ/cyberimp/chest/thrusters/T = getorganslot(ORGAN_SLOT_THRUSTERS)
if(istype(T) && movement_dir && T.allow_thrust(0.01))
return 1
if(istype(T) && movement_dir && T.on)
return TRUE
var/obj/item/tank/jetpack/J = get_jetpack()
if(istype(J) && (movement_dir || J.stabilizers) && J.allow_thrust(0.01, src))
return 1
if(istype(J) && (movement_dir || J.stabilizers) && J.on)
return TRUE
if(..())
return TRUE
/mob/living/carbon/Move(NewLoc, direct)
. = ..()
+32 -9
View File
@@ -132,6 +132,7 @@
. = ..()
if(!ion_trail)
ion_trail = new
ion_trail.auto_process = FALSE
ion_trail.set_up(M)
/obj/item/organ/cyberimp/chest/thrusters/Remove(mob/living/carbon/M, special = 0)
@@ -148,16 +149,18 @@
if(!silent)
to_chat(owner, "<span class='warning'>Your thrusters set seems to be broken!</span>")
return 0
on = TRUE
if(allow_thrust(0.01))
on = TRUE
ion_trail.start()
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, .proc/move_react)
RegisterSignal(owner, COMSIG_MOVABLE_PRE_MOVE, .proc/pre_move_react)
owner.add_movespeed_modifier(MOVESPEED_ID_CYBER_THRUSTER, priority=100, multiplicative_slowdown=-0.5, movetypes=FLOATING, conflict=MOVE_CONFLICT_JETPACK)
if(!silent)
to_chat(owner, "<span class='notice'>You turn your thrusters set on.</span>")
else
ion_trail.stop()
UnregisterSignal(owner, COMSIG_MOVABLE_MOVED)
UnregisterSignal(owner, COMSIG_MOVABLE_PRE_MOVE)
owner.remove_movespeed_modifier(MOVESPEED_ID_CYBER_THRUSTER)
if(!silent)
to_chat(owner, "<span class='notice'>You turn your thrusters set off.</span>")
@@ -171,26 +174,44 @@
icon_state = "imp_jetpack"
/obj/item/organ/cyberimp/chest/thrusters/proc/move_react()
allow_thrust(0.01)
if(!on)//If jet dont work, it dont work
return
if(!owner)//Don't allow jet self using
return
if(!isturf(owner.loc))//You can't use jet in nowhere or in mecha/closet
return
if(!(owner.is_flying() || owner.is_floating()) || owner.buckled)//You don't want use jet in gravity or while buckled.
return
if(owner.pulledby)//You don't must use jet if someone pull you
return
if(owner.throwing)//You don't must use jet if you thrown
return
if(length(owner.client.keys_held & owner.client.movement_keys))//You use jet when press keys. yes.
allow_thrust(0.01)
/obj/item/organ/cyberimp/chest/thrusters/proc/pre_move_react()
ion_trail.oldposition = get_turf(owner)
/obj/item/organ/cyberimp/chest/thrusters/proc/allow_thrust(num)
if(!on || !owner)
return 0
if(!owner)
return FALSE
var/turf/T = get_turf(owner)
if(!T) // No more runtimes from being stuck in nullspace.
return 0
return FALSE
// Priority 1: use air from environment.
var/datum/gas_mixture/environment = T.return_air()
if(environment && environment.return_pressure() > 30)
return 1
ion_trail.generate_effect()
return TRUE
// Priority 2: use plasma from internal plasma storage.
// (just in case someone would ever use this implant system to make cyber-alien ops with jetpacks and taser arms)
if(owner.getPlasma() >= num*100)
owner.adjustPlasma(-num*100)
return 1
ion_trail.generate_effect()
return TRUE
// Priority 3: use internals tank.
var/obj/item/tank/I = owner.internal
@@ -198,9 +219,11 @@
var/datum/gas_mixture/removed = I.air_contents.remove(num)
if(removed.total_moles() > 0.005)
T.assume_air(removed)
return 1
ion_trail.generate_effect()
return TRUE
else
T.assume_air(removed)
ion_trail.generate_effect()
toggle(silent = TRUE)
return 0
return FALSE