  We present a variation of the recently updated Munich semi-analytical galaxy
formation model, L-Galaxies, with a new gas stripping method. Extending earlier
work, we directly measure the local environmental properties of galaxies to
formulate a more accurate treatment of ram-pressure stripping for all galaxies.
We fully re-calibrate the modified L-Galaxies model using a Markov Chain Monte
Carlo (MCMC) method with the stellar mass function and quenched fraction of
galaxies at $0\leq z\leq2$ as constraints. Due to this re-calibration, global
galaxy population relations, including the stellar mass function, quenched
fractions versus galaxy mass and HI mass function are all largely unchanged and
remain consistent with observations. By comparing to data on galaxy properties
in different environments from the SDSS and HSC surveys, we demonstrate that
our modified model improves the agreement with the quenched fractions and star
formation rates of galaxies as a function of environment, stellar mass, and
redshift. Overall, in the vicinity of haloes with total mass $10^{12}$ to
$10^{15}\rm M_{\odot}$ at $z=0$, our new model produces higher quenched
fractions and stronger environmental dependencies, better recovering observed
trends with halocentric distance up to several virial radii. By analysing the
actual amount of gas stripped from galaxies in our model, we show that those in
the vicinity of massive haloes lose a large fraction of their hot halo gas
before they become satellites. We demonstrate that this affects galaxy
quenching both within and beyond the halo boundary. This is likely to influence
the correlations between galaxies up to tens of megaparsecs.
