Skip to content

Commit

Permalink
Makes piping and cabling trip you
Browse files Browse the repository at this point in the history
  • Loading branch information
CakeQ committed Oct 3, 2018
1 parent c6c4d2d commit c1c87f9
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/__defines/flags.dm
Expand Up @@ -22,6 +22,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204

#define OBJ_FLAG_ANCHORABLE 0x0001 // This object can be stuck in place with a tool
#define OBJ_FLAG_CONDUCTIBLE 0x0002 // Conducts electricity. (metal etc.)
#define OBJ_FLAG_TRIPPABLE 0x0003 // Objects like piping on the ground that can cause a trip

#define MOB_FLAG_HOLY_BAD 0x001 // If this mob is allergic to holiness

Expand Down
22 changes: 21 additions & 1 deletion code/game/objects/objs.dm
Expand Up @@ -160,4 +160,24 @@
..()

/obj/is_fluid_pushable(var/amt)
return ..() && w_class <= round(amt/20)
return ..() && w_class <= round(amt/20)

/obj/proc/trip_dir_check(mob/user as mob)
if(user.get_skill_value(SKILL_HAULING) >= SKILL_ADEPT)
return 0
else if(obj_flags & OBJ_FLAG_TRIPPABLE)
return 1
return 0

/obj/Crossed(mob/living/carbon/M as mob)
..()
for(var/obj/structure/catwalk/C in get_turf(src))
return
if(!ishuman(M) || !has_gravity(src) || M.resting || M.can_overcome_gravity() || M.move_intent.flags & MOVE_INTENT_DELIBERATE)
return
if(prob(40) && trip_dir_check(M))
M.apply_damage(5,BRUTE)
M.slip(src, 6)
M.visible_message(\
"<span class='warning'>[M.name] trips over \the [src]!</span>",\
"<span class='notice'>You trip over \the [src]!</span>")
10 changes: 10 additions & 0 deletions code/modules/atmospherics/pipes.dm
Expand Up @@ -17,6 +17,8 @@
buckle_lying = -1
var/datum/sound_token/sound_token

obj_flags = OBJ_FLAG_TRIPPABLE

/obj/machinery/atmospherics/pipe/drain_power()
return -1

Expand Down Expand Up @@ -1433,6 +1435,14 @@
..()
update_icon()

/obj/machinery/atmospherics/pipe/trip_dir_check(mob/user as mob)
var/turf/T = src.loc
if(!T.is_plating())
return 0
if(initialize_directions & user.dir)
return 0
. = ..()

/obj/machinery/atmospherics/proc/universal_underlays(var/obj/machinery/atmospherics/node, var/direction)
var/turf/T = loc
if(node)
Expand Down
10 changes: 10 additions & 0 deletions code/modules/power/cable.dm
Expand Up @@ -39,6 +39,8 @@ By design, d1 is the smallest direction and d2 is the highest
color = COLOR_MAROON
var/obj/machinery/power/breakerbox/breaker_box

obj_flags = OBJ_FLAG_TRIPPABLE


/obj/structure/cable/drain_power(var/drain_check, var/surge, var/amount = 0)

Expand Down Expand Up @@ -461,6 +463,14 @@ obj/structure/cable/proc/cableColor(var/colorC)

powernet = null // And finally null the powernet var.

/obj/structure/cable/trip_dir_check(mob/user as mob)
var/turf/T = src.loc
if(!T.is_plating())
return 0
if((user.dir == d1 || user.dir == d2))
return 0
. = ..()

///////////////////////////////////////////////
// The cable coil object, used for laying cable
///////////////////////////////////////////////
Expand Down
10 changes: 10 additions & 0 deletions code/modules/recycling/disposal.dm
Expand Up @@ -663,6 +663,8 @@
var/base_icon_state // initial icon state on map
var/sortType = ""
var/subtype = 0

obj_flags = OBJ_FLAG_TRIPPABLE
// new pipe, set the icon_state as on map
New()
..()
Expand Down Expand Up @@ -959,6 +961,14 @@
/obj/structure/disposalpipe/hides_under_flooring()
return 1

/obj/structure/disposalpipe/trip_dir_check(mob/user as mob)
var/turf/T = src.loc
if(!T.is_plating())
return 0
if(dpdir & user.dir)
return 0
. = ..()

// *** TEST verb
//client/verb/dispstop()
// for(var/obj/structure/disposalholder/H in world)
Expand Down

0 comments on commit c1c87f9

Please sign in to comment.