Build mode drag-and-build functionality (#8936)

This commit is contained in:
Mykhailo Bykhovtsev
2020-05-26 15:31:59 +02:00
committed by GitHub
parent dfe07d929c
commit bd7f500803
4 changed files with 63 additions and 11 deletions
+4
View File
@@ -36,6 +36,10 @@
/mob/proc/OnMouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params)
if(istype(loc, /atom))
var/atom/A = loc
if(client && client.buildmode)
build_click(src, client.buildmode, params, A)
return
if(A.RelayMouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params, src))
return
+17
View File
@@ -734,3 +734,20 @@
sleep(1)
else
stoplag(5)
/client/MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params)
. = ..()
if(over_object)
var/mob/living/M = mob
if(istype(get_turf(over_object), /atom))
var/atom/A = get_turf(over_object)
if(src && src.buildmode)
build_click(M, src.buildmode, params, A)
return
if(istype(M) && !M.incapacitated())
var/obj/item/gun/gun = mob.get_active_hand()
if(istype(gun) && gun.can_autofire())
M.set_dir(get_dir(M, over_object))
gun.Fire(get_turf(over_object), mob, params, (get_dist(over_object, mob) <= 1), FALSE)
+1 -11
View File
@@ -824,14 +824,4 @@
//Autofire
/obj/item/gun/proc/can_autofire()
return (can_autofire && world.time >= next_fire_time)
/client/MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params)
. = ..()
if(over_object)
var/mob/living/M = mob
if(istype(M) && !M.incapacitated())
var/obj/item/gun/gun = mob.get_active_hand()
if(istype(gun) && gun.can_autofire())
M.set_dir(get_dir(M, over_object))
gun.Fire(get_turf(over_object), mob, params, (get_dist(over_object, mob) <= 1), FALSE)
return (can_autofire && world.time >= next_fire_time)
+41
View File
@@ -0,0 +1,41 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: PoZe
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Admin build mode now supports drag-and-build. Where you can hold mouse to continously build."