Commit Graph

21 Commits

Author SHA1 Message Date
Firecage
2ae0380fef Does some code standardization/consistency 2017-10-05 11:13:47 +02:00
AnturK
b035de9a31 Fixes mecha. Also adjacent called from border objects. 2017-08-31 18:43:39 +02:00
Ian Turk
7460f2c5b8 Replaced flags with flags_1 2017-08-16 13:01:15 -06:00
Jordan Brown
ef49cea059 Add braces 2017-07-15 11:23:03 -04:00
AnturK
a906888918 Fixes blob diagonal click. WAS IT WORTH IT, TIME WILL TELL 2017-07-13 20:36:35 +02:00
nicbn
77a2d3f5cd Replaces "istype"s with is_helpers macros (#28676) 2017-06-22 15:03:19 -03:00
AnturK
530996a171 Fixes adjacency. 2017-03-16 18:33:21 +01:00
phil235
94d072828f Merge branch 'master' of https://github.com/tgstation/-tg-station into CatchThrownPieFix
Conflicts:
	code/game/atoms_movable.dm
	code/game/objects/items/weapons/dice.dm
	code/game/objects/weapons.dm
	code/modules/flufftext/Hallucination.dm
	code/modules/mob/living/living_defense.dm
	code/modules/mob/living/living_defines.dm
	code/modules/reagents/reagent_containers.dm
2015-07-19 21:53:39 +02:00
phil235
9eced1ac5b Fixes thrown closet opening to not use spawn().
Fixes throw_at() to look nicely for xeno leap by adding the diagonals_first argument.
Removes useless gateway/Crossed and gateway/Bumped().
Changes throw_at() to use diagonal directions.
I replaced the atom variable "throwpass" with the LETPASSTHROW pass_flags
I readded hit_check proc to catch things getting on the thrown thing's tile during its sleep(1) (especially needed for mobs running towards the thing), the only other possibility would've been to add throwing checks in atom/movable/Crossed() (called after every move) and I don't think it'd be worth it.
I added the item var "thrownby" to be able to continue to log the thrower of the item when it hits a mob. It removes the need for a thrower argument in throw_impact() and hitby().
2015-07-19 21:29:35 +02:00
Firecage
4688c2c969 Fixes proc arguments 2015-07-15 23:52:35 +02:00
MrStonedOne
addb63adad Utterly guts the use of .locs from the game.
They

This means that multi-tile things may not handle correctly, but the only thing that used it was atmos for double wide doors, and they are used in one location that is unlikely to have atmos changes

see: http://www.byond.com/forum/?post=1852790 for justifcation. (tl;dr: accessing .locs causes memory leaks)
2015-05-21 23:41:47 -07:00
Aranclanos
c0fb324940 Firelocks will now have a higher layer than doors when closed, they won't need any more special checks to reach them because an airlock is on top of them.
New variable for doors, closingLayer, on firedoors its 3.11 and normal doors on their classic 3.1
Fixes issue #412
2015-05-15 20:21:22 -03:00
Menshin
726e5d2bf5 Corrected swapped comments 2014-05-05 01:10:18 +02:00
Menshin
8b448390d1 Reverted back to some optimized checks 2014-04-25 09:53:36 +02:00
Menshin
e4b640c3ae Fixed the adjacent proc to correctly process diagonals checks (fix #3519). 2014-04-25 01:44:07 +02:00
Mloc-Hibernia
8af8a43d6f Initial pass to convert LF to CRLF
Signed-off-by: Mloc-Hibernia <colmohici@gmail.com>
2014-03-24 08:53:40 +00:00
supersayu
a3ba991d2f Additional comments, move some code
Should improve documentation of new and old click code
2013-09-17 19:03:22 -04:00
supersayu
a993ce62db Bugfixen and minor changes. Fixes #136.
Adjusts the click code to not use client/Click().  The code is largely unchanged, except that it allows the compiler default behaviour of calling atom/Click(), and then forwards the call to mob/ClickOn().  I had some reports that melee combat mixed with movement was behaving oddly, and I believe it may be due to the use of client/Click; the byond documentation says that redefining client/Click() causes additional overhead, and it isn't strictly necessary.

Alters the way double clicks are handled, in an attempt to better handle clickspam, as often occurs during pitched combat.  This may also be responsible for the above, but I don't know.

Inserts proximity (aka flag) checks in all afterattack() procs.  The old assumption was that unless an item used the USEDELAY flag, afterattack() was only called when adjacent, but this is no longer true.  This led to beakers, soap, crayons, etc, all being usable at all ranges.

Removes the NODELAY flag, which was unused.  Removes all existing uses of the USEDELAY flag so that it can be readded to things that need extra delay.

Removes the hand_* procs, previously used by restrained actions.  Instead, the mob helper mob/RestrainedClickOn() has abosrbed basically all the functionality they were used for, which is really only monkeys with jungle fever.

Adds a special case of the Adjacency() proc for doors.  This fixes #136, airlocks being unreachable due to border fire doors.  However, this only takes us back to the unpleasant position where you have to open-hand the door, switch to a crowbar, and pry open the firedoor; it still needs a better fix.
2013-09-17 18:19:14 -04:00
supersayu
0aa3ce39e4 Bugfixen
Modifies Adjacent() for items, to allow items to be accessed properly inside each other and the user.  This fixes a few bugs seen in testing.
Sets a maximum telekinesis range (in case you were using cameras).

The telekinetic grab now does nothing at all in melee combat.  This prevents double messages where you attack them with the object telekinetically, and then also attack them with the telekinetic grab.

Crayons had a bug where they were drawing at all distances.  This is because in old click code, afterattack() only happened at range when you had the USE_DELAY flag, which is no longer true.  Proper behavior is to use parameter 3 (proximity_flag), which is 1 when adjacent or 0 if inaccessible.
2013-09-17 18:19:10 -04:00
supersayu
c172e52dce Adds telekinesis to click code. Fixes issue #1202, #1129, #247.
This adds two atom procs, attack_tk() and attack_self_tk().  attack_tk is used as per attack_hand; attack_self_tk exists on all atoms (not just items) but is similar to the item proc, but without the assumption that it is in the user's hand.

Removes the functionality where entering throw mode would create a tk grab, as it is redundant.

As a default, attack_tk does the following:
* Creates a telekinetic throw for items and un-anchored objects
* Does an attack_hand (paw, animal, etc) for anchored objects
* Does nothing to mobs

As a default, attack_self_tk does nothing.  An attack_self_tk was added to closets to open and close them since that's a common thing.

The following items have added attack_tk procs:
* Fire axe cabinet, extinguisher cabinet, and bedsheet bin will drop into their square instead of putting it in your hand
* Doors only open telekinetically if they require no access
* Chairs will rotate if nobody is buckled to them
* Filing cabinets will remove a paper at random.
* Tables and racks return to prevent telehulk smash

This is INCOMPLETE.  Adding proper TK interaction to everything is something best done in pieces.

In particular, interacting with mobs and items both open up the floodgates for bugs, so we/I need to decide how we want it to go before we commit, and then fix bugs along the way.  Stumbling forward, fixing bugs, and then changing course halfway would be a bad idea.
2013-09-17 18:19:09 -04:00
supersayu
475042a212 Click code rework
Fixes #646, #579, #863

Completely redoes the click code.  Moves all click related code into code/_onclick for reference.  Also moves hud datum code and all the screen object code I could find into code/_onclick/hud, as it is related.  Item attack(), attackby(), afterattack(), and attack_self() have been moved into item_attack.dm for consistency.

Completely removes dummy objects and adds atom.Adjacent(user).  This proc checks for border items and anything marked with throwpass for determining whether or not you can reach a given square.  A turf helper, ClickCross(), was added to facilitate this.

Removes the monolithic Atom.Click() proc in favor of an overridable click handler attached to mobs.  Click code no longer uses the : path operator as a consequence, and mob/lastDblClick has been moved to Client/next_click.  A few end arounds were necessary (screen objects, buildmode, and spells), but this has been handled by repurposing Atom.Click(); if you have special click code, insert it in the object's Click() function and return 1 to prevent normal processing.

This update adds support for attack_ghost(); the previous "new" click handler had support for it but was never finished.  I have taken the liberty of letting ghosts click portals, the gateway, and the teleporter to jump to the intended target square, and kept the previous default action of examine()ing every damn thing you click.  It is to be suggested that you could do more with this proc when ghost interactions are enabled.

This update also adds support for double clicking.  It is currently only used for ghosts and AIs, because the original (first) click still registers normally.  For both of these, double clicking a square will jump you to it, and double clicking a mob will follow it.  In the case of ghosts, double clicking bots and the singularity will also set you following it; if you double click your own corpse, you will re-enter it; this also works if your body is in a closet, sleeper, DNA scanner, etc.  Default mobs ignore double clicks as normal.

-- NOTE --

There are two flags which were previously unused or misused by click code: USEDELAY and NODELAY.  Ostensibly, USEDELAY would double the normal 1sec delay, and NODELAY would remove it.

Using either of these flags as intended would significantly affect the timing of the game.  In particular, USEDELAY is currently applied to guns and about everything else that acts at range.  I am adding USEDELAY as a half-second increase for now, but I have not put a significant amount of thought into it.  I considered lowering the normal 1sec delay to .8sec to balance it, but the consequences of that on combat involve more calculations than I care to make.

NODELAY seems to never have been used, and I did not implement it, but I could do so trivially.
2013-09-17 18:15:54 -04:00