mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
@@ -462,6 +462,9 @@
|
|||||||
secondarytargets += L
|
secondarytargets += L
|
||||||
|
|
||||||
/obj/machinery/porta_turret/proc/assess_living(var/mob/living/L)
|
/obj/machinery/porta_turret/proc/assess_living(var/mob/living/L)
|
||||||
|
if(!istype(L))
|
||||||
|
return TURRET_NOT_TARGET
|
||||||
|
|
||||||
if(L.invisibility >= INVISIBILITY_LEVEL_ONE) // Cannot see him. see_invisible is a mob-var
|
if(L.invisibility >= INVISIBILITY_LEVEL_ONE) // Cannot see him. see_invisible is a mob-var
|
||||||
return TURRET_NOT_TARGET
|
return TURRET_NOT_TARGET
|
||||||
|
|
||||||
|
|||||||
@@ -262,12 +262,19 @@
|
|||||||
move_delay += 7+config.walk_speed
|
move_delay += 7+config.walk_speed
|
||||||
move_delay += mob.movement_delay()
|
move_delay += mob.movement_delay()
|
||||||
|
|
||||||
|
var/tickcomp = 0 //moved this out here so we can use it for vehicles
|
||||||
if(config.Tickcomp)
|
if(config.Tickcomp)
|
||||||
move_delay -= 1.3
|
// move_delay -= 1.3 //~added to the tickcomp calculation below
|
||||||
var/tickcomp = ((1/(world.tick_lag))*1.3)
|
tickcomp = ((1/(world.tick_lag))*1.3) - 1.3
|
||||||
move_delay = move_delay + tickcomp
|
move_delay = move_delay + tickcomp
|
||||||
|
|
||||||
if(istype(mob.buckled, /obj/vehicle))
|
if(istype(mob.buckled, /obj/vehicle))
|
||||||
|
//manually set move_delay for vehicles so we don't inherit any mob movement penalties
|
||||||
|
//specific vehicle move delays are set in code\modules\vehicles\vehicle.dm
|
||||||
|
move_delay = world.time + tickcomp
|
||||||
|
//drunk driving
|
||||||
|
if(mob.confused)
|
||||||
|
direct = pick(cardinal)
|
||||||
return mob.buckled.relaymove(mob,direct)
|
return mob.buckled.relaymove(mob,direct)
|
||||||
|
|
||||||
if(istype(mob.machine, /obj/machinery))
|
if(istype(mob.machine, /obj/machinery))
|
||||||
@@ -286,6 +293,9 @@
|
|||||||
var/datum/organ/external/r_hand = driver.get_organ("r_hand")
|
var/datum/organ/external/r_hand = driver.get_organ("r_hand")
|
||||||
if((!l_hand || (l_hand.status & ORGAN_DESTROYED)) && (!r_hand || (r_hand.status & ORGAN_DESTROYED)))
|
if((!l_hand || (l_hand.status & ORGAN_DESTROYED)) && (!r_hand || (r_hand.status & ORGAN_DESTROYED)))
|
||||||
return // No hands to drive your chair? Tough luck!
|
return // No hands to drive your chair? Tough luck!
|
||||||
|
//drunk wheelchair driving
|
||||||
|
if(mob.confused)
|
||||||
|
direct = pick(cardinal)
|
||||||
move_delay += 2
|
move_delay += 2
|
||||||
return mob.buckled.relaymove(mob,direct)
|
return mob.buckled.relaymove(mob,direct)
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
overlays += I
|
overlays += I
|
||||||
turn_off() //so engine verbs are correctly set
|
turn_off() //so engine verbs are correctly set
|
||||||
|
|
||||||
/obj/vehicle/train/cargo/engine/Move()
|
/obj/vehicle/train/cargo/engine/Move(var/turf/destination)
|
||||||
if(on && cell.charge < charge_use)
|
if(on && cell.charge < charge_use)
|
||||||
turn_off()
|
turn_off()
|
||||||
update_stats()
|
update_stats()
|
||||||
@@ -55,6 +55,10 @@
|
|||||||
|
|
||||||
if(is_train_head() && !on)
|
if(is_train_head() && !on)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
//space check ~no flying space trains sorry
|
||||||
|
if(on && istype(destination, /turf/space))
|
||||||
|
return 0
|
||||||
|
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
@@ -186,8 +190,8 @@
|
|||||||
|
|
||||||
/obj/vehicle/train/cargo/engine/verb/start_engine()
|
/obj/vehicle/train/cargo/engine/verb/start_engine()
|
||||||
set name = "Start engine"
|
set name = "Start engine"
|
||||||
set category = "Object"
|
set category = "Vehicle"
|
||||||
set src in view(1)
|
set src in view(0)
|
||||||
|
|
||||||
if(!istype(usr, /mob/living/carbon/human))
|
if(!istype(usr, /mob/living/carbon/human))
|
||||||
return
|
return
|
||||||
@@ -207,8 +211,8 @@
|
|||||||
|
|
||||||
/obj/vehicle/train/cargo/engine/verb/stop_engine()
|
/obj/vehicle/train/cargo/engine/verb/stop_engine()
|
||||||
set name = "Stop engine"
|
set name = "Stop engine"
|
||||||
set category = "Object"
|
set category = "Vehicle"
|
||||||
set src in view(1)
|
set src in view(0)
|
||||||
|
|
||||||
if(!istype(usr, /mob/living/carbon/human))
|
if(!istype(usr, /mob/living/carbon/human))
|
||||||
return
|
return
|
||||||
@@ -223,8 +227,8 @@
|
|||||||
|
|
||||||
/obj/vehicle/train/cargo/engine/verb/remove_key()
|
/obj/vehicle/train/cargo/engine/verb/remove_key()
|
||||||
set name = "Remove key"
|
set name = "Remove key"
|
||||||
set category = "Object"
|
set category = "Vehicle"
|
||||||
set src in view(1)
|
set src in view(0)
|
||||||
|
|
||||||
if(!istype(usr, /mob/living/carbon/human))
|
if(!istype(usr, /mob/living/carbon/human))
|
||||||
return
|
return
|
||||||
@@ -251,7 +255,12 @@
|
|||||||
if(!istype(C,/obj/machinery) && !istype(C,/obj/structure/closet) && !istype(C,/obj/structure/largecrate) && !istype(C,/obj/structure/reagent_dispensers) && !istype(C,/obj/structure/ore_box) && !istype(C, /mob/living/carbon/human))
|
if(!istype(C,/obj/machinery) && !istype(C,/obj/structure/closet) && !istype(C,/obj/structure/largecrate) && !istype(C,/obj/structure/reagent_dispensers) && !istype(C,/obj/structure/ore_box) && !istype(C, /mob/living/carbon/human))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
..()
|
//if there are any items you don't want to be able to interact with, add them to this check
|
||||||
|
// ~no more shielded, emitter armed death trains
|
||||||
|
if(istype(C, /obj/machinery))
|
||||||
|
load_object(C)
|
||||||
|
else
|
||||||
|
..()
|
||||||
|
|
||||||
if(load)
|
if(load)
|
||||||
return 1
|
return 1
|
||||||
@@ -262,6 +271,64 @@
|
|||||||
|
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
|
//Load the object "inside" the trolley and add an overlay of it.
|
||||||
|
//This prevents the object from being interacted with until it has
|
||||||
|
// been unloaded. A dummy object is loaded instead so the loading
|
||||||
|
// code knows to handle it correctly.
|
||||||
|
/obj/vehicle/train/cargo/trolley/proc/load_object(var/atom/movable/C)
|
||||||
|
if(!isturf(C.loc)) //To prevent loading things from someone's inventory, which wouldn't get handled properly.
|
||||||
|
return 0
|
||||||
|
if(load || C.anchored)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
var/datum/vehicle_dummy_load/dummy_load = new()
|
||||||
|
load = dummy_load
|
||||||
|
|
||||||
|
if(!load)
|
||||||
|
return
|
||||||
|
dummy_load.actual_load = C
|
||||||
|
C.forceMove(src)
|
||||||
|
|
||||||
|
if(load_item_visible)
|
||||||
|
C.pixel_x += load_offset_x
|
||||||
|
C.pixel_y += load_offset_y
|
||||||
|
C.layer = layer
|
||||||
|
|
||||||
|
overlays += C
|
||||||
|
|
||||||
|
//we can set these back now since we have already cloned the icon into the overlay
|
||||||
|
C.pixel_x = initial(C.pixel_x)
|
||||||
|
C.pixel_y = initial(C.pixel_y)
|
||||||
|
C.layer = initial(C.layer)
|
||||||
|
|
||||||
|
/obj/vehicle/train/cargo/trolley/unload(var/mob/user, var/direction)
|
||||||
|
if(istype(load, /datum/vehicle_dummy_load))
|
||||||
|
var/datum/vehicle_dummy_load/dummy_load = load
|
||||||
|
load = dummy_load.actual_load
|
||||||
|
dummy_load.actual_load = null
|
||||||
|
del(dummy_load)
|
||||||
|
overlays.Cut()
|
||||||
|
..()
|
||||||
|
|
||||||
|
//-------------------------------------------
|
||||||
|
// Latching/unlatching procs
|
||||||
|
//-------------------------------------------
|
||||||
|
|
||||||
|
/obj/vehicle/train/cargo/engine/latch(obj/vehicle/train/T, mob/user)
|
||||||
|
if(!istype(T) || !Adjacent(T))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
//if we are attaching a trolley to an engine we don't care what direction
|
||||||
|
// it is in and it should probably be attached with the engine in the lead
|
||||||
|
if(istype(T, /obj/vehicle/train/cargo/trolley))
|
||||||
|
T.attach_to(src, user)
|
||||||
|
else
|
||||||
|
var/T_dir = get_dir(src, T) //figure out where T is wrt src
|
||||||
|
|
||||||
|
if(dir == T_dir) //if car is ahead
|
||||||
|
src.attach_to(T, user)
|
||||||
|
else if(reverse_direction(dir) == T_dir) //else if car is behind
|
||||||
|
T.attach_to(src, user)
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// Stat update procs
|
// Stat update procs
|
||||||
|
|||||||
@@ -114,9 +114,9 @@
|
|||||||
/obj/vehicle/train/verb/unlatch_v()
|
/obj/vehicle/train/verb/unlatch_v()
|
||||||
set name = "Unlatch"
|
set name = "Unlatch"
|
||||||
set desc = "Unhitches this train from the one in front of it."
|
set desc = "Unhitches this train from the one in front of it."
|
||||||
set category = "Object"
|
set category = "Vehicle"
|
||||||
set src in view(1)
|
set src in view(1)
|
||||||
|
|
||||||
if(!istype(usr, /mob/living/carbon/human))
|
if(!istype(usr, /mob/living/carbon/human))
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -131,6 +131,7 @@
|
|||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
|
|
||||||
//attempts to attach src as a follower of the train T
|
//attempts to attach src as a follower of the train T
|
||||||
|
//Note: there is a modified version of this in code\modules\vehicles\cargo_train.dm specifically for cargo train engines
|
||||||
/obj/vehicle/train/proc/attach_to(obj/vehicle/train/T, mob/user)
|
/obj/vehicle/train/proc/attach_to(obj/vehicle/train/T, mob/user)
|
||||||
if (get_dist(src, T) > 1)
|
if (get_dist(src, T) > 1)
|
||||||
user << "\red [src] is too far away from [T] to hitch them together."
|
user << "\red [src] is too far away from [T] to hitch them together."
|
||||||
@@ -139,11 +140,11 @@
|
|||||||
if (lead)
|
if (lead)
|
||||||
user << "\red [src] is already hitched to something."
|
user << "\red [src] is already hitched to something."
|
||||||
return
|
return
|
||||||
|
|
||||||
if (T.tow)
|
if (T.tow)
|
||||||
user << "\red [T] is already towing something."
|
user << "\red [T] is already towing something."
|
||||||
return
|
return
|
||||||
|
|
||||||
//check for cycles.
|
//check for cycles.
|
||||||
var/obj/vehicle/train/next_car = T
|
var/obj/vehicle/train/next_car = T
|
||||||
while (next_car)
|
while (next_car)
|
||||||
@@ -151,15 +152,15 @@
|
|||||||
user << "\red That seems very silly."
|
user << "\red That seems very silly."
|
||||||
return
|
return
|
||||||
next_car = next_car.lead
|
next_car = next_car.lead
|
||||||
|
|
||||||
//latch with src as the follower
|
//latch with src as the follower
|
||||||
lead = T
|
lead = T
|
||||||
T.tow = src
|
T.tow = src
|
||||||
set_dir(lead.dir)
|
set_dir(lead.dir)
|
||||||
|
|
||||||
if(user)
|
if(user)
|
||||||
user << "\blue You hitch [src] to [T]."
|
user << "\blue You hitch [src] to [T]."
|
||||||
|
|
||||||
update_stats()
|
update_stats()
|
||||||
|
|
||||||
|
|
||||||
@@ -168,10 +169,10 @@
|
|||||||
if (!lead)
|
if (!lead)
|
||||||
user << "\red [src] is not hitched to anything."
|
user << "\red [src] is not hitched to anything."
|
||||||
return
|
return
|
||||||
|
|
||||||
lead.tow = null
|
lead.tow = null
|
||||||
lead.update_stats()
|
lead.update_stats()
|
||||||
|
|
||||||
user << "\blue You unhitch [src] from [lead]."
|
user << "\blue You unhitch [src] from [lead]."
|
||||||
lead = null
|
lead = null
|
||||||
|
|
||||||
@@ -190,7 +191,7 @@
|
|||||||
|
|
||||||
//returns 1 if this is the lead car of the train
|
//returns 1 if this is the lead car of the train
|
||||||
/obj/vehicle/train/proc/is_train_head()
|
/obj/vehicle/train/proc/is_train_head()
|
||||||
if (lead)
|
if (lead)
|
||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -209,7 +210,7 @@
|
|||||||
if (T.tow == src)
|
if (T.tow == src)
|
||||||
lead.tow = null
|
lead.tow = null
|
||||||
lead.update_stats()
|
lead.update_stats()
|
||||||
|
|
||||||
lead = null
|
lead = null
|
||||||
update_stats()
|
update_stats()
|
||||||
return
|
return
|
||||||
@@ -220,7 +221,7 @@
|
|||||||
var/train_length = 0
|
var/train_length = 0
|
||||||
while(T)
|
while(T)
|
||||||
train_length++
|
train_length++
|
||||||
if (powered && on)
|
if (T.powered && T.on)
|
||||||
active_engines++
|
active_engines++
|
||||||
T.update_car(train_length, active_engines)
|
T.update_car(train_length, active_engines)
|
||||||
T = T.lead
|
T = T.lead
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
//Dummy object for holding items in vehicles.
|
||||||
|
//Prevents items from being interacted with.
|
||||||
|
/datum/vehicle_dummy_load
|
||||||
|
var/name = "dummy load"
|
||||||
|
var/actual_load
|
||||||
|
|
||||||
/obj/vehicle
|
/obj/vehicle
|
||||||
name = "vehicle"
|
name = "vehicle"
|
||||||
icon = 'icons/obj/vehicles.dmi'
|
icon = 'icons/obj/vehicles.dmi'
|
||||||
@@ -39,6 +45,7 @@
|
|||||||
|
|
||||||
/obj/vehicle/Move()
|
/obj/vehicle/Move()
|
||||||
if(world.time > l_move_time + move_delay)
|
if(world.time > l_move_time + move_delay)
|
||||||
|
var/old_loc = get_turf(src)
|
||||||
if(on && powered && cell.charge < charge_use)
|
if(on && powered && cell.charge < charge_use)
|
||||||
turn_off()
|
turn_off()
|
||||||
|
|
||||||
@@ -48,13 +55,16 @@
|
|||||||
anchored = init_anc
|
anchored = init_anc
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
set_dir(get_dir(old_loc, loc))
|
||||||
anchored = init_anc
|
anchored = init_anc
|
||||||
|
|
||||||
if(on && powered)
|
if(on && powered)
|
||||||
cell.use(charge_use)
|
cell.use(charge_use)
|
||||||
|
|
||||||
if(load)
|
//Dummy loads do not have to be moved as they are just an overlay
|
||||||
load.forceMove(loc)// = loc
|
//See load_object() proc in cargo_trains.dm for an example
|
||||||
|
if(load && !istype(load, /datum/vehicle_dummy_load))
|
||||||
|
load.forceMove(loc)
|
||||||
load.set_dir(dir)
|
load.set_dir(dir)
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
@@ -154,6 +164,10 @@
|
|||||||
/obj/vehicle/attack_ai(mob/user as mob)
|
/obj/vehicle/attack_ai(mob/user as mob)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
// For downstream compatibility (in particular Paradise)
|
||||||
|
/obj/vehicle/proc/handle_rotation()
|
||||||
|
return
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
// Vehicle procs
|
// Vehicle procs
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
@@ -257,8 +271,8 @@
|
|||||||
// calling this parent proc.
|
// calling this parent proc.
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
/obj/vehicle/proc/load(var/atom/movable/C)
|
/obj/vehicle/proc/load(var/atom/movable/C)
|
||||||
//define allowed items for loading in specific vehicle definitions
|
//This loads objects onto the vehicle so they can still be interacted with.
|
||||||
|
//Define allowed items for loading in specific vehicle definitions.
|
||||||
if(!isturf(C.loc)) //To prevent loading things from someone's inventory, which wouldn't get handled properly.
|
if(!isturf(C.loc)) //To prevent loading things from someone's inventory, which wouldn't get handled properly.
|
||||||
return 0
|
return 0
|
||||||
if(load || C.anchored)
|
if(load || C.anchored)
|
||||||
|
|||||||
Reference in New Issue
Block a user