Skip to content

Commit

Permalink
add: Point Rework (#3962)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottfrei authored Dec 8, 2023
1 parent 90e9478 commit ac8adfa
Show file tree
Hide file tree
Showing 24 changed files with 292 additions and 98 deletions.
2 changes: 0 additions & 2 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

#define isprojectile(A) (istype(A, /obj/item/projectile))

#define is_cleanable(A) (istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/rune)) //if something is cleanable

#define is_pen(W) (istype(W, /obj/item/pen))

#define is_pda(W) (istype(W, /obj/item/pda))
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
#define HIGH_LANDMARK_LAYER 9.2
#define AREA_LAYER 10
#define MASSIVE_OBJ_LAYER 11

#define POINT_PLANE 14
#define POINT_LAYER 12

#define CHAT_LAYER 12.0001 // Do not insert layers between these two values
Expand Down
4 changes: 4 additions & 0 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
var/moving_diagonally = 0 //0: not doing a diagonal move. 1 and 2: doing the first/second step of the diagonal move
var/list/client_mobs_in_contents

/// Icon state for thought bubbles. Normally set by mobs.
var/thought_bubble_image = "thought_bubble"


/atom/movable/attempt_init(loc, ...)
var/turf/T = get_turf(src)
if(T && SSatoms.initialized != INITIALIZATION_INSSATOMS && GLOB.space_manager.is_zlevel_dirty(T.z))
Expand Down
2 changes: 2 additions & 0 deletions code/game/gamemodes/cult/runes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ To draw a rune, use a ritual dagger.
visible_message("<span class='danger'>[src] suddenly appears!</span>")
alpha = initial(alpha)

/obj/effect/rune/is_cleanable()
return TRUE

/*
There are a few different procs each rune runs through when a cultist activates it.
Expand Down
36 changes: 18 additions & 18 deletions code/game/gamemodes/nuclear/pinpointer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
if(!the_s_bomb)
the_s_bomb = locate()

/obj/item/pinpointer/proc/point_at(atom/target)
/obj/item/pinpointer/proc/pinpoint_at(atom/target)
if(!target)
icon_state = icon_null
return
Expand All @@ -132,15 +132,15 @@

/obj/item/pinpointer/proc/workdisk()
scandisk()
point_at(the_disk)
pinpoint_at(the_disk)

/obj/item/pinpointer/proc/workbomb()
if(!syndicate)
scanbomb()
point_at(the_bomb)
pinpoint_at(the_bomb)
else
scanbomb()
point_at(the_s_bomb)
pinpoint_at(the_s_bomb)

/obj/item/pinpointer/examine(mob/user)
. = ..()
Expand All @@ -163,13 +163,13 @@
if(SETTING_DISK)
workdisk()
if(SETTING_LOCATION)
point_at(location)
pinpoint_at(location)
if(SETTING_OBJECT)
point_at(target)
pinpoint_at(target)

/obj/item/pinpointer/advpinpointer/workdisk() //since mode works diffrently for advpinpointer
scandisk()
point_at(the_disk)
pinpoint_at(the_disk)

/obj/item/pinpointer/advpinpointer/AltClick(mob/user)
. = ..()
Expand Down Expand Up @@ -280,7 +280,7 @@
visible_message("Shuttle Locator mode actived.") //Lets the mob holding it know that the mode has changed
return //Get outta here
scandisk()
point_at(the_disk)
pinpoint_at(the_disk)

/obj/item/pinpointer/nukeop/workbomb()
if(GLOB.bomb_set) //If the bomb is set, lead to the shuttle
Expand All @@ -290,7 +290,7 @@
visible_message("Shuttle Locator mode actived.") //Lets the mob holding it know that the mode has changed
return //Get outta here
scanbomb()
point_at(the_s_bomb)
pinpoint_at(the_s_bomb)

/obj/item/pinpointer/nukeop/proc/worklocation()
if(!GLOB.bomb_set)
Expand All @@ -307,7 +307,7 @@
if(loc.z != home.z) //If you are on a different z-level from the shuttle
icon_state = icon_null
else
point_at(home)
pinpoint_at(home)

/obj/item/pinpointer/operative
name = "operative pinpointer"
Expand Down Expand Up @@ -340,7 +340,7 @@
/obj/item/pinpointer/operative/proc/workop()
if(mode == MODE_OPERATIVE)
scan_for_ops()
point_at(nearest_op, FALSE)
pinpoint_at(nearest_op, FALSE)
else
return FALSE

Expand Down Expand Up @@ -375,7 +375,7 @@

/obj/item/pinpointer/ninja/proc/workninja()
scan_for_ninja()
point_at(nearest_ninja, FALSE)
pinpoint_at(nearest_ninja, FALSE)

/obj/item/pinpointer/ninja/examine(mob/user)
. = ..()
Expand Down Expand Up @@ -413,9 +413,9 @@

/obj/item/pinpointer/crew/process()
if(mode == MODE_CREW && target_set)
point_at(target)
pinpoint_at(target)

/obj/item/pinpointer/crew/point_at(atom/target)
/obj/item/pinpointer/crew/pinpoint_at(atom/target)
if(!target || !trackable(target))
icon_state = icon_null
return
Expand Down Expand Up @@ -490,9 +490,9 @@
/obj/item/pinpointer/thief/process()
switch(setting)
if(SETTING_LOCATION)
point_at(location)
pinpoint_at(location)
if(SETTING_OBJECT)
point_at(target)
pinpoint_at(target)


/obj/item/pinpointer/thief/cycle(mob/user)
Expand Down Expand Up @@ -699,14 +699,14 @@
/obj/item/pinpointer/tendril/process()
if(mode == MODE_TENDRIL)
find_tendril()
point_at(target, FALSE)
pinpoint_at(target, FALSE)
else
icon_state = icon_off

/obj/item/pinpointer/tendril/proc/find_tendril()
if(mode == MODE_TENDRIL)
scan_for_tendrils()
point_at(target)
pinpoint_at(target)
else
return FALSE

Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/effects/decals/cleanable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
/obj/effect/decal/cleanable/proc/can_bloodcrawl_in()
return FALSE

/obj/effect/decal/cleanable/is_cleanable()
return TRUE

/obj/effect/decal/cleanable/Initialize(mapload)
. = ..()
if(loc && isturf(loc))
Expand Down
15 changes: 14 additions & 1 deletion code/game/objects/effects/effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
icon = 'icons/effects/effects.dmi'
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
move_resist = INFINITY
anchored = 1
anchored = TRUE
can_be_hit = FALSE

/obj/effect/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
Expand All @@ -22,6 +22,9 @@
/obj/effect/acid_act()
return

/obj/effect/proc/is_cleanable() //Called when you want to clean something, and usualy delete it after
return FALSE

/obj/effect/mech_melee_attack(obj/mecha/M)
return 0

Expand Down Expand Up @@ -55,6 +58,7 @@
density = FALSE
icon = null
icon_state = null
armor = list(MELEE = 100, BULLET = 100, LASER = 100, ENERGY = 100, BOMB = 100, BIO = 100, RAD = 100, FIRE = 100, ACID = 100)

// Most of these overrides procs below are overkill, but better safe than sorry.
/obj/effect/abstract/swarmer_act()
Expand All @@ -81,6 +85,15 @@
/obj/effect/abstract/ex_act(severity)
return

/obj/effect/abstract/blob_act()
return

/obj/effect/abstract/acid_act()
return

/obj/effect/abstract/fire_act()
return

/obj/effect/decal
plane = FLOOR_PLANE
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF
Expand Down
9 changes: 0 additions & 9 deletions code/game/objects/effects/temporary_visuals/miscellaneous.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/obj/effect/temp_visual/point
name = "arrow"
desc = "It's an arrow hanging in mid-air. There may be a wizard about."
icon = 'icons/mob/screen_gen.dmi'
icon_state = "arrow"
layer = POINT_LAYER
duration = 20
randomdir = FALSE

/obj/effect/temp_visual/dir_setting/bloodsplatter
icon = 'icons/effects/blood.dmi'
duration = 5
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/mop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if(reagents.has_reagent("water", 1) || reagents.has_reagent("cleaner", 1) || reagents.has_reagent("holywater", 1))
A.clean_blood()
for(var/obj/effect/O in A)
if(is_cleanable(O))
if(O.is_cleanable())
qdel(O)
reagents.reaction(A, REAGENT_TOUCH, 10) //10 is the multiplier for the reaction effect. probably needed to wet the floor properly.
reagents.remove_any(1) //reaction() doesn't use up the reagents
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/soap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
/obj/item/soap/proc/clean_turf(turf/simulated/T)
T.clean_blood()
for(var/obj/effect/O in T)
if(is_cleanable(O))
if(O.is_cleanable())
qdel(O)

/obj/item/soap/attack(mob/target as mob, mob/user as mob)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/watercloset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
var/turf/tile = loc
loc.clean_blood()
for(var/obj/effect/E in tile)
if(is_cleanable(E))
if(E.is_cleanable())
qdel(E)

/obj/machinery/shower/process()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3637,7 +3637,7 @@
N.mode = 3 //MODE_ADV, not defined here
N.setting = 2 //SETTING_OBJECT, not defined here
N.target = H
N.point_at(N.target)
N.pinpoint_at(N.target)
N.modelocked = TRUE
if(!locate(/obj/item/implant/dust, hunter_mob))
var/obj/item/implant/dust/D = new /obj/item/implant/dust(hunter_mob)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/// The first person to have used the item. If this is set already, no one else can use it.
var/mob/owner = null

/obj/item/pinpointer/crew/contractor/point_at(atom/target)
/obj/item/pinpointer/crew/contractor/pinpoint_at(atom/target)
if(target && trackable(target))
// Calc dir
var/turf/T = get_turf(target)
Expand Down
18 changes: 11 additions & 7 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -675,19 +675,23 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, ignore_lying = FALSE)
return TRUE

//this is a mob verb instead of atom for performance reasons
//see /mob/verb/examinate() in mob.dm for more info
//overriden here and in /mob/living for different point span classes and sanity checks
/mob/dead/observer/run_pointed(atom/A as mob|obj|turf)

/**
* This is a mob verb instead of atom for performance reasons.
* See /mob/verb/examinate() in mob.dm for more info.
* Overriden here and in /mob/living for different point span classes and sanity checks.
*/
/mob/dead/observer/run_pointed(atom/target)
if(!..())
return FALSE
var/follow_link
if(invisibility) // Only show the button if the ghost is not visible to the living
follow_link = " ([ghost_follow_link(A, src)])"
usr.visible_message("<span class='deadsay'><b>[src]</b> points to [A][follow_link].</span>")
add_deadchat_logs(src, "point to [key_name(A)] [COORD(A)]")
follow_link = " ([ghost_follow_link(target, src)])"
usr.visible_message(span_deadsay("<b>[src]</b> points to [target][follow_link]."))
add_deadchat_logs(src, "point to [key_name(target)] [COORD(target)]")
return TRUE


/mob/dead/observer/proc/incarnate_ghost()
if(!client)
return
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/brain/brain_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
if(ishuman(owner))
owner.update_hair()

owner.thought_bubble_image = initial(owner.thought_bubble_image)
. = ..()


Expand Down
41 changes: 30 additions & 11 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -309,24 +309,43 @@
return FALSE
return ..()

/mob/living/run_pointed(atom/A)

/mob/living/run_pointed(atom/target)
if(!..())
return FALSE

var/obj/item/hand_item = get_active_hand()
if(istype(hand_item, /obj/item/gun) && A != hand_item)
if(a_intent == INTENT_HELP || !ismob(A))
visible_message("<b>[src.declent_ru(NOMINATIVE)]</b> указыва[pluralize_ru(src.gender,"ет","ют")] [hand_item.declent_ru(INSTRUMENTAL)] на [A.declent_ru(ACCUSATIVE)]")
add_emote_logs(src, "point [hand_item] to [key_name(A)] [COORD(A)]")
var/pointed_object = "[target.declent_ru(ACCUSATIVE)]"

if(target.loc in src)
var/atom/inside = target.loc
pointed_object += " внутри [inside.declent_ru(GENITIVE)]"

if(istype(hand_item, /obj/item/gun) && target != hand_item)
if(a_intent == INTENT_HELP || !ismob(target))
visible_message("<b>[declent_ru(NOMINATIVE)]</b> указыва[pluralize_ru(gender,"ет","ют")] [hand_item.declent_ru(INSTRUMENTAL)] на [pointed_object].")
return TRUE
A.visible_message("<span class='danger'>[src.declent_ru(NOMINATIVE)] указыва[pluralize_ru(src.gender,"ет","ют")] [hand_item.declent_ru(INSTRUMENTAL)] на [A.declent_ru(ACCUSATIVE)]!</span>",
"<span class='userdanger'>[src.declent_ru(NOMINATIVE)] указыва[pluralize_ru(src.gender,"ет","ют")] [hand_item.declent_ru(INSTRUMENTAL)] на [pluralize_ru(A.gender,"тебя","вас")]!</span>")
A << 'sound/weapons/targeton.ogg'
add_emote_logs(src, "point [hand_item] HARM to [key_name(A)] [COORD(A)]")

target.visible_message(
span_danger("[declent_ru(NOMINATIVE)] указыва[pluralize_ru(src.gender,"ет","ют")] [hand_item.declent_ru(INSTRUMENTAL)] на [pointed_object]!"),
span_userdanger("[declent_ru(NOMINATIVE)] указыва[pluralize_ru(src.gender,"ет","ют")] [hand_item.declent_ru(INSTRUMENTAL)] на [pluralize_ru(target.gender,"тебя","вас")]!"),
)
SEND_SOUND(target, sound('sound/weapons/targeton.ogg'))
add_emote_logs(src, "point [hand_item] HARM to [key_name(target)] [COORD(target)]")
return TRUE
visible_message("<b>[src.declent_ru(NOMINATIVE)]</b> указыва[pluralize_ru(src.gender,"ет","ют")] на [A.declent_ru(ACCUSATIVE)]")
add_emote_logs(src, "point to [key_name(A)] [COORD(A)]")

if(istype(hand_item, /obj/item/toy/russian_revolver/trick_revolver) && target != hand_item)
var/obj/item/toy/russian_revolver/trick_revolver/trick = hand_item
visible_message(span_danger("[declent_ru(NOMINATIVE)] указыва[pluralize_ru(src.gender,"ет","ют")] [trick.declent_ru(INSTRUMENTAL)] на... и [trick.declent_ru(NOMINATIVE)] срабатывает у [genderize_ru(gender, "него","неё","него","них")] в руке!"))
trick.shoot_gun(src)
add_emote_logs(src, "point to [key_name(target)] [COORD(target)]")
return TRUE

visible_message("<b>[declent_ru(NOMINATIVE)]</b> указыва[pluralize_ru(gender,"ет","ют")] на [pointed_object].")
add_emote_logs(src, "point to [key_name(target)] [COORD(target)]")
return TRUE


/mob/living/verb/succumb()
set hidden = 1
if(InCritical())
Expand Down
9 changes: 5 additions & 4 deletions code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1341,13 +1341,14 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
if(stat != DEAD && isturf(tile))
var/floor_only = TRUE
for(var/A in tile)
if(istype(A, /obj/effect))
if(is_cleanable(A))
var/obj/effect/decal/cleanable/blood/B = A
if(iseffect(A))
var/obj/effect/check = A
if(check.is_cleanable())
var/obj/effect/decal/cleanable/blood/B = check
if(istype(B) && B.off_floor)
floor_only = FALSE
else
qdel(A)
qdel(B)
else if(istype(A, /obj/item))
var/obj/item/cleaned_item = A
cleaned_item.clean_blood()
Expand Down
Loading

0 comments on commit ac8adfa

Please sign in to comment.